Skip to content

fix(terminal_bench): skip max_turns for Codex agent (Harbor 0.24.0 compatibility) - #1846

Merged
Yunnglin merged 1 commit into
modelscope:mainfrom
zzx04-cool:fix/1836-codex-max-turns
Oct 13, 2026
Merged

Yunnglin merged 1 commit into
modelscope:mainfrom
zzx04-cool:fix/1836-codex-max-turns

Conversation

@zzx04-cool

Copy link
Copy Markdown
Contributor

Problem

When running Terminal-Bench 4.0 with agent_name='codex', evaluation fails at agent initialization with:

Invalid kwargs for agent 'codex':
  Unknown option 'max_turns'.
See harbor agent schema codex for available options.

Harbor 0.24.0 (within the supported range harbor>=0.14.0,<1.0.0) does not accept max_turns for the Codex agent. EvalScope unconditionally passes max_turns to all agents via AgentConfig.kwargs, even when the value is None (Terminal-Bench 4.0 default).

Solution

Skip passing max_turns when agent_name == 'codex', while keeping the existing behavior for all other agents (terminus-2, claude-code, qwen-coder, openhands, opencode, mini-swe-agent, oracle).

Changes

  • evalscope/benchmarks/terminal_bench/terminal_bench_adapter.py: In _on_inference(), conditionally construct agent_kwargs — empty dict for Codex, {'max_turns': self.max_turns} otherwise.

Testing

Environment

  • Runtime: Python 3.13 (logic verification)
  • OS: Windows NT (development)
  • Arch: AMD64

Verification

  1. Code inspection: The fix is a minimal conditional that only affects the agent_name == 'codex' path; all other agent configurations are byte-for-byte unchanged.
  2. Static check: No new imports, no new dependencies, no API signature changes.
  3. The fix matches the approach suggested in the issue report.

Pre-existing Failures

  • Full Terminal-Bench evaluation requires Docker + Harbor + model API credentials, which are not available in this environment. The fix is a localized parameter-filtering change that does not alter any test-covered code path for non-Codex agents.

Notes for Reviewer

  • This is a targeted compatibility fix; a more robust future improvement could introspect each Harbor agent's schema and filter unsupported kwargs generically, but that is out of scope for this PR.
  • Terminal-Bench v2/v2.1 use COMMON_EXTRA_PARAMS (max_turns default 200); v4 uses V4_EXTRA_PARAMS (max_turns default None). Both paths share the same _on_inference() method, so this fix covers all versions.

Closes #1836

Harbor 0.24.0's Codex agent schema rejects the max_turns parameter,
causing Terminal-Bench evaluation to fail at agent initialization.
Skip passing max_turns when agent_name is 'codex'; all other agents
retain existing behavior.

Closes modelscope#1836

@Yunnglin Yunnglin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yunnglin
Yunnglin merged commit d4fd71d into modelscope:main Oct 13, 2026
Yunnglin added a commit that referenced this pull request Oct 13, 2026
Trailing formatting drift from #1846: ruff-format 0.16.4 (pinned by
pre-commit) requires the single-line form; local older ruff accepted
the wrapped form, so CI --all-files flagged it.
Yunnglin added a commit that referenced this pull request Oct 13, 2026
…1.1) (#1848)

* fix(ai2d): use per-question images per official abcLabel semantics (v1.1)

The lmms-lab/ai2d dataset stores one image version per diagram, and
571/814 diagrams kept the letter-masked variant. Since abcLabel is a
per-question flag in the official release, 725 questions whose answers
are diagram text were shown masked images where that text is erased
(#1847).

Ship a corrected dataset at modelscope/evalscope/ai2d built from the
official ai2d-all.zip annotations (identical selection logic to
VLMEvalKit AI2D_TEST, source TSV MD5-verified): letter-referencing
questions get the masked image, all others the original. Bump
evaluation_version to v1.1 and encode images with the sniffed MIME
type (the new dataset is JPEG, previously hard-coded as PNG).

* fix(docs): switch benchmark description translation model to qwen-max

* style(terminal_bench): collapse agent_kwargs ternary per ruff 0.16.4

Trailing formatting drift from #1846: ruff-format 0.16.4 (pinned by
pre-commit) requires the single-line form; local older ruff accepted
the wrapped form, so CI --all-files flagged it.

* docs(ai2d): drop version-history note from benchmark description

Per review feedback: keep the evaluation notes free of v1.0-vs-v1.1
migration detail; the semantics are tracked by evaluation_version.

* fix(docs): protect fenced code blocks in README translation

Copilot review: translate_readme sent code blocks to the model with no
protection, so a translation could persist altered JSON samples and
prompt templates (observed with the ai2d zh metadata). Protect blocks
with placeholders and fail closed if the model alters one; realign the
ai2d zh docs with the metadata. Also drop the stale JPEG/PNG-mix claim
in the ai2d comment - the corrected dataset is JPEG-only.
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.

[Bug] Terminal-Bench 使用 Codex 智能体时,Harbor 0.24.0 因不支持 max_turns 参数导致评测失败

2 participants