fix(daemon): preserve recovered worker registry authority - #1267
Open
sethkarten wants to merge 6 commits into
Open
fix(daemon): preserve recovered worker registry authority#1267sethkarten wants to merge 6 commits into
sethkarten wants to merge 6 commits into
Conversation
7 tasks
sethkarten
marked this pull request as ready for review
August 12, 2026 00:55
…ecovered-worker-registry
…ecovered-worker-registry
sethkarten
force-pushed
the
core09-recovered-worker-registry
branch
from
August 12, 2026 18:35
e1fdde9 to
d2c4920
Compare
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
Validation
node_modules/.bin/biome check packages/coding-agent/src/modes/daemon/daemon-supervisor-ownership.ts packages/coding-agent/src/modes/daemon/daemon-supervisor.ts packages/coding-agent/test/daemon-supervisor-monitor.test.tsnode_modules/.bin/vitest --run packages/coding-agent/test/daemon-supervisor-monitor.test.ts packages/coding-agent/test/daemon-session-list.test.ts packages/coding-agent/test/saved-session-info.test.ts(104 passed)node_modules/.bin/tsgo --noEmitblocked by a pre-existing missinginvokeHostRequestexport inpackages/coding-agent/test/sdk-mcp-boundary.test.ts.Note
Preserve supervisor registry directory across recovered daemon workers
DaemonSupervisornow captures its registry directory at startup intosupervisorRegistryDirand injects it asPRIME_AGENT_INTERNAL_DAEMON_SUPERVISOR_REGISTRY_DIRinto every spawned worker's environment, overriding any caller-supplied value.getDaemonSupervisorRegistryDiris exported from daemon-supervisor-ownership.ts so the supervisor and tests can reference it directly.launchEnvis now always overridden by the supervisor's chosen directory.Macroscope summarized d2c4920.
Final reconciled validation
f9f0d7615e1cca807c4faa49413cc52a9c1f31f5tsgo --noEmit: passgit diff --check: pass; final worktree cleanNote
Medium Risk
Touches daemon supervisor ownership and worker spawn env, which are security-sensitive for multi-process coordination; scope is narrow and covered by new regression tests.
Overview
Fixes daemon recovery so recovered session workers stay on the same supervisor ownership registry as their supervisor instead of drifting to a different (or attacker-supplied) directory.
DaemonSupervisornow capturessupervisorRegistryDironce at construction viagetDaemonSupervisorRegistryDir()and threads it through startup (waitForDaemonStartupFence,acquireDaemonSupervisorOwnership). Every worker spawn setsPRIME_AGENT_INTERNAL_DAEMON_SUPERVISOR_REGISTRY_DIRafter inherited and callerlaunchEnv, so a persisted or untrusted registry path inlaunchEnvcannot override host authority.daemon-supervisor-ownershipexports the env constant and renames the internal resolver togetDaemonSupervisorRegistryDirfor reuse in tests and the supervisor.Tests record spawn
envand assert both initial and recovered launches receive the supervisor’s registry dir whilelaunchEnvdoes not retain the override.mcp-probe.tsis a formatting-only change.Reviewed by Cursor Bugbot for commit d2c4920. Bugbot is set up for automated code reviews on this repo. Configure here.