Skip to content

tool guard: --tool-guard stream, tool calls streamed for a request that asks (2/5, split from #405) - #415

Merged
AzeezIsh merged 3 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/split-405-2-tool-guard-stream
Nov 25, 2026
Merged

AzeezIsh merged 3 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/split-405-2-tool-guard-stream

Conversation

@data-angel

Copy link
Copy Markdown
Contributor

Change 2 of 5 split from #405, stacked on #414 (review the top two commits; the first commit of this branch is
#414's). It is the streaming tool guard, 887d17894 there, together with 1a3675294, which made streaming
something a request asks for.

What

  • --tool-guard stream (any model; default unchanged): the guard checks each call at its end, as on does, but for
    a request that asks, the call's header and arguments go out as they are written. A call it blocks, or one the
    response cuts off, ends that response content_filter (not tool_calls) with
    atlas_tool_guard::STREAMED_REFUSAL, which says part of the call streamed and that it must not run.
  • A request asks with the body field stream_tool_arguments: true, an Atlas extension on /v1/chat/completions.
    Without it the call is held and the response is the same as under --tool-guard on, so a client that does not
    read content_filter never receives a blocked call. Under on and off the field is accepted and ignored. This
    covers the generic stream path and the Poolside v1 string-argument path; a working-directory hint,
    ATLAS_BUFFER_TOOL_ARGS and tool retry still hold a call as before.

Outside the Inkling files (all of it is): atlas-tool-guard gains Policy::stream and STREAMED_REFUSAL;
--tool-guard accepts stream; stream_tool_arguments on the OpenAI chat request and the IR request (false from
the Anthropic and Responses paths); StreamCtx::streams_tool_calls decides per request. No new ATLAS_* names.

No GPU run on this rebased branch; the GPU observations above were made on #405's old base.

Test plan

  • tool_security_tests: under --tool-guard stream an allowed call streams and finishes tool_calls; a
    metadata URL, an oversized call and a cut-off call each finish content_filter with the streamed refusal;
    Poolside calls stay held; the CLI parses stream
  • chat_wire::stream_tool_arguments_is_an_opt_in_request_field
  • On the SparkInkling 0.4.2 image (which carries both commits): a metadata-address call asked for streamed sent
    its arguments in 31 chunks and finished content_filter; the same call not asked sent no arguments and
    finished content_filter; a benign call not asked arrived whole in one chunk
  • On this branch (Rust 1.93.1, CUDA stubs, no GPU): cargo fmt --all -- --check, cargo clippy --workspace --tests, the file-size cap script, spark-server tool_security / chat_wire / tool_guard / glm_tool_boundary tests (64 passed), atlas-tool-guard (19 passed)
  • spark benchmark run <gate> --pull-request-gate gates: left to the maintainers

Authorship

AI-authored: Claude (Opus 5.5 and Fable 5.2) in Claude Code, directed and reviewed by a human; no hand-written code.

CLA

  • I have read and agree to the Contributor License Agreement.

🤖 Generated with Claude Code

data-angel and others added 3 commits November 24, 2026 08:37
q, k, v, the relative-bias and gate projections, the sinks and the
dynamic convs' taps ran as six to eight GEMV launches a visit, each small
(24 to 3,072 outputs over K = 2,304). inkling2_proj_gemv runs them as one:
each segment of a per-visit device table (written once the shared buffers
attach, one a row count up to 8) is one projection's input rows, weight
and output, and every output row is the chain dense_gemv_bf16_batchm
computes for it (the common body now takes its block index). A visit with
a quantized projection (Spark weights) keeps one launch each.

Observed on one GB10, plain Strict decode (no drafter), saver size,
greedy text and the six-prompt concurrency hashes identical to engine
d1b138e: C1 code/prose 35.84/35.87 -> 36.37/36.37 tok/s (server rate,
3 runs), aggregate C2 51-53 -> 52-55, C4 79-80 -> 80-82, C8 115-118 ->
118-120 (2 rounds of 2 runs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`--tool-guard stream` screens the same calls as `on`, at the same point
(each call's end, and the aggregate size bound as bytes arrive), but sends
a call's header and arguments as they are written instead of holding them
until the call passes. A call it blocks, or one the response cuts off,
ends the response `content_filter` (not `tool_calls`) with
STREAMED_REFUSAL, which says part of the call streamed and that it must
not be run. Poolside v1 calls stay held: its detector buffers them anyway.
`off` and `on` are unchanged, and `off` stays the default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under `--tool-guard stream` every request got its tool calls as they were
written. A client that does not read `content_filter` would run a call the
guard blocked at its end, or an unclosed one. A request now gets streamed
tool calls only with the body field `stream_tool_arguments: true` (an Atlas
extension on /v1/chat/completions); without it the call is held, and the
response is the same as under `--tool-guard on`. This covers the generic
stream path and the Poolside v1 string-argument path. Under `on` and
`off` the field is accepted and ignored. A working-directory hint,
ATLAS_BUFFER_TOOL_ARGS and tool retry still hold a call as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor

Queued in train #421 (integ/train-inkling-20261125), merged --no-ff in stack order. GB10 gate is running on sparky (job 187); results will be posted on #421.

🤖 Generated with Claude Code

@AzeezIsh
AzeezIsh merged commit a0fcdad into Atlas-Inf:main Nov 25, 2026
1 check 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.

2 participants