Skip to content

docs(agent-identity): follow ID-JAG -06 for AS-2 redemption errors - #2825

Merged
ChrisJBurns merged 2 commits into
mainfrom
docs/as2-redemption-error-contract
Nov 17, 2026
Merged

ChrisJBurns merged 2 commits into
mainfrom
docs/as2-redemption-error-contract

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Why: ID-JAG draft -06 (§4.4.1, §4.4.3) splits redemption refusals by whether a new ID-JAG can help. invalid_grant means the ID-JAG failed a validation rule; access_denied means it's valid but the user, client or actor isn't authorized at the gateway, and a new one won't help. §4.4.1 makes access_denied a MUST when no requested resource is acceptable. ToolHive's AS-2 is moving to that split (Authorization server: reason codes in error_description for ID-JAG redemption refusals toolhive#7030, #6887, #7158, #6892), and our step (8) still described the -04-era contract (invalid_target for check 6, invalid_grant/invalid_assertion for an unmapped user). None of it is built in ToolHive yet; this settles the contract first.
  • What:
    • Step (8) check 6 splits into 6a resource coverage (invalid_target, a broker bug since AS-1 copies our resource into the claim), 6b resource policy (access_denied + resource_denied) and 6c the actor (access_denied + actor_denied). Checks 7–9 keep their numbers.
    • An unknown user in embedded mode is access_denied + subject_unknown, and becomes mcp_authorization_pending with a link we build to the embedded gateway's sign-in. Nothing else creates the user's AS-2 account before the first redemption, so a plain failure would leave no way out. External gateways get no link; the call fails.
    • actor_denied is PERMISSION_DENIED, "deny the call", like denied. resource_denied is a configuration fault.
    • The approval-pending case is access_denied + consent_required everywhere, matching #7158.
    • The broker retries only an invalid_grant with no reason code. invalid_assertion isn't retried (we mint per call already, and retrying a replay would hide a stolen ID-JAG); access_denied is never retried.
    • Failure matrix, error reasons (including the exact ^[a-z_]+(: .*)?$ grammar), the AS-2 test list in implementation.md, and mcp-gateway-modes.md / mcp-authorization.md match.
    • ID-JAG citations move to -06 numbering: re-submission and no-refresh-token are §4.4.4; the security considerations cited are §9.4, §9.8, §9.10.

Stacked on #2823.

Issue relationship

Relates to #2654

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting (task lint): docs only
  • Fast offline test suite (task test): docs only
  • Pre-review race suite (task test:race): docs only
  • Offline demo (go run ./cmd/mecademo): not affected
  • Markdown changed: docs generation/link checks (task docs): 236 documents, 0 broken links or anchors, 0 orphans
  • User docs/user-facing behavior changed: site build (task site:build): not applicable
  • Guarded engine API affected: compatibility check (task api:check): not applicable
  • Intentional engine API change: task api:update + engine/CHANGELOG.md: not applicable

Changes

File Change
docs/drafts/agent-identity/credentials-and-lifecycle.md Step (8) checks and failures, Why, failure matrix, error reasons, -06 citations
docs/drafts/agent-identity/implementation.md AS-2 test list, consent rows, citations
docs/drafts/agent-identity/mcp-gateway-modes.md Unresolved subject fails with access_denied; citations
docs/drafts/agent-identity/mcp-authorization.md Authorization pending also covers a user never signed in at the embedded gateway
docs/drafts/agent-identity/audit.md Citation

User-facing change

None. Design docs only, and production configures no AS-2 gateway yet.

Special notes for reviewers

  • The code trails the docs until a follow-up: today access_denied and the three new reasons fall through to INTERNAL, which is safe. Known lists and actor_denied → PERMISSION_DENIED come next on a separate branch; subject_unknown → pending with a link waits for a real gateway.
  • When we bump ToolHive past the AS-2 work, authorize_integration_test.go ("a user AS-2 does not trust") and two as2_test.go cases change expectations. That belongs in the bump PR.
  • The "until Authorization server: reason codes in error_description for ID-JAG redemption refusals toolhive#7030 lands" note in step (8) stays: it's true until ToolHive ships, and a reasonless invalid_grant is still retried once under the new rule.

jhrozek and others added 2 commits November 17, 2026 17:44
ID-JAG draft -06 (§4.4.1, §4.4.3) splits redemption refusals by
whether a new ID-JAG can help: invalid_grant means the ID-JAG failed a
validation rule, and access_denied means it is valid but the user,
client, or actor is not authorized. ToolHive's AS-2 is moving to that
split (stacklok/toolhive#7030, #6887, #7158, #6892; not built yet), so
the design docs described a contract AS-2 is leaving.

Step (8) now splits check 6 into resource coverage (invalid_target, a
broker bug), resource policy (access_denied with resource_denied), and
the actor check (access_denied with actor_denied). An unknown user in
embedded mode is access_denied with subject_unknown and becomes
mcp_authorization_pending with a link to the embedded gateway's
sign-in. The approval-pending case is access_denied with
consent_required everywhere. The broker retries only an invalid_grant
with no reason code, never invalid_assertion or access_denied. The
failure matrix, error reasons, and AS-2 test list match.

The ID-JAG citations move to -06 numbering: re-submission and the
no-refresh-token rule are §4.4.4, and the security-considerations
sections cited are now §9.4, §9.8, and §9.10.

Co-authored-by: Mecatl <[email protected]>
@ChrisJBurns
ChrisJBurns force-pushed the docs/as2-redemption-error-contract branch from 0ac01e6 to 9d96210 Compare November 17, 2026 17:45
@ChrisJBurns
ChrisJBurns enabled auto-merge (squash) November 17, 2026 17:48
@ChrisJBurns
ChrisJBurns merged commit 4eb3147 into main Nov 17, 2026
47 checks passed
@ChrisJBurns
ChrisJBurns deleted the docs/as2-redemption-error-contract branch November 17, 2026 18:11
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants