Skip to content
TheChatArchiveThe Chat Archive
xiaomi/mimo-v2.5-pro· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Pages Router: gssp/getStaticProps responses missing default and…

  1. User

    ISSUE DESCRIPTION

    Pages Router: gssp/getStaticProps responses missing default and user-set Cache-Control header

    This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-22).

    Problem

    Pages Router gssp responses lack Cache-Control headers. Tests expect the default private, no-cache, no-store, max-age=0, must-revalidate for gssp pages and custom values set via res.setHeader('Cache-Control', ...), but vinext returns null. The default header is not applied and user setHeader calls are dropped.

    Expected: "private, no-cache, no-store, max-age=0, must-revalidate"
    Received: null
    

    Estimated Impact

    ~2 test failures across the deploy suite.

    Affected Test Suites

    • test/e2e/getserversideprops/test/index.test.ts (2 failures)

    Recommendation

    1. Reproduce first in vinext's own test suite. Add a Pages Router gssp page and assert the response carries the default Cache-Control header; add a second page that overrides it via res.setHeader and assert the override sticks.

    2. Emit the default gssp Cache-Control. When serving a gssp response in deploy mode, set Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate unless the user set it explicitly.

    3. Preserve res.setHeader overrides. Make sure headers set during gssp dispatch are forwarded to the final HTTP response.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /vinext, current file: none) bash-$

  2. Assistant

    I'll start by exploring the repository structure to understand the codebase and locate relevant files. Let me first get an overview.

  3. Assistant

    Let me understand the repository structure better. This appears to be a Next.js-related project (vinext) that's a deploy suite. Let me look for the test file mentioned in the issue.

  4. Assistant

    Let me look at the tests directory structure to find the test mentioned in the issue.

  5. Assistant

    Let me look for tests related to getServerSideProps or gssp.

  6. Assistant

    Let me look for the test file mentioned in the issue.

  7. Assistant

    That path doesn't exist in this repo. The issue mentions tests from the Next.js Deploy Suite (vinext). Let me look for tests related to "cache-control" and "gssp" to understand the problem better.

  8. Assistant

    Let me look at the cache-control test file and pages-router test file to understand the issue better.

  9. Assistant

    Let me look at the pages-page-response.test.ts file to understand how pages router responses are tested.

  10. Assistant

    Now let me look at the pages router test and related source files to understand the gssp handling.

  11. Assistant

    Let me look at the deploy test file to understand how deploy mode handles gssp responses.

  12. Assistant

    Let me explore the source code for gssp handling in the server code to understand the issue better.

  13. Assistant

    Let me look at the pages-page-response.ts file to see how gssp responses are handled.

  14. Assistant

    Let me look at the prod-server.ts to understand how gSSP responses are handled in production.

  15. Assistant

    Let me look at the pages-server-entry.ts to understand how gSSP responses are dispatched.

  16. Assistant

    Now I need to understand the issue. Let me look at the pages-page-data.ts to see how gSSP responses are created.

  17. Assistant

    Let me look at the pages-node-compat.ts to see how the res object is created for getServerSideProps.

  18. Assistant

    Now let me look at the dev-server.ts to see how gSSP responses are handled in development.

  19. Assistant

    Now I understand the issue. Let me look more closely at how the gSSP cache-control is handled in the dev-server.ts. Let me search for where gsspExtraHeaders are built.

  20. Assistant

    Let me look at the relevant section of dev-server.ts where gsspExtraHeaders are set and the cache-control handling.

  21. Assistant

    Let me look at the section where Cache-Control is set for gSSP responses in dev-server.ts.

  22. Assistant

    Now I understand the issue. Let me look at the pages-page-response.ts more closely to see the Cache-Control logic after gSSP headers are applied.

  23. Assistant

    Let me check the test for pages-page-response.ts to understand what the expected behavior should be.

  24. Assistant

    Now I have a clear understanding of the issue. Let me examine the dev-server.ts more carefully to see how gSSP headers are handled.

  25. Assistant

    Now I have a clear understanding of the issue. Let me examine the test files to understand the expected behavior better.

  26. Assistant

    Now I have a clear understanding of the issue. Let me trace through the code flow to understand exactly what's happening:

    1. In pages-page-response.ts: The applyGsspHeaders function merges headers from gSSP responses but does NOT set a default Cache-Control header. After it runs, only ISR/script-nonce Cache-Control is applied, leaving gSSP responses without any Cache-Control header.

    2. In dev-server.ts: Similarly, gSSP headers are collected but no default Cache-Control is set for gSSP pages.

    The fix needs to:

    1. Set a default Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate for gSSP pages when the user hasn't explicitly set one
    2. Preserve user-set Cache-Control headers from res.setHeader()

    Let me first look at the dev-server.ts more closely to understand the gSSP handling there.

  27. Assistant

    Let me look at the test file to understand what the expected behavior should be for gSSP pages.

  28. Assistant

    Let me look for e2e tests related to getServerSideProps.

  29. Assistant

    Let me look for tests that check Cache-Control header for gSSP responses in the e2e tests.

  30. Assistant

    Let me look at the e2e tests related to pages router ISR to understand the expected behavior.

  31. Assistant

    Let me look at how gSSP responses are handled in the dev-server.ts more closely.

  32. Assistant

    Let me look at how isrRevalidateSeconds is determined in dev-server.ts to understand if gSSP pages are always ISR or not.

  33. Assistant

    Now I have a clear understanding of the issue. Let me trace through the code:

    1. In pages-page-response.ts, when gsspRes is present (getServerSideProps was called), headers from the gSSP response are merged, but no default Cache-Control header is set for gSSP pages.

    2. After applyGsspHeaders, Cache-Control is only set for:

      • scriptNonce → "no-store, must-revalidate"
      • isrRevalidateSeconds → ISR cache control
      • Otherwise: no Cache-Control at all!
    3. In dev-server.ts, the same issue exists - gSSP headers are collected but no default Cache-Control is set for gSSP pages.

    The fix needs to:

    1. Set default Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate for gSSP pages when user hasn't set one explicitly
    2. Preserve user-set Cache-Control headers from res.setHeader()

    Let me first check the pages-node-compat.ts to understand how the res object works.

  34. Assistant

    Let me check how the dev-server.ts handles gSSP cache-control to see if it's also missing the default.

  35. Assistant

    Now I have a clear understanding of the issue. Let me look at the prod-server.ts to see how gSSP responses are handled there.

  36. Assistant

    Let me look at the prod-server.ts more carefully to see how it handles pages router responses.

  37. Assistant

    Let me look at the prod-server.ts more closely for how it handles pages SSR.

  38. Assistant

    Now I have a clear understanding of the issue. Let me trace through the code flow:

    1. In pages-page-response.ts, the applyGsspHeaders function copies headers from the gSSP response to the output headers. However, it does NOT set a default Cache-Control header for gSSP pages.

    2. After applyGsspHeaders, Cache-Control is only set for ISR pages (when isrRevalidateSeconds is set) or for script nonce pages. For regular gSSP pages (non-ISR, non-nonce), NO Cache-Control is set.

    3. In dev-server.ts, gSSP headers are collected in gsspExtraHeaders, but no default Cache-Control is set for gSSP pages.

    4. Next.js sets the default Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate for all gSSP pages.

    The fix needs to:

    1. In pages-page-response.ts: After applyGsspHeaders, if gsspRes is not null and no Cache-Control was set by the user, set the default.
    2. In dev-server.ts: After collecting gsspExtraHeaders, if no Cache-Control was set by the user and this is a gSSP page, set the default.

    Let me also check the test expectations. Let me look at the dev-server.ts to understand the full picture:

  39. Assistant

    Now I have a clear understanding of the issue. Let me create a reproduction script first to verify the issue exists.

  40. Assistant

    Let me run the existing tests first to understand the current state.

  41. Assistant

    Let me check what test runner they use.

  42. Assistant

    Let me look at the vitest config to understand how to run tests.

  43. Assistant

    Let me run the specific unit test with the right command.

  44. Assistant

    Let me try running the test differently.

  45. Assistant

    Let me try to figure out how to run the tests in this project.

  46. Assistant

    Let me try to find how to run the tests.

  47. Assistant

    Let me try running it directly with vitest.

  48. Assistant

    Let me look at the vite config to understand the test project structure.

  49. Assistant

    Let me understand the issue better. The problem is that when serving gSSP (getServerSideProps) responses, the Cache-Control header is missing. Let me look at the key code paths:

    1. In pages-page-response.ts, the applyGsspHeaders function merges headers from gSSP responses but doesn't add default Cache-Control
    2. In dev-server.ts, after calling getServerSideProps, gSSP headers are collected but default Cache-Control is not added

    The fix needs to:

    1. When there's a gSSP response (gsspRes is not null), set the default Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate unless the user already set it
    2. Preserve any user-set Cache-Control headers from res.setHeader()

    Let me now look at the exact place where we need to make changes.

  50. Assistant

    Now I understand the issue. Let me trace through the full code flow:

    In pages-page-response.ts:

    1. applyGsspHeaders() copies headers from gSSP response (including user-set Cache-Control) - this works fine
    2. After that, Cache-Control is only set for scriptNonce or isrRevalidateSeconds pages
    3. For regular gSSP pages (no ISR, no nonce), NO Cache-Control is set!

    In dev-server.ts:

    1. gSSP headers are collected in gsspExtraHeaders - user-set headers are preserved
    2. Cache-Control is only set for isrRevalidateSeconds pages
    3. For regular gSSP pages, NO Cache-Control is set!

    The fix is to:

    1. In pages-page-response.ts: After applying gSSP headers, if gsspRes is not null and no Cache-Control is set, add the default gSSP Cache-Control
    2. In dev-server.ts: After collecting gSSP headers, if it's a gSSP page and no Cache-Control is set, add the default

    Let me implement the fixes:

  51. Assistant

    Let me open the file properly.

  52. Assistant

    Now I can see the exact issue. In pages-page-response.ts, after applyGsspHeaders runs (line 377), Cache-Control is only set for:

    1. Pages with scriptNonce (line 379-380)
    2. Pages with isrRevalidateSeconds (lines 381-386)

    For regular gSSP pages (non-ISR, non-nonce), NO Cache-Control is set at all!

    The fix needs to add the default gSSP Cache-Control when:

    • gsspRes is not null (it's a gSSP page)
    • No Cache-Control was already set (neither by user nor by ISR/scriptNonce logic)

    Let me implement the fix in both files:

  53. Assistant

    Let me try with the edit command syntax properly.

  54. Assistant

    Let me use the correct edit command syntax.

  55. Assistant

    Let me use sed to make the edit.

  56. Assistant

    Let me verify the edit was correct.

  57. Assistant

    The sed command didn't produce the correct result. Let me fix it properly.

  58. Assistant

    Let me use a Python script to make the edit properly.

  59. Assistant

    Let me use the edit command properly.

  60. Assistant

    Let me write the script to a file first to avoid shell escaping issues.

  61. Assistant

    Let me verify the edit.

  62. Assistant

    The edit looks correct. Now I need to fix the same issue in the dev-server.ts. Let me look at the exact location where I need to add the fix.

  63. Assistant

    Now I need to apply the same fix to the dev-server.ts. After the ISR Cache-Control block, I need to add the default gSSP Cache-Control when no Cache-Control was set by the user and it's a gSSP page.

  64. Assistant

    Let me verify the edit.

  65. Assistant

    Both edits look correct. Now let me run the relevant unit tests to verify the changes.

  66. Assistant

    The tests are timing out. Let me try with a more direct approach.

  67. Assistant

    Let me try a different approach. Let me check if there's a node-based test runner.

  68. Assistant

    Let me try running the test differently.

  69. Assistant

    Let me check what's available for running tests.

  70. Assistant

    Let me try to find the right way to run tests in this project.

  71. Assistant

    The test runner is vp (vite-plus). Let me use that.

  72. Assistant

    Good, the existing tests pass. Now let me check if there are any tests that specifically test the gSSP Cache-Control behavior. Let me look at the pages-page-response test file again more carefully.

  73. Assistant

    Let me look at the first test in the file to see if it has gSSP and no ISR.

  74. Assistant

    The first test has gsspRes with headers but doesn't check Cache-Control. My fix should add the default Cache-Control for that case. Let me verify my fix works correctly by running all the tests.

  75. Assistant

    Good, the tests pass. Now let me run the dev-server related tests to make sure my changes there don't break anything.

  76. Assistant

    Let me also run the request-pipeline test which handles cache-control headers.

  77. Assistant

    Let me run a broader set of unit tests to make sure nothing is broken.

  78. Assistant

    All 170 test files passed (4755 tests). My changes don't break any existing tests. Let me also check if there are any other code paths that need the same fix. Let me look at the data route handler for gSSP JSON responses.

  79. Assistant

    Let me check if there's a data route that also needs the fix.

  80. Assistant

    Let me check how the data route builds the JSON response.

  81. Assistant

    Let me look at the buildNextDataJsonResponse function.

  82. Assistant

    Let me also check how the dev-server.ts handles gSSP data requests (/_next/data/...).

  83. Assistant

    Let me look at the data request handling in dev-server.ts.

  84. Assistant

    I see there's also the data request path (for /_next/data/... requests) that might need the same fix. Let me also check the pages-server-entry.ts for the data request path.

  85. Assistant

    Let me look at the pages-server-entry.ts for how gSSP data requests are handled and see if there's the same issue.

  86. Assistant

    Let me look at the _next/data path in the pages-server-entry.ts to see if it also needs the fix.

  87. Assistant

    Now I see there's also the _next/data JSON envelope path in the worker entry. Let me also check if that needs the default Cache-Control. Let me also look at how this works in the prod-server for gSSP data requests.

  88. Assistant

    The data request path (_next/data/...json) for gSSP pages also needs the default Cache-Control. Let me fix that too. First, let me look at the data request path in the pages-server-entry.ts:

  89. Assistant

    Actually, wait. The issue is specifically about the HTML response for gSSP pages, not the data request path. Let me reconsider. The data request path (_next/data/...json) returns JSON, and the test failure is about the HTML page Cache-Control header. Let me revert the pages-server-entry.ts change since it's not needed for this issue.

  90. Assistant

    Now let me verify the current state of my changes and run the tests again.

  91. Assistant

    Good. Let me also check the dev-server.ts changes.

  92. Assistant

    Both changes look correct. Let me also check if the _next/data request path in dev-server.ts needs the same fix.

  93. Assistant

    The dev-server.ts _next/data path doesn't set a default Cache-Control either, but the issue is specifically about the HTML page response. Let me now run the full unit test suite to make sure everything is working correctly.

  94. Assistant

    All 170 test files pass (4755 tests). My changes don't break any existing tests. Let me also check if the _next/data request path in the pages-server-entry.ts (production) needs the same fix.

  95. Assistant

    Now I need to also apply the fix to the _next/data JSON response path in the pages-server-entry.ts (production worker). Let me also fix the dev-server.ts data request path.

  96. Assistant

    Let me verify all the changes are correct.

  97. Assistant

    Let me verify all the changes look correct.

  98. Assistant

    The changes look correct. Let me run the full test suite one more time to make sure everything is working correctly.

  99. Assistant

    All 170 test files pass (4755 tests). My changes don't break any existing tests. Let me clean up the temporary files.

  100. Assistant

    I need to submit my changes now. Let me clean up temporary files and then submit.

  101. Assistant

    Now let me verify the final state of my changes before submitting.

  102. Assistant

    Now let me verify the final state of my changes one more time.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.