Skip to content

Add a parity guard for the four ACP shim tool definitions - #1936

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1560-shim-parity
Aug 3, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1560-shim-parity

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

The four per-agent ACP shims in packages/skill/shims/ (claude-code/nodespace-hook.ts, codex/nodespace-plugin.ts, gemini/nodespace-tools.json, opencode/nodespace-plugin.ts) hand-author the same five tool definitions. The duplication is deliberate — each shim is copied into an agent session's temp directory as a standalone script with no shared runtime module resolution, so they can't import one source — but nothing verified they stay in agreement. This adds the automated guard (acceptance criteria).

packages/skill/src/tests/shim-parity.test.ts (vitest, runs in the standard packages/skill suite) extracts each shim's tool names + descriptions and asserts they all match the gemini manifest (the machine-readable reference):

  • gemini — parsed as the reference {name: description}.
  • codex / opencode — each tool's name + its own description (the description: immediately following name:; parameter descriptions sit later in the schema and are excluded).
  • claude-code — registers by name via hook('name', …) and carries no per-tool description, so only its tool names are comparable.

A rename in any shim, or a description edit in codex/opencode/gemini without the others, now fails the suite. All four agree today.

Note on the issue's technical spec

The issue references a SHIM_TOOLS registry + a shim_tools_match_gemini_manifest Rust test from #1509. That's stale — #1509 actually landed as "derive the ACP tool list from the Tool enum," and no such registry/test exists on main. This implements the issue's real intent (a cross-shim parity guard) against the current code: a TS test in the TS package that owns the shims, rather than a Rust-side check.

Verification

4 tests pass; I confirmed the guard catches drift by temporarily perturbing a codex description (the codex assertion failed) and reverting (back to green). The extraction fails safe — a missed tool leaves the map short of the reference's five, so drift can only make the test fail, never falsely pass. Full pre-push gate green.

Closes #1560

Co-Authored-By: Claude [email protected]

The four per-agent shims in packages/skill/shims/ hand-author the same five tool
definitions and are deliberately un-shareable (each is copied standalone into an
agent session temp dir with no runtime module resolution), so nothing prevented
them from drifting out of agreement. Add a vitest guard that extracts each shim's
tool names + descriptions and asserts they all match the gemini manifest (the
machine-readable reference): codex and opencode on name + description, and
claude-code — which registers by name via hook() and carries no per-tool
description — on names. A rename or description edit in any one shim without the
others now fails the standard test suite. All four agree today.

Co-Authored-By: Claude <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE

Single-pass review (test-only, no product logic). The guard is sound and fails safe:

  • gemini parsed as the reference; codex/opencode compared on name and description (adjacency correctly excludes parameter descriptions); claude-code on names only (it registers via hook('name') with no descriptions).
  • Fail direction is safe — a missed/renamed tool leaves the extracted map short of the reference's five, so drift can only fail the test, never falsely pass.
  • Verified empirically: perturbing a codex description failed the codex assertion; reverting returned to green.
  • Correctly recognizes the issue's SHIM_TOOLS/Rust-test premise is stale (Derive the ACP tool list from the Tool enum to stop three-way drift #1509 landed as Tool-enum-derived) and implements the real intent in the TS package that owns the shims.

Runs in the standard packages/skill vitest suite; full pre-push gate green. Merging.

@mstomar125
mstomar125 merged commit a4dc04c into main Aug 3, 2026
2 checks passed
@mstomar125
mstomar125 deleted the issue-1560-shim-parity branch August 3, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify tool name/description parity across all four ACP shim files

1 participant