Skip to content

fix(adapters): default omitted enforcement mode to declared - #417

Closed
solloek369-arch wants to merge 1 commit into
agentrust-io:mainfrom
solloek369-arch:fix/issue-416-declared-adapter-defaults
Closed

solloek369-arch wants to merge 1 commit into
agentrust-io:mainfrom
solloek369-arch:fix/issue-416-declared-adapter-defaults

Conversation

@solloek369-arch

Copy link
Copy Markdown
Contributor

What changes

Implements the trace-spec portion of #416.

TraceSandboxAdapter and TraceAGTAdapter no longer infer policy enforcement
when enforcement_mode is omitted.

  • omission now emits policy.enforcement_mode="declared"
  • explicitly supplied enforce, advisory, silent, and declared remain unchanged
  • TraceSandboxAdapter's existing Literal includes declared so its annotation matches its default
  • TraceAGTAdapter remains typed as str
  • actual runtime enforcement defaults and behavior are unchanged

Why

#416 established that an evidence constructor must not infer enforcement from an
omitted argument. declared binds the named policy without asserting that this
constructor observed policy evaluation or enforcement. Callers with an
independently established enforcement context pass the actual mode explicitly.

Compatibility

This changes emitted evidence for callers that previously omitted
enforcement_mode:

  • before: enforce
  • after: declared

Callers that actually established enforcement can continue to pass
enforcement_mode="enforce" explicitly.

No normative specification, schema, wire-format, or runtime-enforcement behavior
changes.

Validation

Local validation on Python 3.12.14 after pip install -e ".[dev]". These results are not a CI run.

  • focused Sandbox/AGT suite: 114 passed
  • full trace-spec suite: 2327 passed, 6 skipped
  • Ruff: pass
  • mypy: pass
  • dash check: pass
  • both omission regressions were shown load-bearing by temporarily restoring each
    constructor default to enforce; each failed on the intended
    'enforce' != 'declared' assertion and passed again after byte-exact restoration

Follows #416.

Follows agentrust-io#416.

Evidence constructors must not infer policy enforcement from an omitted
enforcement_mode. TraceSandboxAdapter and TraceAGTAdapter now default omission
to declared while preserving explicitly supplied modes.

The Sandbox Literal is extended only to admit the new default. AGT remains
typed as str. Runtime enforcement defaults are unchanged.

Signed-off-by: Loek <solloek369@gmail.com>
@imran-siddique

Copy link
Copy Markdown
Member

Thanks Loek. #416 found a real problem: both adapters signed enforce for sessions nothing evaluated. The declared default runs into spec section 4.3, which says declared MUST NOT be a default, so #419 removes the default and callers pass the mode. Your commit is in there as yours, sign-off intact. I would have pushed to your branch, but "Allow edits by maintainers" was off. Closing in favour of #419.

imran-siddique added a commit that referenced this pull request Sep 25, 2026
…rs (supersedes #417) (#419)

* fix(adapters): default omitted enforcement mode to declared

Follows #416.

Evidence constructors must not infer policy enforcement from an omitted
enforcement_mode. TraceSandboxAdapter and TraceAGTAdapter now default omission
to declared while preserving explicitly supplied modes.

The Sandbox Literal is extended only to admit the new default. AGT remains
typed as str. Runtime enforcement defaults are unchanged.

Signed-off-by: Loek <solloek369@gmail.com>

* fix(adapters): require enforcement_mode instead of defaulting it

Neither TraceAGTAdapter nor TraceSandboxAdapter evaluates a policy, so
neither can know which enforcement mode applied. An "enforce" default
signs a claim of evaluation nothing observed (#416), and the "declared"
default from the previous commit is ruled out by spec section 4.3:
declared MUST NOT be a default. The argument is now required; omitting
it raises TypeError. Docs, the tutorial and the tests pass the mode
explicitly, and the changelog entry is marked breaking.

Signed-off-by: Imran Siddique <imran.siddique@opaque.co>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Signed-off-by: Loek <solloek369@gmail.com>
Signed-off-by: Imran Siddique <imran.siddique@opaque.co>
Co-authored-by: Loek <solloek369@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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