Add manual compile mode to pause Turbopack scheduling during batched edits#92410
Open
Add manual compile mode to pause Turbopack scheduling during batched edits#92410
Conversation
4aef97c to
b6698bb
Compare
Collaborator
Failing test suitesCommit: b9a132e | About building and testing Next.js
Expand output● instant-nav-panel › should show loading skeleton during SPA navigation after clicking Start |
Merging this PR will not alter performance
Comparing Footnotes
|
b6698bb to
98d73ac
Compare
Collaborator
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
98d73ac to
5efe904
Compare
5efe904 to
b9a132e
Compare
gaojude
added a commit
that referenced
this pull request
Apr 6, 2026
Adds a new `next-dev` plugin to the Next.js Claude Code marketplace
that wires the dev server's MCP endpoint into Claude Code via two
skill-scoped hooks:
- UserPromptSubmit: pings the dev server and calls `pause_compilation`
so intermediate edits don't trigger HMR.
- Stop: calls `compile_and_resume` (one batch compile) followed by
`get_compilation_issues`, blocking the agent from finishing if
compilation errors exist.
State files (`.claude/port`, `.claude/dismissed-issues.json`) are
project-local; hook scripts live under `${CLAUDE_PLUGIN_ROOT}`.
Marked experimental in the manifest, marketplace, and README — depends
on `pause_compilation`/`compile_and_resume` MCP tools that are still
landing in #92410. The activation script verifies the tools are
present and refuses to enable hooks otherwise.
5 tasks
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.
When an AI agent edits multiple files in sequence, Turbopack eagerly recompiles after each save. This produces ephemeral compilation errors (e.g. importing a module that hasn't been created yet) and wastes CPU on intermediate states that are immediately invalidated.
This adds two new MCP tools:
pause_compilationandcompile_and_resume. Callingpause_compilationpauses the turbo-tasks scheduler — file changes still mark tasks dirty via the file watcher, butschedule()buffers task IDs instead of dispatching them to the priority runner. No compilation happens, no errors are produced, and no HMR messages reach the browser.Calling
compile_and_resumeclears the pause flag, drains all buffered tasks into the scheduler, and waits forevent_foreground_donebefore returning. This produces exactly one compilation cycle from the final file-system state. The existing HMR pipeline then sends one clean update to the browser with the correct issues and module state. Zero JS-side guards are needed because no intermediate compilation ever occurs.The pause is implemented as an
AtomicBooland aMutex<Vec<(TaskId, TaskPriority)>>on theTurboTasksstruct. The gate inschedule()is the only code path that changes behavior — everything else (subscriptions,handleProjectUpdates,sendEnqueuedMessages,sendToClient) runs unmodified.