GeezerVison is showing github.com — mcpx: ResolvedScope plumbing + spawn cwd = resolved scope root (#958) by dezren39 · Pull Request #3925 · developing-today/code
Conversation
dezren39
commented
Nov 1, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.Key is now Resolve(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.
- Plumbing (§2) — the registry resolves via
Resolve (resolvedFor) and passes the ResolvedScope into Pool.Acquire/Call/ReadResource/GetPrompt/Request/Complete/Watch. The pool stores root on the Instance at creation; startLane/dial read it from the instance — restarts, era redials, exec-watch replacements and handoffs keep the creation root and never re-resolve.
- Spawn cwd (§3) —
pool.SpawnCwd, a pure function: config cwd → resolved root → unset (daemon cwd), applied to both stdio and supervised transports.
- Observability (§6) — one
server.spawn lifecycle line per spawn (server, key, root, cwd, cwd source: config/scope/daemon); key/root/cwdSource also on server.start; root in mcpx status instance JSON.
Tests
- New:
Resolve root 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) — full internal/config package passes.
- New:
SpawnCwd decision 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.
- Existing pool/daemon test call sites updated to the
ResolvedScope signatures; go vet clean 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.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
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).
coderabbitai
Bot
commented
Nov 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You'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.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
737ea50e-a0f4-4458-9944-028b5dfa45f7
Commits
-
Reviewing files that changed from the base of the PR and between a423735 and bdb04b5.
Files selected for processing: 30
-
pkgs/mcpx/internal/config/execid.go
pkgs/mcpx/internal/config/execid_test.go
pkgs/mcpx/internal/config/scope.go
pkgs/mcpx/internal/config/scope_resolve_test.go
pkgs/mcpx/internal/daemon/consumer.go
pkgs/mcpx/internal/daemon/consumer_scope_test.go
pkgs/mcpx/internal/daemon/exec_watch_test.go
pkgs/mcpx/internal/daemon/input_required.go
pkgs/mcpx/internal/daemon/ops.go
pkgs/mcpx/internal/daemon/registry.go
pkgs/mcpx/internal/daemon/registry_handoff_test.go
pkgs/mcpx/internal/daemon/reload_test.go
pkgs/mcpx/internal/daemon/routes_proto.go
pkgs/mcpx/internal/daemon/takeover_test.go
pkgs/mcpx/internal/pool/detach_test.go
pkgs/mcpx/internal/pool/era_test.go
pkgs/mcpx/internal/pool/execwatch.go
pkgs/mcpx/internal/pool/execwatch_test.go
pkgs/mcpx/internal/pool/follow_test.go
pkgs/mcpx/internal/pool/handoff.go
pkgs/mcpx/internal/pool/handoff_exec_test.go
pkgs/mcpx/internal/pool/pool.go
pkgs/mcpx/internal/pool/pool_test.go
pkgs/mcpx/internal/pool/request.go
pkgs/mcpx/internal/pool/self_connection_test.go
pkgs/mcpx/internal/pool/shutdown_drain_test.go
pkgs/mcpx/internal/pool/spawn_cwd_test.go
pkgs/mcpx/internal/pool/upstream_session_test.go
pkgs/mcpx/internal/pool/watch.go
pkgs/mcpx/internal/pool/watch_test.go
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-02T02:54:55.040451Z |
bdb04b5 |
New commits |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Addressed both Codex P2 findings in commit 84619fd80 (on top of current origin/main via merge commit 822d6c891):
- Disambiguation now carries the selected instance's root into
Acquire, so a new protocol lane or restart keeps the selected workspace root.
- Scope-rooted relative executables are resolved and watched per instance using the effective spawn cwd; only the affected instance is replaced.
Verified: go test -count=1 ./internal/config ./internal/pool ./internal/daemon and git diff --check pass. Please re-review this head. @codex review
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
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.
|