Repository navigation
Fail closed by default and separate refusals from decision failures (§6.4) - #603
bar-capsule wants to merge 14 commits into
Conversation
|
This pull request's description says it closes #32, which is on the project roadmap. When it merges, GitHub closes that issue and the roadmap counts it as delivered. Please confirm the change delivers the whole issue before merging. |
drk-ram
left a comment
There was a problem hiding this comment.
Reviewed specification.md, conformance.md, conformance-claim-template.md, response-envelope.json, handshake.json, ask-details.json, otel-mapping.json, ocsf-mapping.json, and tests/test_decision_failure_rules.py (1e448894):
- Fail-closed default and one-way
on_decision_failuretightening (§4.1,§6.4,handshake.json): Defaulting both the startup posture (refuse) and the step failure posture (deny), while allowing a Guardian'son_decision_failureto tightenproceed->denybut never loosendeny->proceed, enforcesD-036andD-045across the prose and schemas. - Refusal vs. decision-failure boundary (
§6.4,response-envelope.json): Explicitly separating decision failures (silence past timeout, connection/TLS failure, HTTP408/5xxwithout a JSON-RPC body, or a signed-32603) from refusals and integrity failures (HTTP4xxincluding429, unsigned errors, signed errors other than-32603, bad signatures, unknownkey_id, or mismatchedid/request_id) closes the fail-open downgrade vectors from#32(D-040,D-046).
|
@bar-capsule, your follow-ups list the AGT reference implementation: It touches the same files as #615, my fix for the log side of #568. That fix records a deny the Claude Code shim cannot carry out as |
|
Confirmed for the bot: #32 asks for the split between refusals and decision failures to be normative so conformance tests can assert it. §6.4 now states it, and @MK023 yes please, it's yours. Two things for the order:
|
drk-ram
left a comment
There was a problem hiding this comment.
Re-reviewed at 950b521d after the rebase onto integration: all §4.1 and §6.4 fail-closed default and refusal-vs-decision-failure rules, schema updates (handshake.json, response-envelope.json, ask-details.json, otel-mapping.json, ocsf-mapping.json), and tests/test_decision_failure_rules.py remain clean and green.
|
Hey @bar-capsule, nice work on this one, and thanks for picking up the timeout point from #435 🙂 A few things I noticed from the host side:
|
950b521 to
36c5cab
Compare
|
@almogbhl thanks for the review!
|
afogel
left a comment
There was a problem hiding this comment.
submitting in stages, the update while I still had pending comments seems like it broke something
|
@afogel on the version folders: agreed it needs settling before 0.2, since every minor is now a spec change. It changes every schema |
drk-ram
left a comment
There was a problem hiding this comment.
Re-reviewed at 5191a34 after the rebase onto integration. The refreshed embedded schemas in reference-implementations/agt-go/internal/schema/specification/v0.1.0/, the Section 6.4 host-hook guidance (onFailure: block and failClosed: true), and the late-decision settlement rule at the timeout all read cleanly and match tests/test_decision_failure_rules.py.
…eout The top note lists both pending changes, D-039's ServerHello signature and D-047, as a list. The FAQ diagram and the adapters README stop saying the spec still names proceed. The AGT row and the topics page say the 0.1.5 shims follow a declared proceed, which §6.4 no longer allows. §9 and D-054 say a pending ASK through an outage resolves as DENY when its timeout_seconds elapse, recorded like a decision failure. The guard test also scans the adapters docs and catches the two stale phrases. Signed-off-by: Bar Kaduri <bar@capsule.security>
|
Thanks @rocklambros, all four are fixed in 968013e:
The test now scans the adapters docs too and catches both phrases. 3f2f354 also names the schema-failure refusal in D-040, from the question on #249. On the ASK outage: the ASK's pytest: 1327 passed, 1 skipped. mkdocs --strict is clean. |
rocklambros
left a comment
There was a problem hiding this comment.
Bar, thank you. All four blockers from my last review are fixed at 968013e, and the ASK outage text in §9 and D-054 now agrees. The stale-wording test catches what it claims: I put the old phrases back in a scratch copy, and it failed on each one.
Commit reviewed: 968013e
Two blockers are left. Both are text, and both are lines that this pull request makes false.
Blocker 1. The "In release 0.1.5" note in §6.4 leaves out two adapter deviations.
This pull request adds two sentences that say the shipped code follows §6.4. docs/spec/instrument/README.md:38 says "Most of the code above already follows it." docs/topics/reference-implementations.md:90 says "The shipped code follows it, except where the table says otherwise." The note at docs/spec/instrument/specification.md:242-248 lists only the HTTP 429 gap for the adapters. The adapters differ in two more places:
adapters/src/acs/core/_errors.py:38-45:GUARDIAN_REFUSAL_CODESholds only-32000,-32004,-32005,-32006,-32600and-32700. Every other signed error, such as-32007(CHAIN_MISMATCH),-32003,-32601and-32602, follows the posture. §6.4 now refuses any signed error except-32603.adapters/docs/signing.md:99: on the HMAC path, an HTTP 200 body that is not a JSON-RPC 2.0 answer "is no decision, so the fail posture applies". D-040 at this head refuses "a response that failsresponse-envelope.json".
Fix: add both as bullets to the note at specification.md:242, for example: "The adapters refuse only the six registry codes in acs.core.GUARDIAN_REFUSAL_CODES. Any other signed error follows the posture." and "On the HMAC path, the adapters treat an HTTP 200 body that is not a JSON-RPC 2.0 answer as a decision failure, so it follows the posture."
Blocker 2. docs/identity/overview.md:124 still says §6.4 is fail-open.
The row says: "The published text of §6.4 still defaults to fail-open with audit, which is in tension with this row's default-deny goal." After this pull request, §6.4 says deny. Fix: change the row to say §6.4 makes deny the default, with links to D-036 and D-045. Add docs/identity/ to the pages list in tests/test_decision_failure_rules.py, and add "fail-open with audit" to its stale phrases.
A question for @bar-capsule and @afogel (not a blocker). §6.4 used to say a §17.1 recovery happens "within the remaining budget" of the step's timeout. specification.md:228 now says "A §17.1 recovery is a new request with a new request_id, judged on its own." That removes the time bound and any limit on retries. Is the bound gone on purpose? Also, the sentence after it does not say what happens to a step that was refused when its recovery request times out. My reading is that it stays blocked. If that is the rule, can the text say so?
Follow-ups. They are not blockers:
docs/decisions/index.md:141rewrites the body of D-040, which is dated 2026-11-04. The log says to reverse or extend a decision with a new entry. A new D-number for the 4xx and schema-failure rules keeps the history.docs/spec/trace/events.md:55and thedecision_failure_eventdescription inspecification/v0.1.0/trace/otel-mapping.json:177still say "MUST record every decision failure". §6.4 now says every decision failure and every refusal.docs/topics/faq.md:212says every Guardian error is a refusal except a signed internal error. It leaves out HTTP408and5xxwith no JSON-RPC body, which follow the posture.specification.md:183says "Errors are signed already (§17.1)", but this pull request adds that rule. D-039's status line still says "spec change pending" for both halves.
Checks run: uv run pytest on release/0.2 merged with this pull request (1327 passed, 1 skipped), uv run mkdocs build --strict (clean), git merge-tree against release/0.2 (clean), and tests/test_decision_failure_rules.py with three stale phrases put back in a scratch copy (2 failed, as expected). Not checked: the rendered site in a browser. The merge still waits on the decision about where the 0.2 schemas go.
…ord rule Signed-off-by: Bar Kaduri <bar@capsule.security>
|
Thanks @rocklambros, both blockers and the four follow-ups are fixed in 5dccb42:
Follow-ups:
On the recovery: dropping the bound wasn't intended. §6.4 now says a recovery runs within the time left of the step's negotiated timeout, and a verified decision in that time settles the step. Otherwise a refused step stays blocked and a failed step follows the posture. The late-answer rule says the same: when the timeout elapses, a refused step settles as blocked. @afogel neither part is new: the bound is the v0.1.0 text, and the rest spells out "a refused step stays blocked". pytest: 1327 passed, 1 skipped. mkdocs --strict is clean. Each new test assertion fails when its old text is put back. |
rocklambros
left a comment
There was a problem hiding this comment.
Bar, thank you. Both blockers from my last review are fixed at 5dccb42, and so are the four follow-ups. The recovery bound is back, and it agrees with the late-answer rule and §17.1. I checked every adapter bullet in the 0.1.5 note against the v0.1.5 tag, and each one is true.
Commit reviewed: 5dccb42
Two small blockers are left.
Blocker 1. The Go host adapter also fails open when the ServerHello leaves out the posture.
docs/spec/instrument/specification.md:248 says the Go host adapter "takes the posture the ServerHello declares, so it follows a Guardian's proceed". At v0.1.5 it also proceeds when the field is absent:
reference-implementations/agt-go/internal/hostadapter/client.go:458-459sets an emptyon_decision_failuretoFailureProceed.reference-implementations/agt-go/internal/observedagent/observedagent.go:364-376:Honourallows on every posture exceptdeny.handshake.jsondoes not requireon_decision_failurein a ServerHello, and §6.4 says an absent field leaves the agent's own setting,deny, in force.
Fix: in the note at specification.md:248 and in the Go rows of docs/spec/instrument/README.md:36 and docs/topics/reference-implementations.md:97, say "takes the posture the ServerHello declares and has no setting of its own, so it follows a Guardian's proceed and also proceeds when the ServerHello leaves the field out."
Blocker 2. Two posture rules in specification/v0.1.0/trace/otel-mapping.json now contradict the new sentence "A refusal is always fail_closed". The text is in the decision_failure_event description.
- The next sentence says a Guardian that emits the event "sets fail_closed in that case and unknown otherwise", where "that case" is a declared
deny. For a refusal the Guardian returned without declaringdeny, one rule saysfail_closedand the other saysunknown. Fix: add "except for a refusal it returned, which is fail_closed". - "A handshake_failure comes before on_decision_failure is negotiated, so its posture reflects the startup posture: fail_open for proceed". §6.4 now says a refused
handshake/helloends the session, so a refused handshake under startupproceedwould be recorded asfail_openfor a session that never ran. Fix: limit that rule to a handshake with no usable answer, and say a refused handshake recordsfail_closed. Thehandshake_failuretext above it ("Under the startup posture proceed the session ran with no step governed") needs the same limit.
Change both copies of otel-mapping.json the same way, as you did in this round.
A question for @bar-capsule and @afogel (not a blocker). §6.4 now lists 408 and 5xx with no JSON-RPC body as decision failures, and "any other HTTP 4xx" as a refusal. Two cases fit neither list: a 1xx or 3xx with no JSON-RPC body (for example, a proxy that answers with a redirect), and a 5xx that carries a JSON-RPC body. Which outcome should each one get?
Follow-ups. They are not blockers:
specification.md:250says the Go Guardian declaresdenyby default. Only the shippedguardian.yaml:45does. The library default inreference-implementations/agt-go/guardian/config.go:153-155isproceed.- At a hook that has no DENY, the Go host adapter turns a refusal into ALLOW (
internal/hostadapter/client.go:179-186). The note could say so. docs/topics/faq.md:134: the build list names only timeouts and transport failures as decision failures. Add the signed-32603and the408or5xxwith no body, or link to §6.4.docs/topics/faq.md:213is one paragraph of about eleven sentences. STYLE.md asks for two to four.
Checks run: uv run pytest on release/0.2 merged with this pull request (1327 passed, 1 skipped), uv run mkdocs build --strict (clean), git merge-tree against release/0.2 (clean), tests/test_decision_failure_rules.py with "fail-open with audit" put back in docs/identity/overview.md (1 failed, as expected), both otel-mapping.json copies (they parse and are identical), and the 0.1.5 note read against the v0.1.5 tag. Not checked: the rendered site in a browser. The merge still waits on the decision about where the 0.2 schemas go.
|
@bar-capsule @afogel, on Rock's question about the uncovered cases, a suggestion in case it helps:
This makes the lists exhaustive, keeps D-040's rule for a |
…ound Signed-off-by: Bar Kaduri <bar@capsule.security>
|
Thanks @rocklambros, both blockers and the four follow-ups are fixed in e00f96d, and thanks @simin-yuan for the status proposal.
On the statuses: we keep the #32 rule that a 4xx refuses whatever its body, which is what #616 does, so the 0.1.5 bullet stays. §6.4 now settles every status: anything other than 2xx, 408 and 5xx refuses, 3xx included, and the agent never follows a redirect. Under 408 or 5xx, a body that parses as a JSON-RPC 2.0 response is judged as under 2xx, and any other body, such as a 502 HTML page, counts as no JSON-RPC body. A 1xx is interim. That's D-056, and it settles the 502 overlap Simin found. Before asking for another look, I swept the PR for the same kinds of problems:
@afogel D-056 and D-057 are new. pytest: 1328 passed, 1 skipped. mkdocs --strict is clean. Each new test assertion fails when its text is undone. |
rocklambros
left a comment
There was a problem hiding this comment.
Approved. Bar, thank you for the sweep. Both blockers from my last review are fixed: the Go host adapter's missing-field case is in the note and both Go rows, and the trace mapping now says a refusal is fail_closed for a Guardian and for a refused handshake. D-056 settles every HTTP status, and it agrees with §6.4, §4.1, §9, D-040, conformance.md and the claim template.
Commit reviewed: e00f96d
Checks run:
uv run pytestonrelease/0.2merged with this pull request: 1328 passed, 1 skipped.uv run mkdocs build --strict: clean.git merge-treeagainstrelease/0.2: clean.- Both copies of
otel-mapping.jsonand ofsession-end.json: they parse and are identical. - The 0.1.5 note, read against tag v0.1.5 for the adapters, the gateway, the Go host adapter and the Guardian defaults: true.
- The widened stale-wording test with a stale phrase put back in five of the newly scanned files: each one fails, as expected.
Not checked: the rendered site in a browser, and the claim in docs/topics/reference-implementations.md:100 that the AGT shims let a 429 follow the posture.
Two questions for @bar-capsule and @afogel. They are not blockers, but each one may need a rule.
- A timeout followed by
CHAIN_MISMATCH. The late-answer rule tells the agent to discard a late answer, including thechain_hashit carries, but the Guardian has already added that step to its chain. The agent's next request then carries an oldchain_hash, and §17.1 now makes-32007a refusal under every posture. Its recovery, "Re-fetch session state", has no method on the wire. Can one timeout block every later step of the session? If so, should the text name a way to resync, or keep-32007out of the refusals that cannot recover? - A retry after a decision failure. §6.4:230 now says "A step that got a decision failure MAY be retried the same way", as a new request. A
5xxfrom a proxy or a signed-32603can arrive after the Guardian has already recorded the step. The retry is then judged a second time. For example, the Go Guardian answers DENYmcp_call_pendingfor a wrapped MCP call that it still holds open. Should the retry be allowed only when the Guardian did not process the first request, or should a Guardian treat the retry of the same step as the same step?
I added 9 follow-ups from this review to #722, your follow-up issue for this pull request. The merge still waits on the decision about where the 0.2 schemas go.
|
Two things before merge.
Also: are afogel's suggestions on §6.4 (around lines 148, 202–218, 501, 512), conformance.md line 37, and faq.md line 111 applied? Any still open should be resolved or answered. And please define "failure posture in force" in conformance-claim-template.md line 105. |
|
@bar-capsule this one is dirty against release/0.2. The only conflicting file is docs/topics/reference-implementations.md, in two hunks:
Please also confirm D-056 is on release/0.2, since both sides of the second hunk cite it. |
|
also, I don't think D-056 is on release/0.2 yet. Please confirm this PR adds the D-056 entry to docs/decisions/index.md, so the link resolves when it merges. |
|
@bar-capsule a few things before this can merge.
|
|
Cross-reference from the AISVS 1.01 mapping work (#715). That PR maps ACS 0.1.5 against OWASP AISVS and cites §6.4, the hook rules, and the trace names this PR changes. I'll realign it once this lands on release/0.2. @bar-capsule two questions for the mapping:
|
Resolve docs/topics/reference-implementations.md: keep the §6.4 wording and add the Codex adapter from GenAI-Security-Project#162 to the adapter row and the refusal paragraph, since it shares the client's posture and refusal handling. Signed-off-by: Bar Kaduri <bar@capsule.security>
|
@DanPazlev thanks. Answering your four comments together, at 363891b:
|
rocklambros
left a comment
There was a problem hiding this comment.
Approving 363891b again, because the push dismissed my approval of e00f96d.
What changed since e00f96d: one merge of release/0.2. I compared it with an automatic merge of e00f96d and the same release/0.2 commit. The only difference is the conflict you resolved in docs/topics/reference-implementations.md. Codex is now in the adapter row, and your default_deny and ACS_STARTUP_POSTURE wording is kept. No conflict markers remain.
What I ran on 363891b merged into the current release/0.2:
uv run pytest: 1328 passed, 1 skipped.uv run mkdocs build --strict: passes.git merge-treeagainstrelease/0.2: clean.
D-056 is in docs/decisions/index.md in this PR, so its links resolve when it merges.
On Dan's point 2: the bullet "The adapters and the gateway judge an answer that carries a JSON-RPC body by that body under any HTTP status" sits inside the "In release 0.1.5" note in §6.4. That note describes what the shipped code does today, so it does not contradict D-056. I agree with Dan's point 4: Refs #32 fits better than Fixes #32 while the follow-ups are open.
What I did not check: anything outside the merge, since I reviewed e00f96d already. My two questions on e00f96d (CHAIN_MISMATCH after a timeout, and retry idempotency) are still open for you and Ariel. The merge still waits on the schema location decision.
|
Thanks @DanPazlev for flagging the overlap. To keep one owner on the page: #715 is mine (assigned on #637), and I'll make any realignment myself once @rocklambros decides the base and this PR lands. @bar-capsule, if the late-decision names or the hook anchors change, a note here or on #715 is all I need. |
release/0.2 now holds D-054 (FinBot lab), D-055 (CycloneDX 2.0) and D-056 (spec tags), so the four decisions this PR adds move to the next free numbers, with every reference. Signed-off-by: Bar Kaduri <bar@capsule.security>
Bring in release 0.1.6 from the sync. Keep this PR's wording where it rewrote the same text, with the 0.1.6 facts on top: release numbers and anchors move to 0.1.6, Codex joins the Instrument README's adapter row, and the TypeScript shims' 0.1.6 behavior goes in the §6.4 note, the README and the reference implementations page (they block a bad signature and any 4xx but 408). The Go differences page takes the 0.1.6 TypeScript columns and this PR's rationale column. Signed-off-by: Bar Kaduri <bar@capsule.security>
|
@afogel @rocklambros I merged |

What changed
The failure posture is now
denyby default, and only the Observed Agent's own deployment configuration can opt intoproceed. A Guardian'son_decision_failurecan make it stricter, never looser. A step ends one of three ways (§6.4):408or5xxwith no JSON-RPC body, or a signed-32603.4xx(429included), an unsigned error, a signed error other than-32603, a bad signature or unknownkey_id, a mismatchedidorrequest_id, or a response that failsresponse-envelope.json, anallowincluded.Every decision failure and refusal is recorded with its class and its cause (the error code, the HTTP status, or the timeout), and a blocked step SHOULD tell the user and the agent why, in text the Observed Agent composes rather than copies from the response, as Ariel asked on the 12 November leads call.
Also:
refuse, and a failed handshake is recorded under either posture.proceedthe action runs even when aDENYarrives late but before the action starts, and the Guardian's late decision event joins the record byrequest_id. The negotiated timeout SHOULD be shorter than the host's own hook timeout."onFailure": "block"in Claude Code,"failClosed": truein Cursor), since otherwise the host lets the action run.DENY, soask-details.jsondropstimeout_disposition: allow. A Guardian outage while an ASK is pending leaves the step blocked whatever the posture, since the Guardian has already answered.error.signature(except aSIGNATURE_INVALIDfor an unresolvablekey_id);datagets a schema for the fields the recovery column reads; the chain-mismatch deny usesreason_codes.handshake.json:on_decision_failureloses itsproceeddefault, since an absent field now leaves the agent's own posture in force.acs.failure.postureis the posture the Observed Agent applied, and a refusal is alwaysfail_closed. A Guardian knows the posture only when it declareddeny, since the agent's opt-in isn't on the wire, so it reportsfail_closedor the new valueunknown. The OCSF late-decision types follow:late_decision_fail_closedorlate_decision_posture_unknown(which replaceslate_decision_fail_open), and an unknown posture alerts like fail-open did. The ASKis_alertrationale no longer cites a timeout toallow.conformance.md(decision honoring and the liveness rationale), the claim template and the FAQ say the same.The decision-failure rule stays in §6.4 rather than moving to a new section, because 145 places across the docs, schemas, tests and both reference implementations cite §6.4 for it. §6.3, §6.5 and §17.1 are now stated as instances of it, which covers items 5 and 6 of #535.
Merge timing: this is a spec change, so under the versioning agreed on the 12 November leads call it belongs to 0.2. Please don't merge it before 0.1.5 is cut. I'll retarget it to the 0.2 branch once that exists.
Which issue does this implement
Fixes #32
Refs #308
Refs #535
Refs #435
meaning, so it needs no issue
Base branch
integration, because this touches the specification, schemas, a referenceimplementation, an adapter, tests, or CI
main, because every changed path is on the documentation lane allowlist inCONTRIBUTING.md
Type of change
Specification changes
Breaking for implementers? Yes. An implementation that defaults to
proceed, lets a Guardian'sproceedloosen its posture, proceeds on an error, a429or an expired ASK, or emitslate_decision_fail_openstops conforming.Follow-ups outside this PR:
host-adapter/src/failure-posture.ts(DEFAULT_POSTURE = "proceed"),guardian/src/handshake.ts(shipsproceed),host-adapter/src/decision-expiry.ts(timeout_disposition: allow), and the Guardian's Trace exporter andaudit-to-otlp.ts, which report its own declaredproceedasfail_openinstead ofunknown. fix(agt): treat an HTTP 4xx from the Guardian endpoint as a refusal #544 covers the HTTP4xxpart, and needs429moved to the refusals.internal/hostadapter/client.gostill takes the posture from the ServerHello, so a Guardian'sproceedcan loosen it. @almogbhl tracks it under Language ports.adapters/: Block every refusal §6.4 names in the adapters #616 treats every signed error except-32603, and every HTTP4xxexcept408, as a refusal.summary.refusalscounter, if wanted (raised by @simin-yuan on [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32).I tested this
uv run pytest -vpasses on my machineuv run mkdocs build --strictpasses on my machinetests/test_decision_failure_rules.pypins each rule, and a sweep fails if any page or schema still callsproceeda default or lets an ASK time out toallow. Breaking any of 24 rules on purpose fails it. The AGTtrace-pillartest that pins the posture values is updated to match, and runs in CI.Checklist
git commit -s(required by the DCO)Security
It closes the bypass where a denial of service against the Guardian let actions through: the default is now fail-closed, a Guardian can't relax it, and a refusal, a tampered response or a
429blocks the step whatever the posture.