Skip to content

spark-server: loop repair (#55): short prose history no longer suppresses tool calls; guard_stop on the wire (ported from Enntity) - #232

Merged
AzeezIsh merged 4 commits into
mainfrom
stack/loop-repair
Oct 29, 2026
Merged

AzeezIsh merged 4 commits into
mainfrom
stack/loop-repair

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Stack: … ← #230 ← #231 ← this.

Summary

Test plan (vs parent #231)

Tracking: #220.

Generated with Devin

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Pair check vs parent (binary 6d4b71b8): greedy C1 equals #198's serial references 8/8, and the tool probe is 21/21. No regression.

  • Job board: Job issue form + live board on atlasinference.dev; wrangler cache + CI identity fix; root cleanup #55 repro: inconclusive. My #55-shaped request (8 short prose turns, then a turn that needs a tool) produced the tool call on the parent too. It doesn't trigger the old suppression in this configuration, so it can't show the fix. Unit coverage stands: loop_detect 24/24, including Enntity's 3 new tests.
  • guard_stop on a guard cut: not shown yet. With the guard-on profile, my scp-to-a-remote-host call wasn't refused, and the boot log has no guard line. I can't tell yet whether the guard engaged on that boot. Follow-up: verify --tool-guard=on in argv and use a case from tool_security_tests that the guard is known to refuse.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Correction: the guard was engaged on the guard-on boot. The log has tool-call guard configured enabled=true max_bytes=1048576; my grep pattern was wrong. So the scp-to-203.0.113.7 call genuinely wasn't refused with the guard on. Next: a probe with cases from the crate's own regressions (curl to the metadata IP; curl -T of a credentials file; and a document-content case that must pass), printing the emitted arguments, so we can tell whether the scp form is outside the policy or a gap.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Guard-on probe (#232 head c62d4d387, --tool-guard=on, boot log tool-call guard configured enabled=true), using cases from atlas-tool-guard's regressions:

  • curl 169.254.169.254/latest/meta-data/ via the shell tool: blocked. No tool call; finish content_filter; content [atlas] A tool call was blocked by the tool-call guard….
  • But guard_stop is absent on that blocking response (guard_stop=None). This PR is supposed to surface it on a guard cut, so either the content-filter refusal path doesn't set it, or the blocking choice drops it. That's a defect in this PR, under investigation.
  • The other two cases (curl -T of a credentials file, and a document-content case) are uninformative: the model declined to emit those calls at all, so the guard never saw them.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Follow-up on the missing guard_stop: added a blocking-path test (4d6cf3676). A guard refusal through chat_blocking_choice's inspect arm does set choices[0].guard_stop; it passes on reiner. The probe reads that field correctly. The live refusal took a different arm: a content_filter finish without guard_stop, most likely the scheduler-side verdict path, where response.guard_stop reaches ir::Choice as None. The served binary was this PR's head (c62d4d387). Still open: guard_stop isn't set on that path, and /completions drops the field (completions.rs: guard_stop: _). Fix next.

@AzeezIsh
AzeezIsh force-pushed the stack/qsa-aux-kv-budget branch from 018a396 to 9e5b619 Compare October 29, 2026 04:44
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
A refusal the scheduler's ActiveSeq flag carried (Done.guard_stop ->
response.guard_stop -> ir::Choice) is asserted separately from the
inspect-arm refusal: stream_state.guard_stop is preserved by the .or()
merge and must surface on the wire.
@AzeezIsh
AzeezIsh changed the base branch from stack/qsa-aux-kv-budget to stack/strict-mode October 29, 2026 07:13
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
A refusal the scheduler's ActiveSeq flag carried (Done.guard_stop ->
response.guard_stop -> ir::Choice) is asserted separately from the
inspect-arm refusal: stream_state.guard_stop is preserved by the .or()
merge and must surface on the wire.
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
A refusal the scheduler's ActiveSeq flag carried (Done.guard_stop ->
response.guard_stop -> ir::Choice) is asserted separately from the
inspect-arm refusal: stream_state.guard_stop is preserved by the .or()
merge and must surface on the wire.
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
A refusal the scheduler's ActiveSeq flag carried (Done.guard_stop ->
response.guard_stop -> ir::Choice) is asserted separately from the
inspect-arm refusal: stream_state.guard_stop is preserved by the .or()
merge and must surface on the wire.
…op on the wire

Port of Enntity/atlas 8150f89 + e2fcc5c (AGPL-3.0-only), fixes #55.

- loop_detect: a short-prose history is diagnostic only — it no longer
  hard-masks <tool_call> nor seeds the soft bias decay (client-supplied
  history is not provenance; masking/biasing before the model's first
  tool call creates the loop it exists to prevent). The Suppress verdict
  keeps its P1-5 hard mask (failing/progressing carve-outs).
- ActiveSeq::guard_stop flows to InferenceResponse, ir::Choice and
  StreamDelta::Finish, and reaches the wire as a guard_stop extension
  field on the blocking choice and the final stream chunk (additive,
  skipped when absent → default wire output byte-identical).

Tests: their 3 loop_detect tests (filler never trips, varied prose never
discourages, Suppress keeps its mask).
A refusal the scheduler's ActiveSeq flag carried (Done.guard_stop ->
response.guard_stop -> ir::Choice) is asserted separately from the
inspect-arm refusal: stream_state.guard_stop is preserved by the .or()
merge and must surface on the wire.
@AzeezIsh
AzeezIsh marked this pull request as ready for review October 29, 2026 07:39
@AzeezIsh
AzeezIsh changed the base branch from stack/strict-mode to main October 29, 2026 08:13
…r missed the field; stream/Responses parity kept, Anthropic stays stop_reason-only
@AzeezIsh
AzeezIsh merged commit 8829168 into main Oct 29, 2026
25 of 26 checks passed
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Merged (882916887). Live check on the pair, with --tool-guard=on (T = d7601f1c5, receipts in out/stacks2-d7601f1c5/):

  • curl 169.254.169.254 was refused, with finish=content_filter and guard_stop=tool_call_guard on the wire, both non-stream and stream.
  • Before accac4c54 (wire-level test: guard_stop_serializes_on_the_wire_choice_and_is_absent_when_none), the field was set on the IR choice, but the non-stream OpenAI encoder never emitted it.
  • C1 greedy outputs equal the references 8/8, and with the guard off no guard_stop appears.

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