Repository navigation
mcpx: ResolvedScope plumbing + spawn cwd = resolved scope root (#958) - #3925
Conversation
Slice 1 of decision 0004 (pkgs/mcpx/docs/decisions/0004-scope-resolved-roots.md), sections 1/2/3/6:
- internal/config: ResolvedScope{Key, Root, Degraded} + Scope.Resolve; Scope.Key is Resolve().Key, one resolution path. Root semantics per spec: worktree -> checkout top-level; repo -> parent of the common dir only when its base is .git; cwd -> canonical caller cwd; degraded repo/worktree -> that cwd; global/session/psession/pid/call -> none.
- Registry resolves via Resolve and passes ResolvedScope into Pool.Acquire/Call/ReadResource/GetPrompt/Request/Complete/Watch; the pool stores root on the Instance at creation and startLane/dial read it from there (restarts, era redials and exec-watch replacements keep the creation root, never re-resolve).
- Spawn cwd (stdio, incl. supervised): pool.SpawnCwd pure function -- config cwd, else resolved root, else unset (daemon cwd).
- Observability: server.spawn lifecycle line (server, key, root, cwd, cwdSource), key/root/cwdSource on server.start, root in mcpx status instance JSON, root carried through instance handoff.
Tests: Resolve root semantics (worktree/repo/linked worktree/cwd/degraded/rootless/Key-parity), SpawnCwd decision table, end-to-end instance root in status + child cwd via /proc. Existing pool/daemon test call sites updated to the ResolvedScope signatures.
Refs #1989: its spawn-cwd acceptance criteria 1-4 are covered by this change; its gopls live-proof criterion belongs to slice 4 (#961).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff15803fdd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed both Codex P2 findings in commit
Verified: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 822d6c8912
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
InstanceHandoff now carries the instance execStamp and execIdentity (resolved from its effective spawn cwd at creation), describe() records them under execMu, and resumeInstance restores them on the adopted instance. Without them a resumed instance read as zero-valued, so the successor exec watch treated its unchanged executable as newly changed and restarted adopted children after a daemon takeover (Codex review finding on PR #3925). Adds TestHandoffCarriesExecIdentityForRelativeCommand: a relative ./server under a scope root keeps its identity through detach, JSON round trip, adopt and attach, and keeps serving afterwards.
Closes #958 — slice 1 of decision record 0004 (
pkgs/mcpx/docs/decisions/0004-scope-resolved-roots.md), sections 1/2/3/6.What changed
internal/config—ResolvedScope{Key, Root, Degraded}+Scope.Resolve(ctx);Scope.Keyis nowResolve(ctx).Key(one resolution path). Root semantics per §1: worktree → checkout top-level; repo → parent of the common dir only when its base is.git, else none; cwd → canonical caller cwd; degraded repo/worktree → that cwd; global/session/psession/pid/call → none.Resolve(resolvedFor) and passes theResolvedScopeintoPool.Acquire/Call/ReadResource/GetPrompt/Request/Complete/Watch. The pool storesrooton theInstanceat creation;startLane/dialread it from the instance — restarts, era redials, exec-watch replacements and handoffs keep the creation root and never re-resolve.pool.SpawnCwd, a pure function: config cwd → resolved root → unset (daemon cwd), applied to both stdio and supervised transports.server.spawnlifecycle line per spawn (server, key, root, cwd, cwd source:config/scope/daemon);key/root/cwdSourcealso onserver.start;rootinmcpx statusinstance JSON.Tests
Resolveroot semantics (worktree, repo from subdir, repo from a linked worktree roots at the main worktree, cwd, degraded-to-cwd root, rootless scopes, Key↔Resolve parity) — fullinternal/configpackage passes.SpawnCwddecision table, and an end-to-end test that acquires an instance with a resolved root and verifies the root in status plus the child's actual cwd via/proc/<pid>/cwd.ResolvedScopesignatures;go vetclean for config/pool/daemon. Full suite runs in CI.Overlap
Refs #1989: its spawn-cwd acceptance criteria 1–4 are satisfied by this change; #1989 should close as covered once this lands (its gopls live-proof criterion belongs to slice 4, #961). Slices 2/3 (#959/#960) stay blocked on this slice.
Need help on this PR? Tag
@codesmith-botwith what you need.