Repository navigation
refactor(runtime): extract lifecycle ownership and journal worktree creation - #286
Closed
johannesjo wants to merge 10 commits into
Closed
johannesjo wants to merge 10 commits into
johannesjo wants to merge 10 commits into
Conversation
registerAllHandlers no longer owns the MCP runtime state: the transport, the lazy coordinator, delegation, the PTY exit cleanup and the canvas and wide-bind ownership maps now live in createMcpRuntime. Handlers read the coordinator through mcp.coordinator(). The copyFileSync and writeFileSync Semgrep rules cover the new file.
johannesjo
commented
Oct 10, 2026
johannesjo
left a comment
Owner
Author
There was a problem hiding this comment.
🗂️ Already on main, close instead of merging – 0 code issues at 38ffce01
- All 10 commits are already on
main.git cherry origin/main pr-286marks every commit-, meaning a patch-equivalent commit is already upstream. They landed on Sep 25–26 under new SHAs:403ec7b1,5f4e0290,2dfdd1c8,cc872335,21a69aac,debb5293,44c2485d,357a69ab,9d50e26a,09989bc1. Main has also changed these files since:462bd4c2updated the plan, and #297/61ce6d01touchedregister.ts,tasks.tsandpty.test.ts. Merging this branch now gives 8 conflicts (register.ts,mcp-runtime.ts,remote-transport.ts,register-wiring.test.ts,tasks.test.ts,pty.test.ts,register-mcp.test.ts,docs/runtime-separation-plan.md) and nothing to gain. Suggest closing the PR and deletingrefactor/runtime-separation. - The content holds up. I traced it anyway, since it is now on main:
worktree-intents.ts: the intent is recorded beforecreateWorktree. It is settled on everySaveAppState, matched bypath.resolveagainsttasks[*].worktreePath. Collapsed tasks are stored intaskstoo, so they count as claimed.- Startup reconcile runs before
createWindow(), so the first task cannot race it. Intents whose directory is gone are dropped, so a failedcreateWorktreeor a task deleted before its first save does not show up as an orphan. Nothing is deleted, and journal writes go throughatomicWriteFileSync. - Arena and document-run worktrees go around
createTask, so they are never journalled. That matches the doc comment. remote-transport.ts:stopIfIdle,stopRemoteAccessand the rebind guard are a faithful move of the oldregister.tsclosures. The flag ordering is unchanged, andwideBindInUse()replaces the inlinewideBindAgents/delegation check.- The Semgrep filesystem-safety include was extended to
mcp-runtime.tsas well.
Verification: compared patch-ids with git cherry, mapped commits by subject, ran git merge-tree against current main, and read the diff. I did not run npm ci, check or the tests locally: the code is already on main, and the PR's quality CI passed at this SHA.
Generated by Claude Code
Owner
Author
|
Closing: all 10 commits already landed on Generated by Claude Code |
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.
Task worktrees can outlive an interrupted creation before the task is saved. Record a worktree intent before provisioning, clear it after a saved state claims the path, and log remaining orphans at startup without deleting user work.
This also advances the runtime separation plan: PTY, Git, plan/steps watchers and the coordinator send UI updates through a notification function; remote transport and MCP lifecycle state move out of
register.ts; MCP server path resolution is shared. A wiring test pins handler and listener registration across the extraction. The plan records the completed work and clarifies that desktop and phone task creation request an immediate save, while a crash window remains until the save completes.Validation:
npm run check,npm run lint:dead, andnpm run lint:archpassed on the PR branch.npm testpassed: 3,751 unit tests and 1,077 client tests passed; 33 tests skipped.git diff --checkpassed.