Repository navigation
fix(acp): classify reverse requests before responses - #1540
Conversation
This comment has been minimized.
This comment has been minimized.
|
Addressed both round-one findings in
Added 3 regression tests, with no tests removed or replaced:
Validation:
|
|
Note LGTM ✅ - Both round-1 findings are fully addressed in What This PR DoesPrevents an agent-to-client JSON-RPC request from being misread as a response to an outbound OpenAB request when their IDs collide, which previously consumed the wrong pending-response slot. This is the protocol-correctness portion extracted from #1533; no elicitation or presentation behavior is included. How It Works
Round-1 Findings Resolution
✅ Addressed in
✅ Addressed in Findings
Baseline Check
What's Good (🟢)
5. Three Reasons We Might Not Need This PR
|
…variant
- Log at warn level when an agent-to-client request other than
session/request_permission is answered with -32601. OpenAB advertises
clientCapabilities: {} so such a request means the agent is calling a
capability we never offered; previously only the debug frame dump showed it.
- Document on JsonRpcId that untagged deserialization routes every
non-negative integer to Unsigned, Signed only holds negatives, and derived
equality is structural (Unsigned(5) != Signed(5)); correlate via as_u64().
Semantic transplant of upstream OpenAB 3718ef0 (openabdev#1540). Preserve fork-specific WritePolicyGuard and READ_ONLY permission enforcement. Classify reverse requests before pending response correlation; preserve JSON-RPC string, signed and unsigned IDs. Reject malformed ID-bearing responses while allowing explicit result:null. Preserve stale-response isolation and adapter prompt correlation. Validation: 1466 library tests and 6 terminal-finalization tests passed; rustfmt clean.
Summary
methodand ID before outbound response correlation.-32601for unsupported reverse request methods without removing a same-ID pending OpenAB request.u64request IDs.This extracts the protocol correctness fix requested in #1533. It does not include elicitation or presentation functionality.
Validation
cargo check --workspace— passed.cargo clippy --workspace -- -D warnings— passed.cargo test --workspace -- --skip secrets::tests::resolve_exec_nonzero_exit— passed.cargo test --workspace— one failure in the unchangedsecrets::tests::resolve_exec_nonzero_exit; the same test fails on a cleanupstream/maincheckout in this environment.cargo fmt --all -- --check— reports existing formatting differences; the same command fails on a cleanupstream/maincheckout.git diff --check— passed.Discord discussion: https://discord.com/channels/1491295327620169908/1491365158868619404/1549133818089316454
Review Contract
Goal
Prevent an agent-to-client JSON-RPC request from being mistaken for an OpenAB request response and consuming the wrong pending response when their IDs collide.
Non-goals
Accepted Residual Risks
Unsupported agent-to-client methods receive JSON-RPC
-32601until OpenAB implements them. This is explicit protocol behavior and does not affect pending outbound requests.Acceptance Criteria
methodand ID is classified as an agent-to-client request before response correlation.session/request_permissionrequests continue to receive their current automatic response.-32601with the original numeric, negative, or string ID.Follow-ups
Elicitation support and its presentation design remain separate work from #1533 and require the live-wire evidence requested there.