Skip to content

[Bug]: orca exec exits 4 (BudgetExhausted/max inner turns) mid-task on long runs - hardcoded 128-turn cap, not configurable, trajectory lost #30

Description

@echoVic

Orca version

0.3.7 (commit 6088d85)

Installation method

Built from source (musl cross build)

Platform

Linux container (Terminal-Bench task env), harbor 0.20.0, deepseek-v4-flash, orca exec --mode full-auto --output-format jsonl

Mode

orca exec (headless, under harbor)

Steps to reproduce

Run a long task (e.g. Terminal-Bench terminal-bench/fix-ocaml-gc or terminal-bench/winning-avg-corewars) with orca exec. Observed in the 0.3.7 full benchmark run:

harbor.trial.errors.NonZeroAgentExitCodeError: Command failed (exit 4): orca exec --mode full-auto --output-format jsonl '...'

Expected behavior

A long-running session should not be silently terminated by an invisible turn cap; if a limit exists it should be configurable, documented, and exit with a distinguishable code that preserves the trajectory.

Actual behavior

  • orca exec exits with code 4 = RunStatus::BudgetExhausted (event_schema.rs: BudgetExhausted => 4).
  • With no --max-budget configured, the only producer is the hardcoded inner-turn cap: agent_loop.rs DEFAULT_MAX_TURNS: u32 = 128, enforced in lifecycle.rs start_turn (if self.turns_started >= self.max_turns { BudgetExhausted / MaxInnerTurns }).
  • The turn cap is not configurable: no CLI flag and no config-file field (searched src/cli.rs and crates/orca-core/src/config).
  • Evidence from the 0.3.7 full run (both tasks passed in the 0.3.4 run with trajectories of 82-99 turns):

Additional context

Suggested fixes (any combination):

  1. Expose max_turns as a CLI flag (--max-turns) and/or config.toml field, defaulting to 128.
  2. On turn-limit exhaustion, write the trajectory before exiting (or use a distinct exit code and ensure the adapter persists stdout regardless of exit code).
  3. Surface a warning/event when the limit is approached so headless users know the run was cut off, not completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions