Skip to content

Refuse a consumed or earlier-session approval presented again - #294

Open
astrogilda wants to merge 7 commits into
GenAI-Security-Project:release/0.2from
astrogilda-forks:spec/approval-lifetime
Open

astrogilda wants to merge 7 commits into
GenAI-Security-Project:release/0.2from
astrogilda-forks:spec/approval-lifetime

Conversation

@astrogilda

@astrogilda astrogilda commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

@bar-capsule, @afogel, @rocklambros, this PR adds section 9.3 to the specification with the sentence proposed on #53:

A Guardian MUST refuse a consumed one-time approval, or one bound to an earlier session, presented again in a fresh signed request.

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.

@President

Copy link
Copy Markdown
Collaborator

@astrogilda, +1.

One wording point:

After an ASK, the agent sends the approved action again with a NEW request_id (§10.3 refuses the old one).
But:

It authorizes one request: the request the ASK was raised for, identified by that request's request_id

could be read as if the repeat must reuse the same request_id.

Maybe a bit clearer:

It authorizes one request: a new request that repeats the action the original ASK was raised for and refers to that original ASK's request_id.

The PR notes that v0.1 has no request field for this reference.
I proposed one in #175 (ask_resolution.ask_request_id):
the two fit together - this PR says when an approval can't be used again, #175 how the approval reaches the Guardian.

@astrogilda

Copy link
Copy Markdown
Collaborator Author

@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 drk-ram left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@astrogilda
astrogilda force-pushed the spec/approval-lifetime branch from 3c08c3f to bcaf92b Compare November 14, 2026 22:24
@avp9-nexus

Copy link
Copy Markdown

Following up on the mention of our negative-vectors-v0.2 branch in this PR's description: its two REPLAY_CONSUMED vectors now bind to section 9.3 as proposed here, read at bcaf92b. The update is on its own branch, approval-lifetime-9.3 (commit b018a2a), so negative-vectors-v0.2 stays as published until 9.3 lands.

  • Whether a grant is consumed, which session holds it, and which request it awaits now come from the Guardian's record in state, never from the request being judged. The inputs changed, so the ids did: 346b5290 → 779f32c0 (consumed one-time approval), d36436a7 → ad8b9bab (grant bound to an earlier session), and their positive control ba435228 → fe1194a6.
  • Category 2 now holds sixteen vectors. Eight expect REPLAY_CONSUMED: the three cases of the 9.3 MUST, including the in-flight refusal (7e4a044d, with 1f854509 as its control), the grant the request names among several, and declarations by the request that the record contradicts. Four are positive controls. Four expect UNMEASURABLE: cases 9.3 does not rule on, such as a reference the record cannot resolve, where the verdict comes from the suite's own design rule 1.
  • The vectors check a decision, not an emission. As the review of 2026-11-01 asks, nothing should emit -32009 until failure-posture.ts counts it as a refusal; on integration it does not yet.
  • refers_to_request_id is the suite's name for the reference v0.1 does not carry (issue 175 proposes ask_resolution.ask_request_id), not a proposed wire field.
  • Every category 2 vector carries spec_version: "PENDING: merge of PR #294 (head bcaf92b)" and will be read again against the merged text.

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>
@astrogilda
astrogilda requested a review from e2hln as a code owner November 23, 2026 06:35
@astrogilda

Copy link
Copy Markdown
Collaborator Author

@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.

@rocklambros
rocklambros changed the base branch from integration to release/0.2 November 26, 2026 14:27
@github-actions github-actions Bot added the status:needs-triage Not yet triaged. Applied by the issue forms label Nov 26, 2026
@github-actions

Copy link
Copy Markdown

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.

@rocklambros

Copy link
Copy Markdown
Collaborator

I moved this PR's base to release/0.2, the new branch for 0.2 work. Changes to the spec, the schemas, or the conformance requirements now go there, and PR #675 records that rule as D-052. The branch starts at today's integration, so your diff is the same and you don't need to do anything right now. From now on, sync with release/0.2.

@rocklambros

Copy link
Copy Markdown
Collaborator

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:

  1. Accept the invitation. It is at https://github.com/GenAI-Security-Project/agent-control-standard/invitations and in your GitHub notifications. It expires after 7 days.
  2. I assign Refuse a consumed or earlier-session approval presented again #687 to you and post here when it's done.
  3. In the issue section of this pull request, write Closes #687 on the first line and keep Part of #33 on its own line below it.
  4. Close this pull request and reopen it, so it counts as opened after the assignment.
  5. Then I review it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Not yet triaged. Applied by the issue forms

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

5 participants