Skip to content

feat(session): spend the last steps of a turn on a report, not on the wall - #107

Merged
filipeforattini merged 1 commit into
mainfrom
feat/step-budget
Sep 4, 2026
Merged

feat(session): spend the last steps of a turn on a report, not on the wall#107
filipeforattini merged 1 commit into
mainfrom
feat/step-budget

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 4, 2026

Copy link
Copy Markdown

The problem

TURN_STEP_CEILING = 200 was a cliff. At the wall the turn was cut off and the user was told to
"send another message to continue it" — but everything the model had worked out and not yet written
down went with the turn, so there was nothing to base that message on. Both omp and hermes landed
independently on the same shape: warn, force a summary, then abort. The point is not saving money,
it is not throwing away work already done.

The change

session/step-budget.ts — pure, tested — turns the cliff into two rungs:

  • run for the length of any real turn;
  • wrap-up a couple of steps before the wall: tools off, and the model asked for what it did,
    what is left, and what to do next. This reuses MAX_STEPS_PROMPT, the exact mechanism
    agent.steps already uses at its own bound, so there is one behaviour to reason about rather
    than two;
  • stop at the wall, unchanged, for a model that will not yield.

Two grace steps rather than one, because a model asked to summarise sometimes makes one last tool
call first. experimental.turn_steps sets both bounds or false removes the ceiling, which is what
the plan asked for when it said the ceiling should stay at 200 and become configurable.

Verification

  • Integration test seen failing first (without the wrap-up rung the request before the wall carried
    no report instruction) and passing after.
  • Unit tests for the thresholds, including a custom ceiling too small to hold its grace steps and a
    wrap_up_at set past the wall, which would otherwise never fire.
  • bun typecheck across all 31 packages; packages/redcode session suite 441 pass.
  • The two failures are reproduced on unmodified sources on this machine: the feat(session): end a turn that has stopped producing anything #103 watchdog test and
    finalizes assistant when cancelled before processor creation completes, both timing out under
    local load. CI arbitrates.

https://claude.ai/code/session_01U29Yk1UscZJ5ZVBXV1Sn8b


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… wall

Stopping a turn at the ceiling threw away everything worked out but not
written down, which is exactly what the next message would have needed.

Ask for the report a couple of steps before the wall, using the mechanism
`agent.steps` already uses, and keep the wall for a model that ignores it.

Claude-Session: https://claude.ai/code/session_01U29Yk1UscZJ5ZVBXV1Sn8b
@filipeforattini
filipeforattini merged commit 603d8c7 into main Sep 4, 2026
7 checks passed
@filipeforattini
filipeforattini deleted the feat/step-budget branch September 4, 2026 07:42
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