Skip to content

Feat/wire robustness - #5

Merged
command0r merged 5 commits into
mainfrom
feat/wire-robustness
Sep 13, 2026
Merged

command0r merged 5 commits into
mainfrom
feat/wire-robustness

Conversation

@command0r

Copy link
Copy Markdown
Owner

No description provided.

…ted), forward max_tokens

ShapeStage (after auth) denies requests whose wire carried content the
classifier cannot see: image/file content parts and tool definitions,
calls or results, on both dialects. DenialKind.Unsupported → 400
(OpenAI 'unsupported', Anthropic 'invalid_request_error'); the refusal
is audited against the resolved caller and never contains the payload.
Silently stripping (the previous behaviour) let unclassified bytes reach
a provider and lied to tool-using clients. max_tokens /
max_completion_tokens now reach ChatOptions.MaxOutputTokens; non-positive
values are refused. Coverage gate raised to 0.80 (measured 0.886).

Tests +14: wire mapping tables for both dialects, stage guarantees,
max_tokens forwarding, and Host round-trips (400 shapes, audited,
payload absent from evidence, streamed request stays JSON).
- Denial reasons never echo client bytes: part/block type labels are
  allow-listed (WireLabels.Safe), unknown → 'unknown'. The reason lands
  in the append-only audit chain, so an unbounded client string there
  was a leak path. Test fails if the allow-list is removed (unit + Host).
- Detectors are total: non-string 'type'/'text', object content, non-
  object parts are refused, never thrown (a throw = un-audited 500).
- tools: [] / functions: [] are not tool requests (clients send them).
- Also refused: n>1, modalities/audio/web_search_options/prediction
  (OpenAI), mcp_servers/thinking/container (Anthropic) — provider-side
  egress or response shapes the wire cannot carry.
- Cache key includes max_tokens (a 400-token answer never serves a
  5-token ask) + test.
- Audit assertions poll the sink instead of sleeping.
- Unsupported → 400 pinned in the Anthropic taxonomy table; diagrams and
  dashboard explain() updated.
…ll role/messages

Policy denial reasons carried the client's model id verbatim into the
audit chain (same class as the shape-label leak): Evidence.Bounded
strips control chars and truncates at 64 chars with a marker. Null
role, null messages, null message elements and non-integer n are
refused or defaulted instead of throwing (a throw is an un-audited 500).
@command0r
command0r merged commit 0624887 into main Sep 13, 2026
2 checks passed
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