Skip to content

run --max-turns does not bound overflow-and-compact cycles that fail before a step starts #1813

Open

Description

@anandgupta42

Description

With altimate-code run --max-turns N and no --time-budget, a request the provider rejects as a context overflow before streaming any step hands off to compaction. Compaction steps are not charged, and no work step ever starts, so the turn budget never sees the cycle. If the request after each compaction overflows again the same way, the run can loop indefinitely. The compaction circuit breaker resets after every successful compaction, so it doesn't stop this.

This behaviour predates the turn-accounting change in #1811 (it exists on v0.12.12). Steps that overflow mid-stream are charged and bounded.

Steps to reproduce

Hard to trigger with real providers. Simulated: an attached session whose every request emits a ContextOverflowError session error before any step-start, followed by a compaction step. With --max-turns 1 the run never ends.

Expected: such cycles are bounded under --max-turns (for example by counting pre-step overflows toward the budget, or capping consecutive compactions), without charging normal retries.

OpenCode version

altimate-code v0.12.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions