Skip to content

Fix/turn budget - #100

Merged
fuseraft merged 3 commits into
mainfrom
fix/turn-budget
Sep 8, 2026
Merged

Fix/turn budget#100
fuseraft merged 3 commits into
mainfrom
fix/turn-budget

Conversation

@fuseraft

@fuseraft fuseraft commented Sep 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

Scott Stauffer added 3 commits September 8, 2026 14:59
The 75%-full check in ReplTurn.cs only ever printed a suggestion to
run /compact manually. In practice this let sessions ride at 75%+
context for many turns with no automatic shrinkage, contributing to
oversized turns that burn excess tool-call rounds (observed hitting
the 50-round backstop in session f6544c76, turn 11).

The check now prefers the provider-reported actual input-token count
for the turn (ctx.LastActualContextTokens) over the char-based
estimate when available, and calls the existing
ReplCommands.CompactHistoryAsync path (already proven via the
adaptive-trim-forced auto-compact) instead of only warning. Falls
back to the old warn-only text if compaction fails.

Adds a repl.autoCompact setting (default on) to opt back into the
old warn-only behavior via /settings set repl.autoCompact false.
TruncateArgValue replaces oversized FunctionCallContent argument
values (e.g. a write_file content arg) in already-completed,
same-turn tool calls with a short size note before resending history
to the model on a later round, to bound per-round context growth.

The old placeholder text read enough like a real value that the
model has been observed re-echoing it verbatim into a brand-new,
live tool call - e.g. when asked to move a file it had written
earlier in the turn, it reconstructed the content argument from its
own (by then elided) history and wrote the placeholder string itself
to disk.

The filter never mutates a pending/about-to-execute tool call - this
was the model treating its own truncated context as ground truth.
Reword the note to explicitly warn against reuse and point to the
correct recovery (re-read the file or regenerate the value).
…olders

TrimInTurnContext's two elision placeholders replace/truncate tool
*results* (e.g. a large read_file output) in-turn, the same way
TruncateArgValue elides oversized call arguments. They had the same
latent risk: a vague placeholder that could be mistaken for real
data and echoed into a later, live tool call (e.g. treating an
elided read_file result as the file's actual contents when writing
it elsewhere).

Reword both to be explicit about what they are:

- The full-replacement placeholder (Phase 1) now says outright it is
  not the real output and must not be reused as data.
- The proportional-truncation suffix (Phase 2) is different in kind:
  the content before it IS real, only the tail was cut. Reworded to
  say so explicitly, so the model doesn't treat the retained prefix
  as the complete result.
@fuseraft
fuseraft merged commit 0afde64 into main Sep 8, 2026
7 checks passed
@fuseraft
fuseraft deleted the fix/turn-budget branch September 8, 2026 20:33
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