Skip to content

fix(opencode): align timeout completion status - #4233

Draft
giuliolovisotto wants to merge 2 commits into
mainfrom
glovisotto/opencode-agent-timeout-not-natural
Draft

giuliolovisotto wants to merge 2 commits into
mainfrom
glovisotto/opencode-agent-timeout-not-natural

Conversation

@giuliolovisotto

@giuliolovisotto giuliolovisotto commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

A local OpenCode process timeout discards its output and pads an empty assistant message. The response defaults to status="completed", so /run incorrectly reports finished_naturally=true.

Return status="incomplete" after the local process deadline and require a completed response before reporting a natural finish. This uses the existing response status, matching the sandbox-session path introduced in #3639. No new public agent_timed_out field or internal response flag is added.

The sandbox path already reports incomplete for its execution-timeout receipt. Its existing environment-routing test now exercises both normal completion and timeout, proving that the status and retained output reach verification unchanged and the verifier's reward survives collection. This does not change timeout/retry policy or depend on a proposed timeout schema.

Compatibility: local timed-out responses now expose the correct existing status to the verifier, and finished_naturally becomes false. Existing local output padding, usage, invocation evidence, and grading/masking policy remain unchanged. No changes to the separate legacy opencode_sandboxed_agent.

Validation on main fb1155108 plus this change:

  • python -m pytest -o addopts= --import-mode=importlib -q responses_api_agents/opencode_agent/tests: 360 passed, 37 skipped (Linux-only supervisor cases unavailable on macOS).
  • gym env test +entrypoint=responses_api_agents/opencode_agent +skip_venv_if_present=true +should_validate_data=true: 360 passed, 37 skipped.
  • pre-commit run --all-files: passed.
  • Fresh local OpenCode scripted conformance: 7/7 scenarios passed.
  • Two fresh live-inference smokes using Nemotron Nano: normal response was completed, naturally finished, reward 1; delaying delivery of a real successful model response beyond the native 20-second process deadline produced incomplete, not naturally finished, reward 0. Both reached verification, completed evaluation, and remained unmasked.
  • Sandbox timeout coverage is fixture-based through the real agent/session/environment/collector code; no new live sandbox deployment was run.

No separate issue is needed for this narrow existing completion-reporting bug. Broader timeout evidence and failure classification are outside this change.

@giuliolovisotto giuliolovisotto added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior labels Oct 8, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@giuliolovisotto
giuliolovisotto force-pushed the glovisotto/opencode-agent-timeout-not-natural branch from 8ea3091 to 2d16045 Compare October 12, 2026 14:49
@giuliolovisotto giuliolovisotto changed the title fix(opencode_agent): do not report a timed-out run as finished naturally fix(opencode): align timeout completion status Oct 12, 2026

This branch has not been deployed

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

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant