Repository navigation
Description
Phase 1 of design #1531 (filed by the design architect, 2026-10-27). Design doc: files/designs/code-mcpx-stdio-exec-identity.md in the keep-the-four-repos-healthy goal workspace.
Decision in force (from #1531, do not re-litigate in triage): for a hashed executable whose content begins with #!, the exec identity is its content plus the resolved directory of the real file; non-script hashed files stay content-only; files above limits.execHashMax stay stat/inode. This implements the first option named in pkgs/mcpx/TODO.md item 4 and the planning/roadmaps/mcpx.md row "Decide what a stdio server's identity is" (proposed).
Scope
ExecStamp.Identity()inpkgs/mcpx/internal/config/execid.go(currently lines 114–130) is the single identity implementation — callers areResolved.ExecState()(execid.go:56), pool construction (internal/pool/pool.go:199) and the exec watch (internal/pool/execwatch.go:84). Keep it single: no second implementation ininternal/poolor elsewhere.- While the hashed branch streams the file (it is already read whole), note whether its first two bytes are
#!. For a script, foldfilepath.Dir(s.Path)—s.Pathis already theEvalSymlinks-resolved real path (execid.go:94–99) — into the hash under a distinct framing (marker + separators, so no (content, directory) pair can alias another pair's hash input; exact framing is this issue's to settle). The identity string keeps thesha256:<16 hex>form. - Non-script hash input must stay byte-for-byte today's, so existing binary identities do not move on rollout. The stat branch, the
missing:form, and non-stdio servers are untouched. - The
execid.goheader comment: replace the caveat paragraph ("a program that finds its own files relative to its real location is not [identified]… A restart (mcpx restart) is what moves it") with the new rule, including the one-time identity change for script servers on rollout (recorded handoff identities mismatch → script pools restart once at upgrade/first check, the existing binary-changed path).
Acceptance
- Defining tests in
pkgs/mcpx/internal/config/execid_test.go:- identical script bytes in two different directories → different identities;
- identical script bytes at two names in one directory → same identity;
- identical non-script bytes in two different directories → same identity (today's rule preserved);
- a script and a non-script with identical bytes → different identities;
- framing non-alias: pairs whose content/directory splits differ do not trivially collide;
- large-file stat identity unchanged (existing
TestExecIdentityOfALargeFileIsItsInodekeeps passing).
TestExecIdentityFollowsTheExecutableNotTheCommandName(execid_test.go:25) pins a#!/bin/shscript's identity to its bare content hash — the design knowingly changes this one expectation to the framed script hash; update it and say so in the PR. The same-directory identical-copy tests (TestExecIdentityOfASmallFileIsItsContentNotItsPath) must pass unmodified in behaviour — if one fails, the implementation is folding in more than the directory (e.g. the full path), which the design rejects.- No changes needed in
internal/pool,internal/daemon, handoff, or lifecycle code in this phase;Identity()staying platform-independent (the unix/other split is onlyfileInode) is confirmed, or any build-tag surprise is reported on this issue. - Verification via CI per fleet policy:
cd pkgs/mcpx && go test ./internal/config/....
Out of scope: daemon-level reload/watch tests and the TODO/roadmap closure (Phase 2, gated on this phase); interpreter-as-command servers; sibling-loading native binaries (both are open questions on #1531).
Acceptance criteria
-
ExecStamp.Identity()folds the resolved directory into the hash for#!scripts only, under a framed (marker + separators) input that cannot alias another (content, directory) pair; non-script hashed input stays byte-for-byte today's. - Defining tests in
pkgs/mcpx/internal/config/execid_test.gopass: cross-directory identical script → different identity; same-directory identical script → same identity; cross-directory identical non-script → same identity; script vs non-script with identical bytes → different identities; large-file stat identity unchanged. -
TestExecIdentityFollowsTheExecutableNotTheCommandNameis updated to the framed script hash and the PR says so explicitly; the same-directory identical-copy tests pass unmodified in behaviour. - The
execid.goheader caveat is replaced with the new rule, including the one-time identity change / single restart for script servers on rollout. - No changes in
internal/pool,internal/daemon, handoff, or lifecycle code; CI green on the PR (fleet CI-first policy).
Activity
developing-today commentedon Oct 28, 2026
CODE-588
dezren39 commentedon Oct 28, 2026
🤖 Agent note · filed
files/designs/code-mcpx-stdio-exec-identity.md(goal workspace); queue task 1574 (repo-health-code-pilot)dezren39 commentedon Oct 28, 2026
Intake review
Fleet-monitor intake pass (2026-10-28): verified still live — the design #1531 was filed today and this Phase 1 sub-issue is queued (queue/queued); no merged PR implements directory folding in
ExecStamp.Identity()yet.pkgs/mcpx/TODO.mditem 4 and theplanning/roadmaps/mcpx.mdidentity row.## Acceptance criteriachecklist has been appended to the issue body in that form (original body preserved verbatim above it). Labels were already normalized by the filer (kind/feature, priority/normal, effort/m, app/mcpx, source/design-architect).TestExecIdentityFollowsTheExecutableNotTheCommandName) changes by design; the PR must say so.internal/config, no pool/daemon changes in this phase; verify via CI per fleet policy.dezren39 commentedon Oct 28, 2026
🤖 Agent note · picked up
ExecStamp.Identity(), settle the hash framing, route the implementation follow-up. No implementation in this task.files/designs/code-mcpx-stdio-exec-identity.md30 remaining items
dezren39 commentedon Oct 28, 2026
🤖 Agent note · state: picked-up
Merge pull request #1571 from developing-today/queue/1634-1532-exec-dir
dezren39 commentedon Oct 28, 2026
🤖 Agent note · state: done
996111fd04c9fc9c5201aeb9cfba9f51367dad6f; all 17 checks passed (test, spec parity, treefmt, MCP matrix, compare-with-the-records). Issue mcpx: Phase 1 of #1531 — exec identity core: a script's identity folds in its resolved directory (internal/config) #1532 is closed. Phase 1 of design(mcpx): what a stdio server's identity is — a script's identity includes its directory #1531 has landed, which lifts the gate on Phase 2 (mcpx: Phase 2 of #1531 — daemon proof: cross-directory re-point restarts on reload and the exec watch; TODO/roadmap closure #1533, task 1575): its next resume can enqueue the Phase 2 implementation packet and complete that triage.test(mcpx): prove cross-directory script re-point restarts on reload …