Repository navigation
Refuse a consumed or earlier-session approval presented again - #294
astrogilda wants to merge 7 commits into
Conversation
|
@astrogilda, +1. One wording point: After an ASK, the agent sends the approved action again with a NEW
could be read as if the repeat must reuse the same Maybe a bit clearer:
The PR notes that v0.1 has no request field for this reference. |
|
@President thanks, good catch: an ASK has no request_id, and 10.3 refuses the asked request's id again, so approval needs a new request. 4a6b5e0 takes your wording but says the repeat "refers to the original request's request_id", and updates 9.3's presenting paragraph and v0.1 wire test to match. Agreed on #175: ask_resolution.ask_request_id is the field 9.3 says v0.1 lacks. |
drk-ram
left a comment
There was a problem hiding this comment.
I merged 3c08c3f onto origin/integration at d09e1bd. 1b8f970 is an ancestor of that tip. The merge is clean.
python -m pytest -q gave 1156 passed, 1 skipped, 10 failed, and 49 errors. That is the integration suite, plus the same Windows environment failures as the other merges. This pull request adds no test, so nothing new ran.
I deleted section 9.3, the -32009 row, and the section 10.3 cross-reference. I then ran tests/test_spec_structure.py, and a spec, error, signature, and handshake selection. Both stayed green: 2 passed, then 33 passed and 1099 deselected. I restored the file. A later edit can drop the code and the suite will not notice.
The prose is otherwise in the right place. Approval lifetime is an approver-mechanism rule, so section 9 is the right altitude. You did not invent a wire field for a reference v0.1 does not have. You pointed at issue 175 for ask_resolution.ask_request_id. -32009 does not collide with discussion 257, which wants -32008. It also does not collide with the reference Guardian, which already mints -32010, -32011, and -32020. No other open pull request claims -32009. The lost-response paragraph does not collide with pull request 293. That one refuses a byte-identical resend. This one says a new request_id does not inherit the earlier approval.
Two holes should be closed before this lands.
The second bullet says another request that presents the grant is refused, even when it arrives before the decision returns. The MUST, and the -32009 row, cover only a consumed one-time approval or a grant bound to an earlier session. Section 17 says every mandated refusal maps to a fixed code. This refusal does not. Name REPLAY_CONSUMED there, or give it its own code, in the bullet and in the table.
Add a test that fails if REPLAY_CONSUMED, -32009, or the consumed-approval MUST disappears. It should also fail if the in-flight sentence names no code. The deletion above is the break that test has to catch.
One landing condition, not a rewrite of the section. reference-implementations/agt/packages/host-adapter/src/failure-posture.ts treats only -32700, -32010, -32011, and -32020 as refusals. Any other code stays error_without_decision and keeps the posture. The default posture is proceed. A Guardian that emits -32009 before that set includes it will fail open on the replayed approval. The comment in that file records the hole on purpose. Do not have anything emit this code until that set includes -32009.
Section 10.3 defines a replay on the request: a duplicate request_id or nonce within the session. A one-time approval already consumed, or a grant from an earlier session, presented again in a fresh signed request is neither, so no section refused it and 17.1 had no code for it. Section 9.3 defines one-time, consumed and session-bound grants and requires a Guardian to refuse such an approval with REPLAY_CONSUMED, registered as -32009 because -32008 is proposed for a retryable overload code. Section 10.3 and the ACS-Core list point at the new section. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
The section no longer touches the ACS-Core list, which is the Spec workstream's call for a later release. It says that v0.1 has no request field naming a grant, so the reuse rule is the half a wire test can observe, and that a second request presenting a one-time approval is refused even before the first decision returns. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
The request an ASK was raised for already received the ASK, and 10.3 refuses its request_id a second time, so the approval can only reach the Guardian on a new request that repeats the action. Section 9.3 now says the grant authorizes that new request, which refers to the original request's request_id, and the wire test approves an ASK, lets the approved repeat be decided, and checks that a further repeat does not inherit the approval. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
…esponse An approved action can run while its result is lost, and a retry under a new request_id then needs a fresh approval. That approval covers the retry but cannot say whether the first attempt committed. For an action that is not idempotent, the approver should wait for an out-of-band determination that it did not take effect, which v0.1 has no field for. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
…ifetime in a test The second bullet of 9.3 refused another request that presents a grant before the decision returns, but the MUST and the -32009 row covered only a consumed one-time approval or a grant bound to an earlier session. Name REPLAY_CONSUMED for the in-flight refusal in the bullet, the MUST sentence and the 17.1 row. Add tests/test_approval_lifetime_spec.py, which fails when 9.3, the code, the number, the consumed-approval MUST sentence, the in-flight sentence's code, the registry row or the 10.3 cross-reference is dropped. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
3c08c3f to
bcaf92b
Compare
|
Following up on the mention of our
runner 34/34, selftest 42/42; each category 2 mutant was checked to be caught by exactly the vectors written for it. Avp9. |
Section 9.3 defines -32009 as the refusal of a replayed approval. The host adapter treated any code outside its refusal set as an error without a decision and kept the session's failure posture, whose default is proceed, so a Guardian emitting -32009 would have failed open on exactly the replay the code exists to stop. List it in REFUSAL_RPC_CODES before any Guardian mints it, cover it in the failure-posture tests, and fail the spec test if the host set drops it. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
…uses The error-cause table had no entry for -32009, so an audit record for a replayed one-time approval fell back to the generic cause and the every-spec-code test failed. Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
|
@drk-ram thank you for the merge run and for catching the failure-posture gap. The in-flight refusal now names REPLAY_CONSUMED (-32009) in its own bullet and in the registry row (bcaf92b), and tests/test_approval_lifetime_spec.py fails if the MUST requirement, the -32009 code or the in-flight sentence is removed. 087f112 adds -32009 to the refusal set in failure-posture.ts with its tests. 25e7810 adds the guardian error cause that test_every_spec_error_code_has_its_own_cause needed. |
|
Thanks for this. It is queued rather than ignored until a lead reads it, and the lead may close it. No lead has reviewed this pull request, and it references no issue a lead assigned to you. Under Part 2 of the Code of Conduct, a pull request that changes behavior, normative text, or code starts from an issue labeled status:accepted that a lead assigned to you before you opened or reopened it. If a lead closes this one, you can reopen it once a lead assigns the work. An editorial fix needs no issue. If a check below fails, please fix it. |
|
I moved this PR's base to |
|
Hi Sankalp, I opened #687 for the part of #33 that this PR delivers. #687 is accepted, on the v0.2.0 milestone, and linked under #33. CONTRIBUTING.md (D-041) only reviews a pull request whose issue is assigned to its author. GitHub only lets us assign people who have access to the repository, so I sent you a read-access invitation today. Here is how we fix it:
|
What changed
@bar-capsule, @afogel, @rocklambros, this PR adds section 9.3 to the specification with the sentence proposed on #53:
Section 9.3 defines one-time, consumed and session-bound grants and registers REPLAY_CONSUMED in 17.1 as -32009, leaving -32008 to Discussion #257. ACS v0.1 has no request field that names a grant, so the testable half is reuse. After an ASK is approved, the Guardian decides the repeat request, and one more repeat gets no approval. @avp9-nexus, -32009 is the 17.1 code for the two REPLAY_CONSUMED vectors on your negative-vectors-v0.2 branch.
9.3 also covers the lost-response case from #53. An approved action can run while its response never reaches the agent, for example when the target's reply is lost, so the action may have taken effect although the agent never saw a result and so cannot report one. A retry is then a new request. A fresh approval for it does not settle whether the first try took effect. The approver SHOULD NOT grant a retry of a non-idempotent action until the deployment has determined, outside ACS, that the first try did not commit. v0.1 has no field for that.
Which issue does this implement
Part of #33; refs #53.
I tested this
At 3c08c3f, the head of this branch, pytest gives 923 passed and the strict mkdocs build passes.
Edited 2026-10-22: the reuse sentence and the tested commit now match 4a6b5e0 (the approval covers the repeat request).
Edited 2026-10-24: added the 3c08c3f lost-response paragraph and its test run.