Skip to content

task/JWB-947 - #92

Merged
JarenKempton merged 5 commits into
mainfrom
task/JWB-947
Nov 12, 2026
Merged

JarenKempton merged 5 commits into
mainfrom
task/JWB-947

Conversation

@JarenKempton

@JarenKempton JarenKempton commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Interlock lane interlock-lane:f648da53-4ac6-4087-9690-f2578ecc58ee

Before / after evidence

Each probe pipes raw JSON-RPC lines into bun <root>/src/main.ts mcp from a detached worktree at the given commit: 5ef0168 (main before this PR), f8450d1 (round-3 head), 858f3e1 (merged). Each probe uses an isolated XDG_STATE_HOME.

Handshake, returned refusal, interlock/auth: ./probe.sh <root>

#!/usr/bin/env bash
root=$1
printf '%s\n' \
  '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"1999-01-01","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"lane_review","arguments":{"lane":"interlock-lane:00000000-0000-4000-8000-000000000000"}}}' \
  '{"jsonrpc":"2.0","id":2,"method":"interlock/auth","params":{"token":"x"}}' \
  | XDG_STATE_HOME=$PWD/xdg-$(basename $root) timeout 20 bun $root/src/main.ts mcp \
  | jq -c 'if .id==0 then {id, protocolVersion: .result.protocolVersion} elif .result then {id, isError: .result.isError, text: .result.content[0].text} else {id, error} end'
== 5ef0168
{"id":0,"protocolVersion":"1999-01-01"}
{"id":1,"isError":false,"text":"{\n  \"ok\": false,\n  \"refusal\": {\n    \"code\": \"lane_not_found\",\n    \"message\": \"Lane not found: interlock-lane:00000000-0000-4000-8000-000000000000\"\n  }\n}"}
{"id":2,"error":{"code":-32001,"message":"Authentication failed"}}
== 858f3e1
{"id":2,"error":{"code":-32601,"message":"Method not found"}}
{"id":0,"protocolVersion":"2025-11-25"}
{"id":1,"isError":true,"text":"{\n  \"ok\": false,\n  \"refusal\": {\n    \"code\": \"lane_not_found\",\n    \"message\": \"Lane not found: interlock-lane:00000000-0000-4000-8000-000000000000\"\n  }\n}"}
  • Before, the caller's 1999-01-01 was echoed back as the protocol version. After, the SDK negotiates 2025-11-25.
  • Before, a returned lane_not_found refusal had isError:false. After, it has isError:true.
  • Before, interlock/auth answered Authentication failed. After, it answers Method not found because the method is deleted.

Thrown refusal (pickup with reviewer_model set and no reviewers): ./pickup.sh <root>

#!/usr/bin/env bash
root=$1; S=$(dirname $0)
printf '%s\n' \
  '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"pickup\",\"arguments\":{\"key\":\"JWB-1\",\"repo\":\"$S/repo\"}}}" \
  | XDG_STATE_HOME=$S/xdgp-$(basename $root) timeout 30 bun $root/src/main.ts mcp \
  | jq -c 'select(.id==1) | {id, isError: .result.isError, text: .result.content[0].text}'
== 5ef0168
{"id":1,"isError":true,"text":"Tool call failed"}
== 858f3e1
{"id":1,"isError":true,"text":"{\n  \"ok\": false,\n  \"refusal\": {\n    \"code\": \"reviewers_unset\",\n    \"message\": \"reviewer_model is set but reviewers is empty, so no review would run; set reviewers with interlock config edit --set reviewers LENSES or clear each with --follow KEY\"\n  }\n}"}

Unsupported protocol version no longer echoes the caller's value (round-3 finding): ./version.sh <root>

#!/usr/bin/env bash
root=$1
printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"caller-supplied-9999","io.modelcontextprotocol/clientInfo":{"name":"probe","version":"0"},"io.modelcontextprotocol/clientCapabilities":{}}}}' \
  | timeout 20 bun $root/src/main.ts mcp | jq -c '{id, error}'
== f8450d1
{"id":1,"error":{"code":-32022,"message":"Unsupported protocol version: caller-supplied-9999","data":{"supported":["2026-07-28"],"requested":"caller-supplied-9999"}}}
== 858f3e1
{"id":1,"error":{"code":-32022,"message":"Unsupported protocol version","data":{"supported":["2026-07-28"]}}}

Round-4 test results (head 3d5affa)

  • The new test an unsupported protocol version is refused without echoing the requested version in test/mcp/server.test.ts fails with src/mcp/stdio.ts from f8450d1 and passes on 3d5affa:
    • bun test test/mcp/server.test.ts -t "unsupported protocol" on f8450d1 stdio gave 0 pass, 1 fail.
    • bun test test/mcp/server.test.ts on 3d5affa gave 16 pass, 0 fail.
  • vp check: all 192 files formatted. No warnings, lint errors or type errors in 173 files.
  • vp run typecheck: clean.
  • vp run test: 689 pass, 24 skip, 0 fail, 713 tests across 50 files. The skips are environment-gated suites already on main.
  • CI on 3d5affa: all 8 checks green (https://github.com/JarenKempton/interlock/actions/runs/43307694949).
  • Round-4 correctness review (Sonnet 5.5, high effort): approved, no findings.

🤖 Generated with Claude Code

JarenKempton and others added 5 commits November 10, 2026 16:48
interlock mcp now serves stdio through @modelcontextprotocol/server's
serveStdio, so protocol negotiation, framing and errors come from the SDK.
Tools are still registered from the action tree with each action's zod
input schema.

The unix-socket transport, the interlock/auth method, and the --lane,
--transport and --socket options are removed; --allow remains as a tool
filter.

A refusal now reaches the client as a tool error carrying its code and
message: thrown coded errors and {ok:false, refusal} results both return
{"ok":false,"refusal":{code,message}} with isError true. Uncoded failures
still return "Tool call failed".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nput

- Only snake_case codes count as refusals. Errno and SQLite errors such
  as EACCES return "Tool call failed" instead of echoing paths.
- Tools advertise each action's zod JSON schema, but the action parses the
  raw arguments once. The SDK's "Unrecognized key" text can no longer
  echo caller keys, and transforms run once.
- stdin EOF waits for every received request to be answered before the
  transport closes, so piped or in-flight calls are not dropped.
- --allow that names no actions fails closed instead of exposing every
  tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn tool names

- subscriptions/listen is a long-lived stream that the SDK answers only
  at teardown. Stop counting it as pending, so stdin EOF no longer waits
  on it forever.
- On stdin error, or close without end, drop pending requests and end the
  wire, instead of throwing an uncaught error and hanging.
- Rewrite the SDK's "Tool <name> not found" error to "Unknown tool", so
  the caller's tool name is not echoed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JarenKempton
JarenKempton merged commit 858f3e1 into main Nov 12, 2026
8 checks passed
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.

1 participant