[GH-ISSUE #4195] [Engine] Serve: detect an agent rewriting the same file across turns (identical repeats and A/B oscillation) #1845

Closed
opened 2026-11-04 01:54:39 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @mnott on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4195

Problem

In agent use (Anthropic Messages API, Claude-Code-style tool loops) Gyro models on Strata often finish a multi-file task and then keep rewriting files they already wrote, instead of sending their final answer:

  • identical repeats: the same Write with byte-identical content, 30-100 times (Gyro Coder-L on a 40-task coding set; Gyro-M after all 40 files: one file written 79 times);
  • oscillation: two versions of the same file alternating A, B, A, B (Gyro-L, calc expression parser, 12+ writes).

Each repeat is a full request with the whole conversation, so the run burns minutes (790 s instead of ~180 s for the same set) and often ends only at the client's own limit. Strata already breaks repetition inside one response (the serve layer raises temperature/presence penalty when the same words keep coming), but nothing looks across requests, although the server sees the whole conversation in every request.

Measurements (Apple Silicon, v0.2.6 + our open Metal PRs, see #4128)

Model Set Without a cross-turn guard With a client-side guard (identical-write note + oscillation stop)
Gyro-M TQ2_0 40-task coding set 790 s, every file written ~11x 287 s (stopped at 20 identical writes), 40/40 correct
Gyro-L TQ3_0 40-task coding set one file oscillating A/B, run not ending 182 s and 168 s, 39/40 and 40/40, ended by the model

A full night with the guards on (Gyro-M and Gyro-L, 8 runs each of a 20/40/40-task set plus 3 runs of 5 real repository tasks): identical-write fired 257 times (253 notes, 4 stops), revert 66 (7 stops), repeated test command 36, rewrites with changing content ("thrash", up to 16 writes in 10 versions of one file) 9. Harness limits still ended a few runs (two runaways: one inventing 807 files, one reading 79 invented paths; and a 30-minute cap on real tasks). Pass rates Gyro-M 98 / 81 / 83 % (easy / hard / short), Gyro-L 84 / 53 / 89 %.

(The client-side guard tells the model " already contains exactly this content" or "you are switching back to a version you already wrote; pick one and move on", and stops after 20 identical writes or 6 reverts.)

Proposal

An opt-in check in the serve layer for tool-calling requests: hash the arguments of each assistant tool call in the request history; when the new call repeats one of the last N calls exactly (or reverts a file's content to an earlier version) K times, either append a short system note to the prompt or answer with a final message instead of another call. Off by default; thresholds in the run config.

Related, same runs: a model that calls a tool the request did not declare (Gyro-L wanted Bash to ls its output folder while only Read and Write were offered) gets the call passed through as plain text, because the parser keeps declared tools only; the client takes the text as the final answer and the run ends early (26 of 40 tasks written). Emitting such a call as a tool_use would let the client answer "no such tool" and the model continue with the tools it has.

Before writing code: is this in scope for the server, or should it stay with the client/harness?

Originally created by @mnott on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4195 ## Problem In agent use (Anthropic Messages API, Claude-Code-style tool loops) Gyro models on Strata often finish a multi-file task and then keep rewriting files they already wrote, instead of sending their final answer: - identical repeats: the same `Write` with byte-identical content, 30-100 times (Gyro Coder-L on a 40-task coding set; Gyro-M after all 40 files: one file written 79 times); - oscillation: two versions of the same file alternating A, B, A, B (Gyro-L, `calc` expression parser, 12+ writes). Each repeat is a full request with the whole conversation, so the run burns minutes (790 s instead of ~180 s for the same set) and often ends only at the client's own limit. Strata already breaks repetition inside one response (the serve layer raises temperature/presence penalty when the same words keep coming), but nothing looks across requests, although the server sees the whole conversation in every request. ## Measurements (Apple Silicon, v0.2.6 + our open Metal PRs, see #4128) | Model | Set | Without a cross-turn guard | With a client-side guard (identical-write note + oscillation stop) | |---|---|---|---| | Gyro-M TQ2_0 | 40-task coding set | 790 s, every file written ~11x | 287 s (stopped at 20 identical writes), 40/40 correct | | Gyro-L TQ3_0 | 40-task coding set | one file oscillating A/B, run not ending | 182 s and 168 s, 39/40 and 40/40, ended by the model | A full night with the guards on (Gyro-M and Gyro-L, 8 runs each of a 20/40/40-task set plus 3 runs of 5 real repository tasks): identical-write fired 257 times (253 notes, 4 stops), revert 66 (7 stops), repeated test command 36, rewrites with changing content ("thrash", up to 16 writes in 10 versions of one file) 9. Harness limits still ended a few runs (two runaways: one inventing 807 files, one reading 79 invented paths; and a 30-minute cap on real tasks). Pass rates Gyro-M 98 / 81 / 83 % (easy / hard / short), Gyro-L 84 / 53 / 89 %. (The client-side guard tells the model "<file> already contains exactly this content" or "you are switching back to a version you already wrote; pick one and move on", and stops after 20 identical writes or 6 reverts.) ## Proposal An opt-in check in the serve layer for tool-calling requests: hash the arguments of each assistant tool call in the request history; when the new call repeats one of the last N calls exactly (or reverts a file's content to an earlier version) K times, either append a short system note to the prompt or answer with a final message instead of another call. Off by default; thresholds in the run config. Related, same runs: a model that calls a tool the request did not declare (Gyro-L wanted `Bash` to `ls` its output folder while only Read and Write were offered) gets the call passed through as plain text, because the parser keeps declared tools only; the client takes the text as the final answer and the run ends early (26 of 40 tasks written). Emitting such a call as a `tool_use` would let the client answer "no such tool" and the model continue with the tools it has. Before writing code: is this in scope for the server, or should it stay with the client/harness?
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660125253 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1845
No description provided.