Repository navigation
Conversation
createToolCatalog hashed z.toJSONSchema(contract.inputSchema) directly, while a client is handed the schema that toolInputSchemaWithMetadata projects, which attaches advertisedInputExamples. The digest therefore omitted examples, so editing a tool's examples changed the catalog the client received without changing the tool or combined digests, and comparing the two reported aligned. Project the advertised schema instead, the same value the server registers, so an examples-only edit moves the digest like any other client-visible change. The output schema is left as it is: its advertised $id is derived from the schema that is already digested, so it cannot change without changing the digest anyway.
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: be1428292b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| toolInputSchemaWithMetadata(contract)["~standard"].jsonSchema.input({ | ||
| target: "draft-2020-12", | ||
| }); |
There was a problem hiding this comment.
Hash the schema after applying the active presentation profile
When REA_MCP_INPUT_SCHEMA_PROFILE=compact is active, this is not the schema the client receives: EvidenceMcpServer.registerTool applies compactAdvertisedInputSchema afterward (src/server/EvidenceMcpServer.ts:104-115), and that transform explicitly drops root examples (src/contracts/compactInputSchema.ts:74-92). Consequently, an examples-only edit now changes tools_sha256 and combined_sha256 even though the compact tools/list is byte-identical, so catalog comparisons can report a false catalog_digest_mismatch; compute the digest from the active post-profile projection (or keep a deliberately profile-neutral projection) instead.
AGENTS.md reference: AGENTS.md:L31-L31
Useful? React with 👍 / 👎.
| it("still changes when returns_target_content changes", () => { | ||
| // Control: an unrelated contract field the digest already covered must keep | ||
| // affecting it, so the examples fix above cannot regress silently. | ||
| const contract = findContract((c) => !c.returnsTargetContent); |
There was a problem hiding this comment.
Remove the duplicated target-content digest test
This case duplicates tests/boundary/mcp/serverIdentity.test.ts:121-140, which already toggles returnsTargetContent and asserts that both the tool and combined digests change (and that the prompt digest does not). It therefore adds no distinct semantic coverage but leaves the same invariant in two test layers; remove this control case rather than maintaining redundant tests.
AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.
|
|
TL;DR: The fix works on Node 22, 24 and 26. When I edited one tool's example, the digest moved and a stale server was caught. Before the fix, it still said aligned. The digest is a fingerprint of the tool list a client is handed. "Before" means this head with the old Unit test
On before, the failing case is the examples case. Live serverI started the built
On both trees, the tool list changed. Only head's digest followed it. Also checked
Not run
Thanks, hemv-857, for this fix. Test setup
CommandsEach run used npm ci
npm run build
node scripts/run-development-tests.mjs focused src/catalogIdentity.test.ts
node scripts/run-development-tests.mjs focused tests/boundary/mcp/serverIdentity.test.tsThe live-server probe is a small script. It starts Exact valuesThe combined digest is 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
Use one named input-schema projection for clients and catalog identity, preserve dialect declarations, and bound compact schema depth. Keep canonical SDK output validation when output advertisements are disabled. Release request-owned state on cancellation and carry upstream limitations through composed workflows. Preserve doctor full-output envelopes and validate navigation facts at their owner. Reviewed fixes: #2088, #2108, #2513, #2684, #2693, #2695, #2836, #2864, #2868, #2877, #2933, #2998, #3002, #3015. Validation: focused schema, SDK output-validation, context, and workflow tests passed; no schema dialect or canonical output validation was relaxed.
|
The advertised-schema digest fix and its input-example regression are already on main in 80de314. Thank you @hemv-857 for the contribution. The later ee9bf58 commit separately materializes server identity as plain JSON; it did not introduce example coverage. Current validation: tests/boundary/mcp/serverIdentity.test.ts passed all 8 tests in the focused phase-four run, including the advertised-input-example change, unchanged prompt digest control, real MCP identity, and target availability. The PR adds no remaining behavior beyond that owning schema and regression. Complete current-main CI remains in progress. |
|
Correction to my earlier supersession note: I missed the unresolved review thread #discussion_r4264002008. Main still hashes This is a valid, currently unfixed identity inconsistency based on the producer → compact presentation → identity comparison path. I am reopening the PR to investigate and correct that profile-aware digest behavior. The second review thread is a duplicate-test maintenance suggestion, not a behavior blocker. Sorry for my earlier blanket supersession conclusion; thank you for the review finding. |
Capture the current entrypoint once without inventing a path. Preserve unknown registration ownership through setup and doctor, refuse unsafe registration plans, and retain exact pinned-launcher readiness checks. Hash the same full or compact schema projection advertised by each MCP server and use that identity in doctor comparisons. BREAKING CHANGE: server.command_path may be null when the invocation path is unavailable. Registration and setup statuses, and doctor classifications, may report unknown. Reviewed-PR: #3230, #3015 Co-authored-by: qorvr <[email protected]> Co-authored-by: Hemang Varshney <[email protected]>
|
Superseded by |
Fixes #2578
The bug
createToolCataloghashedz.toJSONSchema(contract.inputSchema)directly, but a client is handed the schema thattoolInputSchemaWithMetadataprojects — and that projection attachesadvertisedInputExamples. The digest therefore covered a schema withoutexampleswhile the catalog served to the client had them.Editing a tool's examples changed what the model was shown and left both the tool and combined digests byte-identical, so
createServerIdentityreportedalignedagainst the original catalog.docs/mcp-contracts.mdstates the identity covers fields that change what clients receive; examples are exactly that.The fix
Hash the advertised projection, the same value
toolRegistrationOptionshands the SDK, instead of a parallel re-derivation of it:where
advertisedInputJsonSchemaprojectstoolInputSchemaWithMetadata(contract)at the samedraft-2020-12targetz.toJSONSchemadefaulted to.This removes a second implementation of "what the input schema looks like on the wire" rather than adding a third: the digest and the registration now read from one source, so they cannot drift again.
The output schema is deliberately left as it is.
toolOutputSchemaWithMetadataadds an$idthat is itself a digest of that schema, so an output change already moves the digest through the schema it is derived from — there is no equivalent blind spot to close.Testing
src/catalogIdentity.test.ts(new), three cases:returns_target_contentstill changes both digests, so the fix above cannot regress what was already covered. Passes on both.The tool with examples is discovered at runtime rather than named, so a renamed or removed tool cannot silently turn the first case into a no-op.
Verification run locally:
npm run test:run -- src/catalogIdentity.test.ts— 3 passednpm run typecheck— cleannpm run verify:module-boundaries,npm run verify:test-discovery— cleannpx oxlinton both changed files — cleanNothing asserts a hardcoded digest;
tests/boundary/mcp/serverIdentity.test.tsreadsCATALOG_IDENTITY.digestsat runtime, so it picks up the new value rather than breaking on it.One note on the pre-push hook
npm run lintcurrently reports 2 errors onmain—max-lines-per-functionontests/boundary/filesystem/artifactComparison.test.ts:346(202 lines) andsrc/dotnet/ManagedCilDecoding.test.ts:248(162 lines), both against a 150-line maximum. Both were introduced by9630c8fand neither is touched here. PerCONTRIBUTING.md's guidance to keep cosmetic-only work out of useful fixes, I left them alone and pushed past the local hook, but the gate is currently red for everyone. Happy to open a separate issue if that is useful.