fix(coding-agent): isolate Inspector import crashes#321
Closed
minpeter wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 24, 2026
Contributor
Author
|
Superseded by #336, the verified patch-equivalent replacement based directly on current main. The replacement is an open draft, mergeable, one commit ahead/zero behind, with fresh focused test, build/check, and enabled/default real Inspector CLI QA evidence. |
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.
Summary
cli-mainunrelated failures
This is an independent one-commit PR based directly on current
main; it does not depend on compaction PR #310 orthe fork's compaction-TUI/codemode PRs.
Root cause
node inspectevaluates expressions in a VM context without animportModuleDynamicallycallback. A delayed import:therefore rejects with:
The CLI also has a launcher/child topology. With a fixed
NODE_OPTIONS=--inspect=..., the launcher previously claimedthe endpoint and
cli-maininherited the same option, producingaddress already in use. The debugger attached tothe wrapper rather than the TUI child.
Behavior
Before spawning
cli-main, the launcher now releases an active Inspector endpoint that came from inherited Nodestartup options. The child can bind the same endpoint, so an existing fixed-port debugging command targets the
interactive process.
Recovery remains disabled unless the process starts with:
The recovery predicate then requires:
unhandledRejectionoriginERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING<anonymous>timer provenanceThe opt-in is captured when the policy module loads, before runtime/extension loading. Later
process.envmutationcannot enable recovery. This explicit gate is necessary because Node does not expose a non-spoofable Inspector origin
on the global rejection.
RED -> GREEN
address already in useuncaughtExceptionuncaughtException, and unrelated errors remain fatalVerification
npm run build: passednpm run check: passedgit diff --check: passedThe parallel coding-agent suite completed 4,509 passing tests and 32 skips, but three unrelated temporary-file writes
returned Linux errno -122 under concurrent load. Each affected test file passed directly afterward. A serial full
package run exceeded the 600-second command ceiling before summary.
Real-surface QA
fixpi --help: two sequential Inspector endpoints, no port conflict, exit 0node inspect, explicit opt-in: warning visible, process remained aliveTypeError: remained fatal, exit 1Review
Independent goal, code-quality, security, hands-on QA, and upstream-context reviewers returned PASS with no remaining
blockers.
Summary by cubic
Stops Node Inspector port conflicts and isolates the Inspector VM dynamic-import crash so sessions don’t die unexpectedly. The debugger now attaches to the TUI, and with an explicit opt-in the exact Inspector import rejection no longer kills the process.
Bug Fixes
--inspectendpoint before spawningcli-main, letting the child rebind the same fixed port and avoiding “address already in use.”inspector-policywith an opt-in that keeps the TUI running only forERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSINGfrom Inspector eval (checked via origin and stack); shows a warning. All other errors remain fatal, and late env changes cannot enable recovery.Migration
SENPI_RECOVER_INSPECTOR_VM_IMPORT=1andNODE_OPTIONS=--inspect=127.0.0.1:<port>. Defaults remain unchanged.Written for commit 06fad3d. Summary will update on new commits.