Skip to content

feat: the decision hook's egress stage - #61

Merged
blakebauman merged 1 commit into
mainfrom
feat/decision-hook-egress
Aug 13, 2026
Merged

blakebauman merged 1 commit into
mainfrom
feat/decision-hook-egress

Conversation

@blakebauman

Copy link
Copy Markdown
Member

Phase 2 of docs/design-decision-hook.md, following #60.

fold serializes what an upstream returned and asks the hook before the caller sees it. That is the straightforward half. The half the design record was missing is what it means:

By egress, the upstream has already acted

A denial at egress withholds the disclosure, not the effect. The row is deleted, the message is sent, and the caller is told the result was withheld. Egress is a data-loss control; stopping an action means refusing it at ingress.

The error message says exactly that — "decision hook withheld the result of tools/call \"charge\" (the upstream has already acted)" — because "denied" otherwise reads as "did not happen", and an organization deploying egress as a control on what its agents can do has misread the feature. TestHookEgressWithholdsTheResult asserts the upstream actually ran, so the caveat is demonstrated rather than described.

This is now in the README, the security model, and the design record, which did not have it.

Oversize results are not truncated

A partial body is precisely the blind spot an inspector must not be handed, so a result past 1 MiB takes the onError path — under "deny", refusing results nobody could have inspected. Fail-safe, and documented rather than discovered. The bound is a constant until someone needs it to be a field.

Cost

Serializing the result is what egress adds over ingress: fold holds the decoded form and the hook needs bytes. It happens only for inspected methods on a configured stage, so deployments without egress pay nothing and the added-latency gate is unmoved.

Verification

make check including lint (ineffassign caught a dead initializer), make conformance 40/40, and two new integration tests: the withholding path with a tool that records having run, and the oversize path.

Phases 3 (the reverse path — where "refuse an elicitation asking for a password" finally becomes real) and 4 (docs pass) remain.

🤖 Generated with Claude Code

The result stage: fold serializes what an upstream returned and asks the hook
before the caller sees it. Which is the straightforward half. The half the
design record was missing is what it means.

By egress the upstream has already acted. A denial there withholds the
disclosure, not the effect — the row is deleted, the message is sent, and the
caller is told the result was withheld. Egress is a data-loss control;
stopping an action means refusing it at ingress. The error message says so in
those words, because "denied" otherwise reads as "did not happen", and an
organization deploying egress as a control on what its agents can do has
misread the feature. The test asserts the upstream ran, so the caveat is
demonstrated rather than described.

A result too large to inspect is not truncated. A partial body is precisely
the blind spot an inspector must not be handed, so a result past 1 MiB takes
the onError path — which under "deny" means refusing results nobody could
have inspected. Fail-safe, and the bound is a constant until someone needs it
to be a field.

Serializing the result is what egress costs over ingress: fold holds the
decoded form and the hook needs bytes. It happens only for inspected methods
on a configured stage, so deployments without egress pay nothing, and the
added-latency gate is unmoved.

Phase 2 of docs/design-decision-hook.md.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@blakebauman
blakebauman merged commit 5b51bf6 into main Aug 13, 2026
7 checks passed
@blakebauman
blakebauman deleted the feat/decision-hook-egress branch August 13, 2026 19:55
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.

1 participant