Run security upgrades through Codex and Claude - #98563
Closed
devjiwonchoi wants to merge 4 commits into
Closed
devjiwonchoi wants to merge 4 commits into
devjiwonchoi wants to merge 4 commits into
Conversation
devjiwonchoi
added this pull request to stack #98564
September 11, 2026 13:22
Contributor
Failing test suitesCommit: 83a9715 | About building and testing Next.js
Expand output● instant-nav-panel › SPA captures › should capture when CookieStore writes are not reflected in document.cookie ● instant-nav-panel › SPA captures › should show loading skeleton during SPA navigation after clicking Start
Expand output● next-server-nft › with output:standalone › should not trace too many files in next-server.js.nft.json Other failing CI jobs |
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 13:28
a43c8e1 to
3a464f7
Compare
devjiwonchoi
removed this pull request from stack #98564
September 11, 2026 13:31
devjiwonchoi
added this pull request to stack #98567
September 11, 2026 13:31
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/setup
branch
from
September 11, 2026 14:16
7e72fc9 to
dd858a0
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 14:16
3a464f7 to
4502a77
Compare
devjiwonchoi
removed this pull request from stack #98567
September 11, 2026 14:32
devjiwonchoi
added this pull request to stack #98572
September 11, 2026 14:33
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 14:43
4502a77 to
ef8beae
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/setup
branch
from
September 11, 2026 14:43
dd858a0 to
a8faf6d
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 14:55
ef8beae to
0e34422
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/setup
branch
from
September 11, 2026 14:55
a8faf6d to
64be173
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 15:02
0e34422 to
3dda56d
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/setup
branch
from
September 11, 2026 15:02
64be173 to
02315c3
Compare
An upgrade agent needs an exact safe destination and compatible execution arguments before it starts editing. Merely choosing the newest release can introduce an unnecessary major upgrade, and a failed advisory lookup must not be interpreted as proof that the application is safe. Add experimental.agenticAutoUpgrade: security and a reusable resolver for the selected app, installed Next.js, reviewed GitHub advisories and npm advisory fallback. Choose the latest stable release in the first eligible safe major, resolve pinned codemod arguments with adoption disabled, and report actionable blockers. Exit before config evaluation or network access when the selected directory has no supported Next.js config. Unit tests cover target selection and failures. This commit prepares the library; command exposure follows later.
Updating Next.js can replace its installed documentation before an agent has finished resolving codemod leftovers. The agent also needs the original app state and security evidence to verify what changed and avoid duplicate work. Prepare a retained context packet with baseline hashes, resolved versions, advisory evidence and relevant canonical guides. Preserve guide paths and source provenance, and package workflow instructions for prerequisite checks, codemods, contextual repairs, supported verification and commit checkpoints. Carry the dry-run delivery limit through the packet so local validation ends before publication. Test selection, retention and failed-preparation cleanup; this layer does not yet expose the command or launch an agent. Keep the types with the security, resolution and resource modules that own them, rather than maintaining a separate shared types file. Bundle the experimental workflow guides through the existing docs pipeline, mark them as drafts, and retain copies before replacing the installed package.
An agent already working in a Next.js app needs a single entrypoint that checks whether a security upgrade is necessary and supplies durable migration guidance. Launching another agent in that situation would lose the current task context. Connect next upgrade --agent to security resolution and resource preparation. Return early for disabled, unnecessary or blocked upgrades, then hand the packet to the detected Codex or Claude session. Preserve the caller's environment and the legacy non-agent upgrade path. Add --dry-run for migration, verification and local commits without publication, and refuse that flag without --agent. The next checkpoint adds ordinary-terminal launch support.
A human invoking next upgrade should be able to delegate an eligible migration and return to the terminal. Opening an interactive foreground session defeats that workflow, and suggesting live attachment to a running Codex writer fails. Discover Codex and Claude, reuse the CLI picker when both are installed, and launch detached Codex exec or Claude's native background mode. Select Luna for new Codex workers and Haiku for new Claude workers to match the baseline evals. Return session, logs, stop and continuation information with actionable launch errors. Existing-agent handoff retains its current model. Codex continuation requires the original writer to finish or stop; its link is not live attachment. Cover selection, launch failures, exit propagation and Claude receipt handling.
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/workflow
branch
from
September 11, 2026 15:27
3dda56d to
83a9715
Compare
devjiwonchoi
force-pushed
the
jiwon/agent-upgrade/setup
branch
2 times, most recently
from
September 11, 2026 15:54
6c80ab4 to
8d37a7e
Compare
devjiwonchoi
removed this pull request from stack #98572
September 11, 2026 15:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #98562.
Why?
An agent working in a Next.js app needs one command that determines whether a security upgrade is necessary and supplies durable migration guidance. A user running that command from a terminal needs background execution with an actionable session receipt.
How?
Expose
next upgrade --agentthrough the prepared resolver and resource packet. Hand instructions back to an existing Codex or Claude session, or select an installed harness and launch detached Codex execution or Claude's native background mode. New workers use Luna or Haiku; existing sessions retain their model.Add
--dry-runto stop after migration, verification and local commits, with no push or PR. Receipts provide session, logs, stop and continuation instructions; Codex continuation requires its active writer to finish or stop. Preserve the legacy non-agent command behavior and keep selection/launcher unit tests with the implementation.The migration eval suite is tracked separately in #98566 against a fixed implementation snapshot. This layer adds no
next devtrigger, adoption skills or eval CI automation.