Skip to content

miniswen: configurable model request timeout - #24

Open
gfortaine wants to merge 1 commit into
rails:mainfrom
gfortaine:feat/miniswen-request-timeout
Open

gfortaine wants to merge 1 commit into
rails:mainfrom
gfortaine:feat/miniswen-request-timeout

Conversation

@gfortaine

Copy link
Copy Markdown

Miniswen keeps ruby_llm's default 300 s request timeout. Some models answer in one long turn. When a turn takes longer than that, the call times out, Miniswen's retry middleware sends the same request again, and it times out again until the retries or the step limit run out. The trial then ends as agent_error (Faraday::TimeoutError: Net::ReadTimeout), even though the model would have answered.

What we measured running the 46-task bench against the direct Gemini API (Lemans 1.6.0):

  • gemini/gemini-4-carbon#high on ms-greenfield-helpdesk timed out at 300 s on the same turn 7–10 times in two separate trials. One trial ended as agent_error; the other got stuck again later.
  • We replayed that exact turn from the saved agent.result.1.json (an 18K-token prompt) once, with a 900 s timeout. It answered after 627 s: 28K output tokens, a 130 KB bash tool call writing the app in one go, for $0.31.
  • Across all our runs, 300 s timeouts hit only Gemini models (Carbon 37 times on 10 tasks, Neon 9 times). Claude Haiku 5.5 and GPT-6.2 Sol never hit them.

This adds an optional per-agent timeout:

agent:
  request_timeout: 20m
  • Config::Agent#request_timeout is parsed like exec_timeout. It's nil by default, so ruby_llm's 300 s stays in force.
  • Miniswen::Agent.new(request_timeout:) resolves its provider with RubyLLM.context { it.request_timeout = ... }.config, so the global ruby_llm config is untouched and concurrent trials don't interfere.
  • miniswen --request-timeout SECONDS, which miniswen-installed passes through when the profile sets it.
  • It's recorded in the trajectory's agent_config as request_timeout_seconds, and documented in the bench.yml template.

Tests: config parsing (set and default), the provider receiving the timeout while the global config stays unchanged, and miniswen-installed passing --request-timeout. bundle exec rake test passes (347 runs, 0 failures) and bundle exec rubocop is clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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