Skip to content

Fail closed by default and separate refusals from decision failures (§6.4) - #603

Open
bar-capsule wants to merge 14 commits into
GenAI-Security-Project:release/0.2from
bar-capsule:bar/spec-32-fail-closed
Open

bar-capsule wants to merge 14 commits into
GenAI-Security-Project:release/0.2from
bar-capsule:bar/spec-32-fail-closed

Conversation

@bar-capsule

@bar-capsule bar-capsule commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

The failure posture is now deny by default, and only the Observed Agent's own deployment configuration can opt into proceed. A Guardian's on_decision_failure can make it stricter, never looser. A step ends one of three ways (§6.4):

  • A verified decision is honored.
  • A decision failure follows the posture: silence past the timeout, a failed connection or TLS handshake, an HTTP 408 or 5xx with no JSON-RPC body, or a signed -32603.
  • A refusal or an integrity failure blocks the step whatever the posture: any other HTTP 4xx (429 included), an unsigned error, a signed error other than -32603, a bad signature or unknown key_id, a mismatched id or request_id, or a response that fails response-envelope.json, an allow included.

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:

  • §4.1: the startup posture defaults to refuse, and a failed handshake is recorded under either posture.
  • §6.4: a decision that arrives after the timeout changes nothing. The step keeps the outcome the timeout settled, so under proceed the action runs even when a DENY arrives late but before the action starts, and the Guardian's late decision event joins the record by request_id. The negotiated timeout SHOULD be shorter than the host's own hook timeout.
  • §6.4: a deployment SHOULD set every hook that gates an action to block when the hook itself fails, where the host offers it ("onFailure": "block" in Claude Code, "failClosed": true in Cursor), since otherwise the host lets the action run.
  • §6 DEFER note and §9: an ASK that times out resolves as DENY, so ask-details.json drops timeout_disposition: allow. A Guardian outage while an ASK is pending leaves the step blocked whatever the posture, since the Guardian has already answered.
  • §17 and §17.1: every registry error is a refusal; the error object is signed in error.signature (except a SIGNATURE_INVALID for an unresolvable key_id); data gets a schema for the fields the recovery column reads; the chain-mismatch deny uses reason_codes.
  • handshake.json: on_decision_failure loses its proceed default, since an absent field now leaves the agent's own posture in force.
  • Trace: acs.failure.posture is the posture the Observed Agent applied, and a refusal is always fail_closed. A Guardian knows the posture only when it declared deny, since the agent's opt-in isn't on the wire, so it reports fail_closed or the new value unknown. The OCSF late-decision types follow: late_decision_fail_closed or late_decision_posture_unknown (which replaces late_decision_fail_open), and an unknown posture alerts like fail-open did. The ASK is_alert rationale no longer cites a timeout to allow.
  • 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

  • This is an editorial correction (typo, grammar, link, formatting) with no change in
    meaning, so it needs no issue

Base branch

  • integration, because this touches the specification, schemas, a reference
    implementation, an adapter, tests, or CI
  • main, because every changed path is on the documentation lane allowlist in
    CONTRIBUTING.md

Type of change

  • Specification change (schema, hooks, events, AgBOM)
  • Reference implementation or adapter
  • Documentation
  • Tooling or CI
  • Governance (licensing, security policy, contributor docs)

Specification changes

Breaking for implementers? Yes. An implementation that defaults to proceed, lets a Guardian's proceed loosen its posture, proceeds on an error, a 429 or an expired ASK, or emits late_decision_fail_open stops conforming.

Follow-ups outside this PR:

I tested this

  • I synced my branch with the base branch before opening this
  • uv run pytest -v passes on my machine
  • uv run mkdocs build --strict passes on my machine

tests/test_decision_failure_rules.py pins each rule, and a sweep fails if any page or schema still calls proceed a default or lets an ASK time out to allow. Breaking any of 24 rules on purpose fails it. The AGT trace-pillar test that pins the posture values is updated to match, and runs in CI.

Checklist

  • Commits are signed off with git commit -s (required by the DCO)
  • Prose follows STYLE.md
  • No secrets, tokens, or internal URLs in the diff

Security

  • This change has no security impact

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 429 blocks the step whatever the posture.

@github-actions

Copy link
Copy Markdown

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

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_failure tightening (§4.1, §6.4, handshake.json): Defaulting both the startup posture (refuse) and the step failure posture (deny), while allowing a Guardian's on_decision_failure to tighten proceed -> deny but never loosen deny -> proceed, enforces D-036 and D-045 across the prose and schemas.
  • Refusal vs. decision-failure boundary (§6.4, response-envelope.json): Explicitly separating decision failures (silence past timeout, connection/TLS failure, HTTP 408/5xx without a JSON-RPC body, or a signed -32603) from refusals and integrity failures (HTTP 4xx including 429, unsigned errors, signed errors other than -32603, bad signatures, unknown key_id, or mismatched id/request_id) closes the fail-open downgrade vectors from #32 (D-040, D-046).

@MK023

MK023 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@bar-capsule, your follow-ups list the AGT reference implementation: DEFAULT_POSTURE in failure-posture.ts, handshake.ts, decision-expiry.ts and audit-to-otlp.ts. Once this PR is approved, I'd like to take that part, unless someone already has it.

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 unenforced. With deny as the default, that covers every Read of an image, a PDF or a notebook, so the two changes are easier to land one after the other.

@bar-capsule

Copy link
Copy Markdown
Collaborator Author

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 tests/test_decision_failure_rules.py pins each rule. The implementations follow separately: #616 for adapters/, and the AGT reference implementation.

@MK023 yes please, it's yours. Two things for the order:

  1. fix(agt): treat an HTTP 4xx from the Guardian endpoint as a refusal #544 already changes failure-posture.ts for the HTTP 4xx part and still needs 429 moved to the refusals, so building on it once it lands avoids a conflict.
  2. Like this PR, it belongs to 0.2, so it merges after 0.1.5 is cut. Landing Record a deny the Claude Code shim cannot carry out as unenforced, not blocked #615 first, as you suggest, works.

@MK023

MK023 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thanks, Bar, I'll take it. I'll build it on #544 once that lands, so the 429 move sits on top of its 4xx change, and I'll keep it for after 0.1.5 is cut. #615 goes first.

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

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.

@almogbhl

Copy link
Copy Markdown
Collaborator

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:

  1. The red agt-go jobs are just the Go port's embedded copy of the schemas being out of date, since this PR touches five of them. go generate ./internal/schema should turn them green.
  2. Follow-ups: I think agt-go is missing from the list. Its host adapter still takes the posture from the ServerHello (internal/hostadapter/client.go), so a Guardian's proceed can loosen it, which §6.4 now rules out. The Codex and OpenCode examples run on it, so I'm happy to track that under Language ports.
  3. One gap worth a sentence: deny by default covers what the hook decides, but not a hook that breaks (missing script, crash, timeout, bad output). Then the host decides, and Claude Code and Cursor let the tool through by default. An agent that can edit the project could even break the hook on purpose. What do you think about a SHOULD in §6.4 that a host-launched hook is set to block when it fails (onFailure: "block" in Claude Code, failClosed: true in Cursor)? fix(agt): make Claude Code PreToolUse hook fail closed #462 already does it for the Claude Code shim.

@bar-capsule
bar-capsule force-pushed the bar/spec-32-fail-closed branch from 950b521 to 36c5cab Compare November 19, 2026 09:46
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

@almogbhl thanks for the review!

  1. Done: rebased onto integration and refreshed the Go port's embedded schemas, the same copy go generate ./internal/schema makes.
  2. Agreed, I've added agt-go's host adapter to the follow-ups. Please track it under Language ports.
  3. Agreed, and it's in now: §6.4 says a deployment SHOULD set each gating hook to block when it fails, with onFailure: "block" and failClosed: true as examples. The Python adapters' wire tools already write both, and fix(agt): make Claude Code PreToolUse hook fail closed #462 does it for the Claude Code shim.

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

submitting in stages, the update while I still had pending comments seems like it broke something

Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved

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

a few more comments to add here. Additionally, I notice that the directory structure hardcodes versions; we probably want to remove nesting structure, or reserve it only for major version changes.

Screenshot 2026-11-19 at 8 32 07 AM

Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/instrument/specification.md Resolved
Comment thread docs/spec/trace/events.md Resolved
Comment thread docs/spec/conformance-claim-template.md Resolved
Comment thread docs/spec/conformance-claim-template.md Resolved
Comment thread docs/spec/conformance.md Resolved
Comment thread docs/topics/faq.md Resolved
Comment thread docs/topics/faq.md Resolved
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

@afogel on the version folders: agreed it needs settling before 0.2, since every minor is now a spec change. It changes every schema $id, though, so I'd take it to a Discussion rather than this PR.

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

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>
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

Thanks @rocklambros, all four are fixed in 968013e:

  1. The top note now lists both pending changes, D-039's ServerHello signature and D-047, as bullets.
  2. The FAQ diagram reads "deny (the default, §6.4)".
  3. The adapters README sentence is gone.
  4. The AGT row now says the 0.1.5 shims follow the declared proceed and fail open unless ACS_ON_DECISION_FAILURE=deny, and the topics page says they don't follow §6.4 yet.

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 timeout_seconds still apply, so the step resolves as DENY when they elapse, and the agent records it with its cause, like a decision failure. §9 and D-054 now say so. @afogel that's part of D-054.

pytest: 1327 passed, 1 skipped. mkdocs --strict is clean.

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

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:

  1. adapters/src/acs/core/_errors.py:38-45: GUARDIAN_REFUSAL_CODES holds only -32000, -32004, -32005, -32006, -32600 and -32700. Every other signed error, such as -32007 (CHAIN_MISMATCH), -32003, -32601 and -32602, follows the posture. §6.4 now refuses any signed error except -32603.
  2. 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 fails response-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:

  1. docs/decisions/index.md:141 rewrites 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.
  2. docs/spec/trace/events.md:55 and the decision_failure_event description in specification/v0.1.0/trace/otel-mapping.json:177 still say "MUST record every decision failure". §6.4 now says every decision failure and every refusal.
  3. docs/topics/faq.md:212 says every Guardian error is a refusal except a signed internal error. It leaves out HTTP 408 and 5xx with no JSON-RPC body, which follow the posture.
  4. specification.md:183 says "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>
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

Thanks @rocklambros, both blockers and the four follow-ups are fixed in 5dccb42:

  1. The 0.1.5 note in §6.4: it now lists every gap I found against the v0.1.5 tag. The adapters send four refusals through the posture: an HTTP 4xx with no JSON-RPC body other than 400, 408 and 413, a signed error outside GUARDIAN_REFUSAL_CODES, a body that isn't a JSON-RPC 2.0 answer, and a signed allow that fails response-envelope.json. They also carry out a signed decision under any HTTP status, 4xx included. The Go host adapter behind the Codex and OpenCode hooks takes its posture from the ServerHello and treats any non-200 status as a decision failure. The README and the topics page point to that note, and their Go rows say it too. Block every refusal §6.4 names in the adapters #616 closes the adapter gaps.
  2. The identity row: it says §6.4 makes deny the default, and the test now scans docs/identity/ and catches "fail-open with audit".

Follow-ups:

  1. D-040: the corrected text is what we decided on [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32 on 4 Nov (comment), so nothing new was decided on the 29th, and a new number would give the rule the wrong date. D-040 now says it was corrected to match its source, and what the first version said.
  2. The record rule: events.md, both otel-mapping.json copies and the FAQ say every decision failure and every refusal.
  3. The FAQ: it names HTTP 408 and 5xx with no body as failures.
  4. D-039: the top note no longer says errors were signed already, and D-039's status says signed errors are in 0.2.0 and the ServerHello signature is pending.

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

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:

  1. reference-implementations/agt-go/internal/hostadapter/client.go:458-459 sets an empty on_decision_failure to FailureProceed.
  2. reference-implementations/agt-go/internal/observedagent/observedagent.go:364-376: Honour allows on every posture except deny.
  3. handshake.json does not require on_decision_failure in 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.

  1. 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 declaring deny, one rule says fail_closed and the other says unknown. Fix: add "except for a refusal it returned, which is fail_closed".
  2. "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/hello ends the session, so a refused handshake under startup proceed would be recorded as fail_open for a session that never ran. Fix: limit that rule to a handshake with no usable answer, and say a refused handshake records fail_closed. The handshake_failure text 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:

  1. specification.md:250 says the Go Guardian declares deny by default. Only the shipped guardian.yaml:45 does. The library default in reference-implementations/agt-go/guardian/config.go:153-155 is proceed.
  2. 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.
  3. docs/topics/faq.md:134: the build list names only timeouts and transport failures as decision failures. Add the signed -32603 and the 408 or 5xx with no body, or link to §6.4.
  4. docs/topics/faq.md:213 is 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.

@simin-yuan

Copy link
Copy Markdown
Collaborator

@bar-capsule @afogel, on Rock's question about the uncovered cases, a suggestion in case it helps:

  • A response whose body parses as a JSON-RPC 2.0 response object (jsonrpc, an id, and exactly one of result or error) is judged by that body whatever the HTTP status: a verified decision is carried out, a signed error other than -32603 is a refusal and -32603 is a decision failure, and a body that does not verify is an integrity failure that blocks the step.
  • Otherwise the status decides: a 2xx with no JSON-RPC body fails response-envelope.json, so it is refused; any other 4xx except 408 is a refusal; 408, 5xx and 3xx are decision failures, and the client MUST NOT follow a redirect; a 1xx is interim, so the timeout settles the step.

This makes the lists exhaustive, keeps D-040's rule for a 2xx, and settles an existing overlap: a 502 with an HTML error page currently fits both "fails response-envelope.json" and "5xx with no JSON-RPC body". The adapters already judge a JSON-RPC body under any status, so the matching 0.1.5 note bullet could go. Happy to put up a patch if that's useful.

…ound

Signed-off-by: Bar Kaduri <bar@capsule.security>
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

Thanks @rocklambros, both blockers and the four follow-ups are fixed in e00f96d, and thanks @simin-yuan for the status proposal.

  1. The Go host adapter: the note and both Go rows say it has no setting of its own and also proceeds when the ServerHello leaves the field out.
  2. otel-mapping.json, both copies: a Guardian sets fail_closed for a refusal it returned, and a refused handshake is fail_closed. events.md had the same handshake wording and now matches.

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:

  1. The 0.1.5 note: it no longer claims to be complete. It names the main differences and points to Block every refusal §6.4 names in the adapters #616 and Follow-ups from the PR #603 review: refusal classes, the posture rule, and the reference implementations #722, and the other code gaps are now on Follow-ups from the PR #603 review: refusal classes, the posture rule, and the reference implementations #722.
  2. Stale restatements: fixed in the FAQ diagram, the gateway docs, the Cursor mapping, the agt-go docs, hooks.md and session-end.json (the count includes refusals), conformance.md and the claim template. The stale-wording test now scans the READMEs and the reference-implementation docs too.
  3. Cases the new rules left open, recorded as D-057: a step at a hook that takes no DENY, or a method outside methods_evaluated, is recorded and its effect stands. A blocked sessionStart or agbom/snapshot ends the session. A -32600 to a batch is the fallback, not a refusal. A step that got a decision failure may be retried within its timeout.
  4. Text fixes for the same gaps: the handshake has its own timeout again, a decision with no signature refuses, a signed -32603 is a failure only when it passes the refusal checks, and an ASK kept blocked through an outage records fail_closed.
  5. Older gaps the rules expose: these are in Spec gaps the §6.4 refusal rule exposes #731, for after this PR.

@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
rocklambros previously approved these changes Nov 30, 2026

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

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:

  1. uv run pytest on release/0.2 merged with this pull request: 1328 passed, 1 skipped.
  2. uv run mkdocs build --strict: clean.
  3. git merge-tree against release/0.2: clean.
  4. Both copies of otel-mapping.json and of session-end.json: they parse and are identical.
  5. 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.
  6. 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.

  1. A timeout followed by CHAIN_MISMATCH. The late-answer rule tells the agent to discard a late answer, including the chain_hash it carries, but the Guardian has already added that step to its chain. The agent's next request then carries an old chain_hash, and §17.1 now makes -32007 a 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 -32007 out of the refusals that cannot recover?
  2. 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 5xx from a proxy or a signed -32603 can arrive after the Guardian has already recorded the step. The retry is then judged a second time. For example, the Go Guardian answers DENY mcp_call_pending for 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.

@DanPazlev

Copy link
Copy Markdown
Collaborator

Two things before merge.

  1. The body says "Fixes [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32," and the roadmap bot has flagged that merging would close [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32 and count it as delivered. The AGT TypeScript, Go port and adapter follow-ups are still open, so "Refs [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32" fits better, with [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32 closed when they land.
  2. §6.4 calls any other HTTP 4xx a refusal, but Block every refusal §6.4 names in the adapters #616 also refuses redirects and other non-2xx statuses. Name them here, or state the general rule, so the spec and the adapter match.

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.

@DanPazlev

Copy link
Copy Markdown
Collaborator

@bar-capsule this one is dirty against release/0.2. The only conflicting file is docs/topics/reference-implementations.md, in two hunks:

  1. The adapter table row. release/0.2 added Codex to the list. Keep Codex in the row and keep your default_deny and ACS_STARTUP_POSTURE wording.
  2. The refusal paragraph. Keep your version, and add Codex to the adapter list so it reads "the Claude Code, Codex, Cursor and NAT adapters and the AGT shims let some refusals, that 429 among them, follow the posture."

Please also confirm D-056 is on release/0.2, since both sides of the second hunk cite it.

@DanPazlev

Copy link
Copy Markdown
Collaborator

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.

@DanPazlev

Copy link
Copy Markdown
Collaborator

@bar-capsule a few things before this can merge.

  1. Conflict: it's dirty against release/0.2. The only conflicting file is docs/topics/reference-implementations.md, in two hunks. Keep Codex in the adapter row and keep your default_deny and ACS_STARTUP_POSTURE wording. In the refusal paragraph, keep your version and add Codex to the adapter list.

  2. Contradiction in §6.4. The bullet that begins "The adapters and the gateway judge an answer that carries a JSON-RPC body by that body under any HTTP status, so they carry out a signed decision that arrives under an HTTP 3xx or 4xx" conflicts with D-056 and with the refusal list. Under D-056, a signed answer under a 3xx or 4xx is a refusal. Please delete that bullet. Block every refusal §6.4 names in the adapters #616 is the PR that makes the adapters match the rule.

  3. Interim text in normative §6.4. The paragraph beginning "The adapters treat four of the refusals above as decision failures…" describes the 0.1.5 gap. It will go stale when Block every refusal §6.4 names in the adapters #616 merges. Please move it to release notes or Block every refusal §6.4 names in the adapters #616.

  4. Fixes [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32 in the body. Merging would close [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32, and the roadmap bot has flagged that. The AGT TypeScript, Go port and adapter follow-ups are still open, so "Refs [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32" fits better.

  5. Afogel's open suggestions on §6.4 (around lines 148, 202–218, 501, 512), conformance.md line 37, and faq.md line 111. Please apply them or answer them.

  6. "Failure posture in force" in conformance-claim-template.md line 105 needs a definition.

  7. D-056 is added by this PR. Please confirm the entry lands with it, since the decision links point at it.

@DanPazlev

Copy link
Copy Markdown
Collaborator

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:

  1. Are late_decision_fail_closed and late_decision_posture_unknown the final names? If so, I'll switch to them and drop late_decision_fail_open.
  2. Will the hook anchors for the new "set gating hooks to block on failure" SHOULD stay put? I want the mapping's line links to hold.

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>
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

@DanPazlev thanks. Answering your four comments together, at 363891b:

  1. The conflict: resolved by merging release/0.2. Codex joins the adapter row and the refusal paragraph in docs/topics/reference-implementations.md, with this PR's wording kept. The Codex adapter uses the same client as the other adapters, so the same posture and refusal handling applies to it.
  2. HTTP statuses: e00f96d already covers every status (D-056). Any status other than 2xx, 408 and 5xx is a refusal whatever its body, 3xx included, and the Observed Agent MUST NOT follow a redirect. That matches Block every refusal §6.4 names in the adapters #616.
  3. The bullet on JSON-RPC bodies under any status: it sits in the note headed "In release 0.1.5", which the specification uses to say what the shipped code does (see the note at the top of the page). It describes a gap in that release, not a rule, and Block every refusal §6.4 names in the adapters #616 closes it. The note stays true after Block every refusal §6.4 names in the adapters #616 merges, since it describes 0.1.5.
  4. "Fixes [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32": [Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed #32 asks to make the split between decision failures and refusals normative so conformance tests can assert it, and this PR does that. The code follow-ups have their own issues: Block every refusal §6.4 names in the adapters #616 for the adapters, Follow-ups from the PR #603 review: refusal classes, the posture rule, and the reference implementations #722 for the Go and TypeScript hosts, and Spec gaps the §6.4 refusal rule exposes #731 for the older spec gaps.
  5. Ariel's suggestions: all 15 of his threads are answered and resolved.
  6. "Failure posture in force": renamed "Failure posture applied" in answer to Ariel's same question, and the row now says what it means: deny unless the deployment opted into proceed, and deny whenever the Guardian declared on_decision_failure: deny.
  7. D-056: this PR adds it to docs/decisions/index.md, together with D-057, and the strict docs build resolves every link to both.
  8. For docs: map the ACS conformance profiles against OWASP AISVS 1.01 #715: late_decision_fail_closed and late_decision_posture_unknown are the names in this PR. The paragraph on gating hooks has no anchor of its own, so link to the §6.4 heading (#64-honoring-decisions-normative) rather than to a line.

rocklambros
rocklambros previously approved these changes Nov 30, 2026

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

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:

  1. uv run pytest: 1328 passed, 1 skipped.
  2. uv run mkdocs build --strict: passes.
  3. git merge-tree against release/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.

@KeystoneSmartQuotes

Copy link
Copy Markdown

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>
@bar-capsule

Copy link
Copy Markdown
Collaborator Author

@afogel @rocklambros I merged release/0.2 (release 0.1.6) and renumbered this PR's decisions, since D-054 to D-056 are now taken: D-057 is the pending ASK through an outage, D-058 an unsigned error only without a key, D-059 every HTTP status, and D-060 the steps with nothing to block. Nothing else in the rules changed. The 0.1.6 facts went into the §6.4 note, the Instrument README and the reference implementations page. Ariel, could you approve on GitHub? Rock's approval was dismissed by the push.

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

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

[Bug] §6.4 conflates Guardian refusal with decision failure; refusals are attacker-reachable and should fail closed

9 participants