Skip to content

agent: keep the action record off the model, stop pushing back on answers - #421

Merged
rromenskyi merged 3 commits into
mainfrom
honest-turns
Nov 30, 2026
Merged

rromenskyi merged 3 commits into
mainfrom
honest-turns

Conversation

@rromenskyi

@rromenskyi rromenskyi commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes found in real sessions with a weak hosted model and a small remote one.

The action record

  • ipco used to append its record of what a turn did ("(actions this turn — files touched: …)") to the model's answer in the session history. A model shown that at the end of its own past answers started ending replies with one of its own, for turns that ran no tool (files "written", a commit hash that never existed).
  • The record now lives in llm.Message.Record, which is never sent.
  • Compaction builds its summary from the records and keeps them on the summary.
  • The archive the history tool reads back has the record in other words.
  • A list of that form in a reply is cut as soon as it arrives, before it joins the run's conversation. Only the list's own lines are cut, not text inside a code block, and the screen says so.
  • The judge's gap text and the history tool's old archive entries have the form reworded or cut.
  • In sessions saved before this, the list paragraphs are cut from answers and summaries; the rest of each message is kept.

The refusal push

  • A code block in a reply with no tool call no longer counts as a refusal. Asked "show me", a model answered with a code block and was told "you changed nothing, make every change now with the file tool". With nothing to change, it claimed it was writing files.
  • The push now leaves room to just answer.
  • On screen, each push says what it is responding to. They all used to read "that's not working — asking it to rethink".

The goal loop

  • It stops after 3 re-feeds in a row that each ended without a tool call, and says why.
  • Before, a goal with a 255 budget was re-fed 7 times in 25 s, each time answered in prose, until the user cancelled.

Context window

  • /model, a staged model pick, and a provider edit all drop the old model's size, whether it was found or set by hand (config.LLM.SetModel). A provider moved from a 272k model to a 64k one kept 272k.
  • When no size is known after a task, the user is told once that long tasks aren't trimmed.

Idle timeout

  • A request with no response for the whole idle window is retried with twice the wait, up to 4× idle_timeout_seconds, for the rest of the client's life.
  • The connection's read deadline and the header timeout follow the longer wait.
  • Headers followed by nothing count as no response. A stream that sent data and then stalled does not grow the wait, and neither does a dial timeout. The wait also grows when no retry is left, so the next turn gets it.
  • This is a mitigation: a small remote model was seen timing out four times in a row on a ~27k-token prompt, each retry with the same 90 s wait. Long prefill is the likely cause; it was not measured.
  • Trade-off: against a server that accepts connections and never answers, giving up now takes longer.

Tests:

  • New tests for each of the above.
  • Reviewed by codex, devin and muse; their confirmed findings are fixed in the last commit.
  • 56 sabotage edits (each fix reverted or broken in turn), all caught by a test.
  • Old-session cleanup checked against two real saved sessions (not in the repo): every list was cut, and answer text around them was kept.

🤖 Generated with Claude Code

rromenskyi and others added 2 commits November 29, 2026 17:14
…wers

- The record of what a turn did (files written, commands run) moves out of
  the model's answer in the session history into llm.Message.Record, which is
  never sent. Shown at the end of its own past answers, a weak model began
  ending replies with one of its own for turns that ran no tool. Compaction
  now builds its summary from the records and keeps them on the summary.
  Sessions saved before this have the lists cut from the answers.
- A "(actions this turn ...)" list in a reply is the model's own, so it is
  cut from the answer and the user is told.
- A code block in a reply with no tool call is no longer taken as a refusal.
  The push said "you changed nothing, make every change now" to answers to
  "show me"; with nothing to change, the model claimed it was writing files.
  The push now leaves room to answer, and each push says on screen what it is.
- The goal loop stops after 3 re-feeds in a row that each ended without a
  tool call, and says why.
- Switching models drops the old model's context size (found or set by hand).
- A request the server let go silent for the whole idle window is retried
  with twice the wait, up to 4x idle_timeout_seconds; the read deadline and
  header timeout follow it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s unknown

- The archive (read back by the history tool) and the summarizer's input
  carry the record in other words; a summary that echoes the record's form
  has it cut. Old sessions have only the list paragraphs cut, not the rest
  of an answer that went on after one.
- Only a request that got no response grows the wait; a stream that started
  and stalled does not.
- With no context size known for the model, the user is told once after a
  task that long tasks are not trimmed.
- The goal loop's idle stop is documented.

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

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

- A made-up list is cut from the reply before it joins the run's
  conversation, so later turns, nudges and re-feeds never show it back; the
  note under the answer covers any cut in the task.
- The cut takes the list's own line(s) only; an answer going on after it on
  the next line, CRLF text and a list shown inside a code block are kept.
- Compaction refuses a summary that was nothing but such a list.
- Each of several records on a summary is reworded for the summarizer; the
  history tool rewords records in entries archived before this change; the
  judge's gap text has the form cut before it is re-fed.
- A collapse re-fed after real work ends the idle streak.
- -m drops the saved model's size, like /model.
- Plain runs print the unknown-window note to stderr.
- The wait grows on the last try too, and on a stream that sent headers and
  then nothing; a dial timeout never grows it.
- Tests: the record is never in a request body in either wire format.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rromenskyi
rromenskyi merged commit 5b44dae into main Nov 30, 2026
2 checks passed
@rromenskyi
rromenskyi deleted the honest-turns branch November 30, 2026 13:40
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