refactor(client): move the status contract to the harness plane - #953
Closed
chughtapan wants to merge 2 commits into
Closed
refactor(client): move the status contract to the harness plane#953chughtapan wants to merge 2 commits into
chughtapan wants to merge 2 commits into
Conversation
statusCommandRpc was simultaneously the Unix-socket RPC and the schema source for two surviving consumers: the MCP status tool and the harness client's identity read. That made the plane which outlives the socket depend on the plane which does not. The harness plane now states the status contract itself and exposes it as JSON Schemas, derived types, and a strict decoder. The socket surface states the same shape independently, because a schema constructor cannot cross the boundary; drift is still a compile error either way, since each side implements a handler against its own schema. Dropping the RPC handler context also removes the Rpc.isWrapper unwrap and its accompanying cast from the status tool registration. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P76aaa1STr3WPZ3nDascta
Owner
Author
|
Superseded by #974, which collapses this stack into one PR against |
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.
Plan step 6. Stacked on #951. Mechanical, and the single dependency edge that would otherwise make the CLI/socket deletion break the MCP
statustool.Problem
local-daemon-rpc.ts → statusCommandRpcwas simultaneously the Unix-socket RPC and the schema source for two consumers that survive the socket's deletion:harness-mcp-wire.ts → registerStatusTool(input/output schemas)harness-client.ts → readActiveAgentId(result decoder)So the plane that outlives the socket depended on the plane that does not. Deleting
local-daemon-rpc.tslater would have broken the MCP status tool and the client identity read.Change
The harness plane now states the status contract itself in
harness/runtime.ts, alongside the reply and start-conversation contracts it already owned, and exposes it the same way those are exposed — JSON Schemas, derived types, and a strict decoder. No new export style.The socket surface states the same shape independently rather than importing it. That is not an oversight:
agent-code-guard/no-exported-brand-constructorrejects exporting a schema constructor, so the constructor genuinely cannot cross the boundary. Drift is still a compile error in both directions, becauseservice-local-daemon.tsandmoltzapd.tseach implement a handler against its own side — I verified this by injecting a field into each schema in turn and confirming each produced a type error.I drafted a
*.types-check.tsdrift canary for the duplication and then deleted it: the probe showed it never fires on its own, since the two handlers already catch every case. Shipping it would have been a vacuous gate.Dropping the RPC handler context (
(payload, context)→(payload)) also let the status tool registration lose itsRpc.isWrapperunwrap and the cast justified by "HandlersFrom widens that known-empty environment toany". Net: one fewer cast.statusCommandRpcis now module-private, matchingsendCommandRpcin the same file — knip flagging it as an unused export was the confirmation the coupling was gone.Gate
returns nothing — the harness plane no longer reaches into the socket plane. This also required decoupling
harness-mcp-server.test.ts, which was building an entire socket handler table viamakeLocalDaemonHandlersjust to extract its.statusfield.pnpm typecheck --skip-nx-cache— greenpnpm lint— 0 warnings, 0 errors (incl. knip, arch:check, arch:config:check)pnpm nx run @moltzap/client:test— 233 passed / 32 filesNo behavior change: the same shape is advertised and decoded, only its owner moved.
ADR conformance (R-pass)
statuson the local MCP surface20260728-endpoint-daemon-speaks-modern-mcpCONFORMSv2/*per the step-0 sweep (52 records classified, posted on #926). Tool name and shape unchanged regardless.20260801-harness-client-owns-runtime-contextCONFORMSstatusstays a management tool; it is not added toHarnessClientService.readActiveAgentIdremains private.agents-md-single-source,v2-lives-top-level,code-first-simulator-kernel,effect-native-evaluation-results,principal-io-uses-runtime-gateways— none touches this diff.No new divergence introduced; no ledger row changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01P76aaa1STr3WPZ3nDascta