Skip to content

Let harness sessions run to the run's limits and keep their reasoning state - #57

Merged
dylanuys merged 2 commits into
stagingfrom
fix/harness-session-limits
Nov 19, 2026
Merged

dylanuys merged 2 commits into
stagingfrom
fix/harness-session-limits

Conversation

@dylanuys

@dylanuys dylanuys commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Three defects kept harnessed questions from being answered as a real harness session would be.

In yugos_evals.harnessed:

  • A harness session was cut at the native agent's message limit. A harnessed copy kept its task's message_limit. That limit sizes the native agent's loop; SWE-bench's thirty messages ended a Claude Code or Codex CLI session after about a dozen turns, before it could finish. harness_question now drops it. The run's call, cost and time limits bound a harness session instead.
  • Every OpenCode session failed before its first request. OpenCode resolves the model it formats requests as against its release's own catalog. The inspect-swe default (anthropic/claude-sonnet-4-5) is no longer listed by current releases, so opencode run stopped with "Model not found". The harness is now started with a model current releases list. The routed model still answers every request; this only selects the request format.

In yugos.inspect_engine.router_model:

  • A harness's turns reached the router without their reasoning state. A reply's provider reasoning state travels in the assistant message's metadata, and a task's own agent sends that message back unchanged. A coding harness rebuilds each request from its own transcript, so its assistant turns arrived without the state, and an empty reply arrived as placeholder text. Models that rely on that state between tool calls lost their reasoning on every turn. The router model now recognises a replayed tool-calling turn by its exact tool calls (IDs, functions and arguments) and sends the reply it came from. A turn the harness changed is left as it arrived. The restore happens before Inspect records the request, so the log shows the conversation the router was sent.

Validation

  • New tests: a harnessed copy of a question with a message limit restores to a task without one, while the native question keeps it; OpenCode is started with a model other than the stale default, and the other harnesses are unaffected; a solver that replays a tool-calling turn the way a harness does gets its reasoning state and original text back in both the router's request and the log, and a turn with edited arguments does not.
  • pytest packages/yugos/tests packages/yugos-evals/tests/test_harnessed.py passes (595 tests); the new router test fails without the change. ruff check and ruff format --check pass on the changed files.
  • OpenCode 1.19.6 in a network-blocked sandbox: with the old default it exits with ProviderModelNotFoundError; with the new model it resolves the model and sends its request to the configured base URL.
  • Not yet verified: the reasoning-state restore inside a live Claude Code, Codex CLI or OpenCode session.

🤖 Generated with Claude Code

…ent model

A harnessed question kept its task's message limit, which sizes the native
agent's loop: thirty messages ended a harness session after about a dozen
turns. The run's call, cost and time limits bound a harness instead.

OpenCode resolves the model it formats requests as against its release's own
catalog. The inspect-swe default is no longer listed by current releases, so
every OpenCode session failed before its first request.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T10:34:42.503241Z ee5862a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A coding harness rebuilds each request from its own transcript, so its
assistant turns reached the router without the provider's reasoning state
and an empty reply came back as placeholder text. The router model now
recognises a replayed tool-calling turn by its exact tool calls and sends
the reply it came from, as the task's own agent would.
@dylanuys dylanuys changed the title Let harness sessions run to the run's limits and give OpenCode a current model Let harness sessions run to the run's limits and keep their reasoning state Nov 19, 2026
@dylanuys
dylanuys merged commit 49546af into staging Nov 19, 2026
2 checks passed
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