Skip to content

Terminus-2: Support optional interleaved thinking - #265

Merged
alexgshaw merged 4 commits into
mainfrom
terminus/interleave-thinking
Dec 23, 2025
Merged

alexgshaw merged 4 commits into
mainfrom
terminus/interleave-thinking

Conversation

@li-boxuan

Copy link
Copy Markdown
Collaborator

Some models recommend use of interleaved thinking, e.g. MiniMax, Kimi K2 Thinking

This PR adds an optional config to Terminus-2 agent to support interleaved thinking. When enabled, previous reasoning content would be included in next rounds' messages sent to LLM.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @li-boxuan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Terminus-2 agent by adding an optional 'interleaved_thinking' capability. This feature allows the agent to leverage its own prior reasoning, provided by the LLM, by including it in the ongoing conversation history. This mechanism, inspired by advanced models, aims to improve the agent's contextual understanding and decision-making over multiple turns by feeding its internal thought process back into the LLM's input.

Highlights

  • Interleaved Thinking Feature: Introduced an optional 'interleaved_thinking' configuration for the Terminus-2 agent.
  • Reasoning Content Inclusion: When enabled, the agent will include previous reasoning content from the LLM in subsequent messages sent to the LLM, providing richer context.
  • Enhanced LLM Interaction: The 'Chat' class now conditionally adds 'reasoning_content' to assistant messages based on the 'interleaved_thinking' flag.
  • Comprehensive Testing: New integration and unit tests have been added to validate the correct behavior of the 'interleaved_thinking' feature in both the agent and LLM interaction layers.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an optional interleaved_thinking feature to the Terminus-2 agent. When enabled, it includes the reasoning content from a previous LLM response in the message history for the next turn. The implementation is sound, adding the necessary configuration flag and logic to the Terminus2 agent and the Chat class. The changes are well-supported by new unit and integration tests that correctly validate the behavior for both when the feature is enabled and disabled. My only suggestion is to refactor the integration tests to reduce code duplication and improve maintainability.

@alexgshaw
alexgshaw merged commit 322ba11 into main Dec 23, 2025
@alexgshaw
alexgshaw deleted the terminus/interleave-thinking branch December 23, 2025 06:04
crystalxyz pushed a commit to crystalxyz/harbor that referenced this pull request Dec 23, 2025
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
stared pushed a commit to QuesmaOrg/harbor that referenced this pull request Dec 24, 2025
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
Aochong-Li pushed a commit to Aochong-Li/harbor that referenced this pull request Jan 11, 2026
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
wliang-whl pushed a commit to wliang-whl/harbor that referenced this pull request Jan 13, 2026
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
wliang-whl pushed a commit to wliang-whl/harbor that referenced this pull request Jan 13, 2026
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
arafatkatze added a commit to arafatkatze/harbor that referenced this pull request Mar 5, 2026
* Update hello cuda.

* Fix typing.

* Support Azure OpenAI endpoints for LiteLLM agents (#269)

* Extend API key forwarding to support Azure OpenAI endpoints for agents that use litellm

* Add docs and whitespace

* Remove unreachable catch-all

* Use openhands model-agnostic key names

* Rename variable to avoid shadowing builtin

* Preserve prior behavior exactly

* Preserve exception

* Fix the registry.

* Do not pass host env variables to Docker environment (#272)

This is a security risk, and it also creates an inconsistent user experience for Docker compared to other environments

Proposal: adding an explicit `--rollout-env-var` CLI arg to pass environment values.

* Terminus-2: Support optional interleaved thinking (#265)

* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code

* Add initial CITATION.cff file (#260)

* feat(mini-swe-agent): pass through OPENAI_API_BASE for custom endpoints (#251)

* initial commit to enable agent setup timeout override (#247)

* fix: add Alpine Linux support for claude-code agent (#259)

* fix: add Alpine Linux support for claude-code agent

Fixes #258

Changes:
- Add distro detection in claude-code install script
  - Alpine: uses apk to install curl, bash, nodejs, npm
  - Debian/Ubuntu: uses apt-get + nvm (unchanged)
- Add hello-alpine example task

Note: Alpine-based task containers must have bash installed in their
Dockerfile for Harbor to work (Harbor uses bash for command execution).

* fix: add set -e and handle unsupported distributions

- Add set -e for early failure on errors
- Add explicit error message and exit for unsupported distros
- Add comment clarifying Alpine uses Node.js 24.x

Addresses Gemini review comments on PR #259

* fix: improve test.sh robustness

- Add set -e for early failure on setup errors
- Simplify test result checking using command as if condition
- Disable set -e for pytest to properly capture exit code

Addresses Gemini review comments on PR #259

* Update CompileBench adapter, fixing oracle on Daytona (#275)

Update the Git commit hash of CompileBench repo, fixing oracle not
passing on Daytona (previously oracle only passed when running locally
with Docker).

$ uv run harbor run --agent oracle -n 15 --dataset [email protected] --registry-path registry.json -e daytona --force-build
  15/15 Mean: 1.000 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:02:33 0:00:00
Results written to jobs/2025-12-23__12-48-21/result.json
        oracle on compilebench
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Metric              ┃ Value        ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ Agent               │ oracle       │
│ Dataset             │ compilebench │
│ Trials              │ 15           │
│ Errors              │ 0            │
│                     │              │
│ Mean                │ 1.000        │
│                     │              │
│ Reward Distribution │              │
│   reward = 1.0      │ 15           │
└─────────────────────┴──────────────┘

Note that CompileBench adapter tasks require access to internet (not
enabled by default on Daytona Tier 1/2).

* Small updates.

* Add CI gate for ruff linter on modified files (#274)

* Add CI for ruff linter

* Modify a file to showcase

* Run 1 file left unchanged

* Enable linter auto-format in vscode

* Auto formatting

* Revert "Run 1 file left unchanged"

This reverts commit 157723910c846daa2036546de1e3e0a84389de6a.

* Merge ruff checks

* style: auto-format code with ruff

* Auto lint

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* pass env variables when oracle agent executes the command (#284)

* [Adapter] GPQA-Diamond Adapter (#264)

* init gpqa

* Update GPQA Diamond adapter documentation and templates

* Update parity_experiment.json and README.md for GPQA Diamond adapter with agent, model, and accuracy metrics

* Update GPQA Diamond adapter results to use GPT-5.2 model and improve documentation

* Add GPQA-Diamond registry

* Update parity_experiment.json to enhance metrics details

---------

Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Slimshilin <[email protected]>

* revise the parity results (#292)

* Adapters: SWE-bench Pro (#249)

* swebenchpro

* Fix SWE-Bench Pro adapter and maximize oracle pass rate

Around half the tasks currently don't pass oracle. This PR fixes maximizes oracle pass rate to 99.3%. Fixes are mostly with Docker images and test harnesses.

There are 5 tasks that intrinsically cannot pass oracle (bad gold patch from original benchmark), and there are 3 long-running tasks. All documented in README.

* Address Gemini code review comments

* Fixes

* Further improve adapter

* Complete SWE-bench Pro adapter

* More parity experiment trials & updated results

* Reposition SWE-bench Pro entries in registry.json

* Remove broken and redundant autocodebench record from registry.json

* Add parity experiment per-trial details

* Auto-clone original benchmark repo and copy run_scripts/ to tmp dir (later removed)

* Also update parity experiment result table in README

* Move copy_tasks.sh to adapters/swebenchpro

* Add citation and authors information

Added citation and authors section to README.md

---------

Co-authored-by: Narek Maloyan <[email protected]>
Co-authored-by: Slimshilin <[email protected]>

* Add hr command

* Fix ruff check on fork (#313)

* Fix ruff format CI

* make a random edit to trigger ruff linter failure

* Avoid applying formatting automatically since it doesn't work on fork

* .

* Fix for fork

* Fix for fork

* Another random edit to a file

* Apply formatting as suggested

* Add smart port handling for `harbor view` (#308)

* Add smart port handling for harbor view

When port is occupied, behavior depends on --port argument:
- Single port (--port 8080): fail with clear error message
- Range (--port 8080-8090): try ports in order with feedback
- Default: tries 8080-8089 automatically

Adds proper error handling with PortInUseError and PortPermissionError
exceptions, keeping sys.exit() in CLI layer only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Use Rich for harbor view output

Adds colored, formatted output matching other CLI commands:
- Bold header, cyan labels, clickable URL link
- Yellow warnings for port scanning
- Red errors with dim hints
- Proper pluralization (1 job vs 2 jobs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Address review feedback: imports, port range consistency

- Move 'import errno' to top (PEP 8)
- Fix suggested range to match default (8080-8089, 10 ports)
- Make ports required param in start_server() (DRY)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>

* Change opencode command to output JSON format (#316)

Co-authored-by: Alex Shaw <[email protected]>

* Add override flags

* Revert to include env vars in docker. (#318)

* feat(viewer): round rewards to 4 decimal places (#319)

* made newline a requirement in prompt since small LLMs were failing (#298)

* made newline a requirement in prompt since small LLMs were failing

* Fix formatting and clarify keystrokes instructions

* updated golden tests

---------

Co-authored-by: Alex Shaw <[email protected]>

* Fix modal (and also fix lock).

* Bump versions.

* Revert modal app name.

* fix: default registry URL reference (#323)

* fix: default registry URL reference

* fix: gemini review comment

* Bump version.

* Add CLAUDE.md documentation for AI assistants (#326)

* Add CLAUDE.md documentation for AI assistants

Add comprehensive documentation explaining the Harbor codebase structure,
development workflows, key conventions, and common tasks for AI assistants
working with this repository. Also remove CLAUDE.md from .gitignore so it
can be tracked in version control.

* Update CLAUDE.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Fix formatting.

* [Adapter] Adding SWTBench Adapter (#96)

* add swtbench adapter

* Delete adapters/swtbench/uv.lock

* Delete adapters/swtbench/task_artifacts.py

* Delete adapters/swtbench/utils.py

* edit registry, update readme, update config yaml file

* add parity_experiment.json

* resolve ruff checks

* resolve gemini comments

* add registry

* remove typos

* Revise citation and add contribution details

Updated citation format and added contribution guidelines.

---------

Co-authored-by: Slimshilin <[email protected]>

* [FEATURE] Make asciinema recording optional (#276)

* optional terminal recording

* Update tmux_session.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* add guarded download before merge

* add guarded download before merge

---------

Co-authored-by: Benjamin Feuer <[email protected]>
Co-authored-by: Alex Shaw <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Bump OpenHands to 1.0.0 in tests and update gold trajectories & traces (#341)

* Fix the registry.

* [TINY] Warn user if required model_info is left unset (#336)

* Update claude_code.py to allow access to all tools (#333)

* [TINY] Increase tmux history limit (#337)

* Increase tmux history limit

* Update src/harbor/agents/terminus_2/tmux_session.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: Benjamin Feuer <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* [FEATURE] Improve LiteLLM Handling of vLLM Hosted Models  (#339)

* litellm provider canonical name

* clearer contract for vLLM hosted models in Harbor

* clearer contract for vLLM hosted models in Harbor

* clearer contract for vLLM hosted models in Harbor

* cleanup

* cleanup

* fix test

---------

Co-authored-by: Benjamin Feuer <[email protected]>

* Add get model limit utility and fix Terminus-2 error message (#350)

* Add get model limit utility and fix Terminus-2 error message

* Update src/harbor/llms/lite_llm.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Restrict environment variables passed to Oracle container (#360)

* Add include-standard-metadata option to tasks init (#359)

* Make internet configurable from task config (#327)

* feat: add support for custom environment implementations via import path (#325)

* Change -a shorthand in start-env from --agent to --all (#361)

* Fix AttributeError when accessing default environment type in CLI (#362)

* feat(registry): add Alibaba terminal-bench-pro dataset (#376)

* Fix unit test failure in lite_llm.py (#364)

* Fix unit test failure in lite_llm.py

It was caused by merge of two concurrent PRs

* Do not repeat yourself

* [Ready for Review] mmau adapter (#307)

* mmau adapter

* update parity exp

* fix issues

* update registry

* update readme

* update results

* update readme

* update readme

* update readme

* Add parity detail.

Add parity detail.

---------

Co-authored-by: Slimshilin <[email protected]>

* [Ready for Review - fixing] Adapter: Humanevalfix (#257)

* [Adapter] Humanevalfix adapter

* pass lint

* Add and test registry

* Follow the README template for the doc formatting.

* remove tmux and asciinema

* state openhands prompts in the README

* Modify parity experiment to required format

* Update commit id in registry

* pass lint

* add parity_pr

* Postgres registry (#388)

* Temp state.

* feat(registry): add GitHub Action to sync registry.json to Supabase

Add automated sync workflow that triggers when registry.json changes on main:
- Creates/updates/deletes datasets, tasks, and metrics in Supabase
- Supports dry-run mode for testing
- Uses service role key from GitHub secrets

* feat(registry): add get_datasets method and update CLI to use registry factory

- Add abstract get_datasets() method to BaseRegistryClient
- Implement get_datasets() in JsonRegistryClient (returns registry datasets)
- Implement get_datasets() in HarborRegistryClient using new get_all_datasets RPC
- Update datasets.py CLI to use create_registry_client factory
- Refactor HarborRegistryClient to use shared _parse_dataset_data helper

* refactor(registry): use Supabase select DSL instead of RPC functions

Replace get_dataset and get_all_datasets RPC calls with direct table
queries using Supabase's select DSL with nested relations. This removes
the need to create custom SQL functions in Supabase.

* refactor(registry): use junction tables for dataset-task/metric relationships

- Update sync script to diff entire dataset objects (including tasks/metrics)
- Use dataset_task and dataset_metric junction tables instead of direct FKs
- Never delete from tasks/metrics tables, only from junction tables
- Update HarborRegistryClient to query through junction tables
- Flatten junction table response for easier comparison in sync script

* refactor(registry): simplify base class by removing wrapper method

* refactor(registry): use maybe_single() for single dataset fetch

* fix(registry): update to match actual Supabase schema

Schema changes:
- Table names: dataset, task (singular)
- Composite primary keys (no id columns)
- task: (git_url, git_commit_id, path) - no name column
- dataset: (name, version)
- dataset_task: references via dataset_name/version and task_git_url/commit_id/path
- dataset_metric: has metric_name and kwargs directly (no separate metrics table)

Derive task name from path basename in harbor client.

* refactor(ci): use uv inline script metadata for sync script

* fix(registry): include task name field in schema

* refactor(registry): use RegistryClientFactory class pattern

* chore: use SUPABASE_SECRET_KEY env var name

* refactor: remove unnecessary comments

* feat(sync): add tenacity retries to database operations

* refactor(sync): use batch inserts for Supabase operations

Consolidate individual insert calls into batch operations to reduce
API calls. Collect all new tasks, datasets, dataset_tasks, and
dataset_metrics into lists, then insert them in single batch calls.

* chore: use uv add --script for dependency metadata

* fix: add assertion to satisfy type checker for Supabase client

* refactor: simplify schema - embed tasks directly in dataset_task

- Remove separate task table, tasks now stored directly in dataset_task
- Use upsert for datasets instead of separate insert/update logic
- Use get_dataset RPC function for single dataset fetch
- Leverage ON DELETE CASCADE for cleanup

* refactor(sync): use upsert for all batch operations

* fix: only clear tasks/metrics for datasets being updated

* refactor(sync): true diffing for tasks and metrics

Only insert/delete tasks and metrics that have actually changed:
- Fetch existing tasks/metrics from Supabase
- Compare with registry using set operations
- Only insert new items, only delete removed items
- Track unchanged datasets separately

* refactor(sync): extract diff_dataset function

* refactor(sync): convert to Pydantic models

- Add pydantic dependency
- Create models: Dataset, DatasetTask, DatasetMetric, DatasetDiff,
  ExistingData, SyncStats
- Add DiffStatus enum for type-safe status handling
- Use model_dump() for DB operations

* refactor(sync): add Registry models and rename to Supabase prefix

- Add RegistryTask, RegistryMetric, RegistryDataset models
- Rename ExistingData -> SupabaseData
- Rename Dataset -> SupabaseDataset
- Rename DatasetTask -> SupabaseTask
- Rename DatasetMetric -> SupabaseMetric
- load_registry now returns list[RegistryDataset]
- Organize code into sections with headers

* refactor(sync): remove get_name helper, inline logic

* refactor(sync): fetch all data in single query with nested select

* refactor(sync): embed tasks/metrics in SupabaseDataset

- SupabaseDataset now contains tasks and metrics sets directly
- Remove SupabaseData wrapper class
- fetch_supabase_datasets returns dict[key, SupabaseDataset]
- diff_dataset takes just RegistryDataset and SupabaseDataset
- Add task_keys() and metric_keys() methods to RegistryDataset

* style: format with ruff

* fix: add git_url to swtbench-verified and handle null git_commit_id

- Add git_url to swtbench-verified tasks in registry.json
- Use "HEAD" as default when git_commit_id is null
- Add python-dotenv to load .env file for local runs

* fix: add git_commit_id to swtbench-verified tasks

* Update the registry versions.

* fix: use model_config instead of deprecated class Config

* Add sync.

* Update the registry logic.

* Fix the query.

* Add registry tests.

* fix(sync): include name in task delete filter

* fix(sync): include kwargs in metric delete filter

* fix: delete tasks/metrics by ID instead of composite key

JSONB field comparison via .eq() in PostgREST can be unreliable.
Instead of filtering by composite keys including kwargs (JSONB),
we now:
- Store the id field when fetching existing data
- Compare kwargs in Python using json.dumps with sort_keys
- Delete by integer ID using .in_("id", ids)

This ensures reliable deletion regardless of JSONB comparison quirks.

* refactor: load Supabase credentials from environment variables

Load HARBOR_SUPABASE_URL and HARBOR_SUPABASE_PUBLISHABLE_KEY from
environment variables with hardcoded defaults as fallbacks. This
allows key rotation without code changes while maintaining ease
of development.

* feat: load dotenv in harbor config

* Fix the registry.

---------

Co-authored-by: Claude <[email protected]>

* LFS support.

* Remove --verbose flag from datasets list command (#394)

Display task counts by default in the datasets list output, removing the
need for the -v/--verbose flag. This simplifies the CLI and provides
more useful information upfront.

Co-authored-by: Claude <[email protected]>

* [Ready for Review - fixing] Adapter: ARC-AGI-2 benchmark (#220)

* feat(adapters): add ARC-AGI-2 benchmark adapter

Add Harbor adapter for ARC-AGI-2 abstract reasoning benchmark.

Features:
- Loads tasks from HuggingFace (Ardea/arc_agi_v2)
- Generates Harbor-compatible task directories
- Splits multi-test tasks into separate Harbor tasks
- ASCII grid visualization in instructions
- Binary reward scoring (exact grid match)
- Oracle agent support for verifier testing

Dataset: 1,000 training + 120 evaluation tasks
Source: https://github.com/arcprize/ARC-AGI-2

* fix: update arc_agi_2.yaml dataset path to correct tasks location

* feat: add compute_accuracy.py for official ARC-AGI-2 puzzle-level metric

- Aggregates 167 task results to 120 puzzle accuracy
- Matches official ARC-AGI-2 leaderboard scoring
- Puzzle passes only if ALL test pairs are correct

* refactor: integrate scoring into run_adapter.py and utils.py

- Added 'score' subcommand to run_adapter.py
- Moved scoring functions to utils.py
- Removed standalone compute_accuracy.py
- Usage: run_adapter.py score --result-path <path>

* feat: add pass@k support for official ARC-AGI-2 scoring

Official scoring (from arc-agi-benchmarking):
- Per test pair: pass@k - if ANY attempt is correct, pair passes
- Per puzzle: score = correct_pairs / total_pairs
- Overall: sum(puzzle_scores) / num_puzzles

Now reports:
- Trial-level: raw attempt counts
- Pair-level: pass@k grouped by test pair
- Puzzle-level OFFICIAL: fractional score
- Puzzle-level STRICT: all-or-nothing

* chore: set n_attempts=2 to match official pass@2 scoring

* Update ARC-AGI-2 instruction template and utils

* Update arc_agi_2.yaml: terminus-2 agent, n_concurrent_trials=24, env vars

* Set n_concurrent_trials to 8

* fix(arc_agi_2): set default config for pass@2 scoring

* Add ARC-AGI-2 parity experiment config

- Update instruction.md to match official arc-agi-benchmarking prompt
- Add parity_experiment.json for Harbor vs arc-agi-benchmarking comparison

* Update adapter_pr with arc-agi-benchmarking repo URL

* Update ARC-AGI-2 parity experiment results and instruction template

- Add parity experiment results: Harbor 37.3% vs arc-agi-benchmarking 38.9% (pass@2)
- Update instruction.md to match arc-agi-benchmarking prompt format

* Update ARC-AGI-2 parity experiment results

* Update arc_agi_2.yaml to use agentx with gpt-5.2

* Update ARC-AGI-2 adapter README and add pyproject.toml

- Rewrite README following Harbor adapter template
- Add comprehensive documentation with parity results
- Add pyproject.toml with datasets dependency

* Remove unused config.json generation from ARC-AGI-2 adapter

* Add ARC-AGI-2 adapter to registry (167 tasks)

* Update ARC-AGI-2 description to high-level benchmark overview

* update readme, registry and parity exp with the latest results

* resolve conflict

* Update registry.json

* Revert "Update registry.json"

This reverts commit afb2a29ea9e645247311941d95ed35c2e4033a33.

* style: format arc_agi_2 adapter files with ruff

* fix: remove duplicate arc_agi_2 entry and add git_commit_id to tasks

* update parity exp

---------

Co-authored-by: Horde <[email protected]>

* update arc-agi-2 parity test pr (#401)

* feat(adapters): add ARC-AGI-2 benchmark adapter

Add Harbor adapter for ARC-AGI-2 abstract reasoning benchmark.

Features:
- Loads tasks from HuggingFace (Ardea/arc_agi_v2)
- Generates Harbor-compatible task directories
- Splits multi-test tasks into separate Harbor tasks
- ASCII grid visualization in instructions
- Binary reward scoring (exact grid match)
- Oracle agent support for verifier testing

Dataset: 1,000 training + 120 evaluation tasks
Source: https://github.com/arcprize/ARC-AGI-2

* fix: update arc_agi_2.yaml dataset path to correct tasks location

* feat: add compute_accuracy.py for official ARC-AGI-2 puzzle-level metric

- Aggregates 167 task results to 120 puzzle accuracy
- Matches official ARC-AGI-2 leaderboard scoring
- Puzzle passes only if ALL test pairs are correct

* refactor: integrate scoring into run_adapter.py and utils.py

- Added 'score' subcommand to run_adapter.py
- Moved scoring functions to utils.py
- Removed standalone compute_accuracy.py
- Usage: run_adapter.py score --result-path <path>

* feat: add pass@k support for official ARC-AGI-2 scoring

Official scoring (from arc-agi-benchmarking):
- Per test pair: pass@k - if ANY attempt is correct, pair passes
- Per puzzle: score = correct_pairs / total_pairs
- Overall: sum(puzzle_scores) / num_puzzles

Now reports:
- Trial-level: raw attempt counts
- Pair-level: pass@k grouped by test pair
- Puzzle-level OFFICIAL: fractional score
- Puzzle-level STRICT: all-or-nothing

* chore: set n_attempts=2 to match official pass@2 scoring

* Update ARC-AGI-2 instruction template and utils

* Update arc_agi_2.yaml: terminus-2 agent, n_concurrent_trials=24, env vars

* Set n_concurrent_trials to 8

* fix(arc_agi_2): set default config for pass@2 scoring

* Add ARC-AGI-2 parity experiment config

- Update instruction.md to match official arc-agi-benchmarking prompt
- Add parity_experiment.json for Harbor vs arc-agi-benchmarking comparison

* Update adapter_pr with arc-agi-benchmarking repo URL

* Update ARC-AGI-2 parity experiment results and instruction template

- Add parity experiment results: Harbor 37.3% vs arc-agi-benchmarking 38.9% (pass@2)
- Update instruction.md to match arc-agi-benchmarking prompt format

* Update ARC-AGI-2 parity experiment results

* Update arc_agi_2.yaml to use agentx with gpt-5.2

* Update ARC-AGI-2 adapter README and add pyproject.toml

- Rewrite README following Harbor adapter template
- Add comprehensive documentation with parity results
- Add pyproject.toml with datasets dependency

* Remove unused config.json generation from ARC-AGI-2 adapter

* Add ARC-AGI-2 adapter to registry (167 tasks)

* Update ARC-AGI-2 description to high-level benchmark overview

* update readme, registry and parity exp with the latest results

* resolve conflict

* Update registry.json

* Revert "Update registry.json"

This reverts commit afb2a29ea9e645247311941d95ed35c2e4033a33.

* style: format arc_agi_2 adapter files with ruff

* fix: remove duplicate arc_agi_2 entry and add git_commit_id to tasks

* update parity exp

* update arc-agi-2 parity test pr

---------

Co-authored-by: Horde <[email protected]>

* [Ready for Review] Adapter: SATBench (#395)

* init SATBench

* transform to tasks in harbor

* trim task.toml and fix a path bug in verify

* update README and simplify mapping function

* Update adapters/satbench/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* add parity mode

* update timeout

* add parity experiment results

* add SATBench into registry

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* [Ready for Review - fixing] Adapter: BigCodeBench-Hard (#330)

* add bigcodebench adapter

* Update adapters/bigcodebench_hard/adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* minior fix

* Update adapters/bigcodebench_hard/run_adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* minior fix

* minior fix

* update registry

* fixes

* fix doc

* fixes

* add hf link

* fixed

* fix parity

* fix parity

* fix parity

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Slimshilin <[email protected]>

* Remove repository path setup from run_adapter.py to fix ruff error (#418)

* Remove repository path setup from run_adapter.py to fix ruff error

* use ruff format for reformatting the file

* Fix registry.json

* Format the whole repo.

* Fix messed up name.

* Fix: Remove duplicate error_msg in OutputLengthExceededError handling (#420)

* Fix: Remove duplicate error_msg in OutputLengthExceededError handling

When OutputLengthExceededError is raised in terminus_2.py, the error_msg
was being added to chat.messages twice:
1. Explicitly on line 968 via chat.messages.append()
2. Implicitly when chat.chat(error_msg) is called inside _query_llm()

The Chat.chat() method automatically appends the prompt to messages,
so the manual append was causing duplication.

This fix removes the redundant manual append, ensuring error_msg
appears only once in the conversation history.

Fixes: https://github.com/laude-institute/harbor/issues/371

Co-authored-by: openhands <[email protected]>

* Remove unit tests, keep only the fix

Co-authored-by: openhands <[email protected]>

---------

Co-authored-by: openhands <[email protected]>

* Enhance documentation and structure in CLAUDE.md and README.md (#399)

- Updated CLAUDE.md to include new agent and environment structures, detailing installed, internal, and utility agents.
- Added support for additional adapters and improved organization of existing sections.
- Corrected typographical errors in README.md for clarity.
- Introduced new workflows in CLAUDE.md for syncing dataset registries.

This commit improves the overall clarity and usability of the documentation, making it easier for users to understand the framework's capabilities.

* Viewer cost estimate with LiteLLM (#367)

* fix(viewer): show "No data" instead of "$0.0000" for unavailable cost

When cost_usd is null/unavailable, the viewer now displays "No data"
in muted gray instead of the misleading "$0.0000". A tooltip explains
"Cost data not reported by agent" on hover.

Changes:
- models.py: Changed cost_usd to float | None (None = not reported)
- data.py: Preserve None when cost not reported, accumulate only when present
- viewer.html: Display "No data" when cost_usd is null, show actual value
  (including $0.0000 for free models) when it's a number

This distinguishes between:
- cost_usd = null → "No data" (agent didn't report cost)
- cost_usd = 0.0 → "$0.0000" (free model)
- cost_usd > 0 → "$X.XXXX" (actual cost)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Add cost estimation to Harbor viewer using LiteLLM pricing

- Show "No data" instead of "$0.0000" when cost unavailable
- Estimate cost from tokens using LiteLLM's pricing database
- Display "~$X.XXXX" with "Cost (estimate from LiteLLM)" label for estimates
- Normalize model names (strip date suffixes) for LiteLLM lookup
- Include cached tokens in cost calculation for accurate estimates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Improve model name normalization for cost estimation

- Handle both Anthropic (YYYYMMDD) and OpenAI (YYYY-MM-DD) date formats
- Anchor regex to end of string to prevent false matches
- Try variants in order: exact match, provider-stripped, date-stripped

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Address code review feedback

- Move `import re` to top of file (PEP 8)
- Log warning to stderr on cost estimation failure (consistent with file patterns)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>

* update parity (#424)

Co-authored-by: Slimshilin <[email protected]>

* [Ready for Review - final discussion] Adapter: FinanceAgent (#267)

* add an adapter to support financeagent benchmark

* add parity experiment and refine the draft

* remove unnecessary args for custom agents

* add terminal version for cli agents

* update git commit id

* Revise README with new links and contributor details

Updated links and added contributor information in README.

* fix ruff error

* Codex results in addition.

---------

Co-authored-by: Slimshilin <[email protected]>

* [Ready for review - Final Review] Adapter: LAB-Bench FigQA (#201)

* Add labbench figqa code with clean branch history

* Resolve conflict at registry.json

* Revise authorship and contribution details in README

Updated author information and contribution instructions.

* Update author name in task.toml

* Update canary string in Dockerfile comments

* Ruff formatting

---------

Co-authored-by: Slimshilin <[email protected]>

* Adding swe-agent (#279)

* add swe-agent

* updates installation

* Add SWE-agent example config to repo (#242)

* Rename swe-agent-templates.yaml to swe-agent-infer-single.yaml

* Update install-swe-agent.sh.j2

* Inline swe-agent inference config (#243)

* Update swesmith_infer.yaml

* Update swesmith_infer.yaml

* test config

* temp working version

* Update swesmith_infer.yaml

* Update swe_agent.py

* Update swe-agent-infer-single.yaml

* fix config

* clean example configs

* swe-agent-lm config

* Update src/harbor/agents/installed/swe_agent.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update src/harbor/agents/installed/swe_agent.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix for installation comments

* Update test_simple_agents.py

* Update src/harbor/agents/installed/swe_agent.py

Co-authored-by: Boxuan Li <[email protected]>

* Update swe_agent.py

Addressed comments

* format

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Boxuan Li <[email protected]>

* [Ready for Review - Final Fix] Adapter: bfcl (#358)

* feat: Add BFCL adapter for simple_python

- Implement adapter for Berkeley Function Call Leaderboard
- Support simple_python category (400 tasks)
- AST-based function call evaluation
- Oracle verification: 400/400 tasks passed (100% reward)

* fix: address code review feedback

- Refactor task ID collection logic and fix --limit bug
- Use template files for task generation (reduces ~140 lines)
- Add JSON decode error logging
- Simplify condition checks and remove dead code
- Fix test.sh Docker path (/tests instead of /app/tests)

* feat: BFCL adapter with all single-turn categories

* fix: remove --break-system-packages for Java (old pip)

* fix: upgrade pip before installing pytest for Java env

* feat: increase concurrency to 150 for full run

* chore: update metadata and remove backup file

- Update README.md with correct task counts
- Update bfcl.yaml header comment to reflect all categories
- Update parity_experiment.json with oracle verification status
- Remove bfcl.yaml.bak backup file

* feat: update BFCL adapter with parity testing support

- Update adapter.py with improved evaluation logic
- Add parity sample (123 tasks) with IDs files
- Add bfcl_parity.yaml for parity testing
- Add generate_parity_sample.py for reproducibility
- Add run_parity_harbor.sh script for batch testing

* feat: update bfcl_parity config for Daytona cloud (50 concurrent)

* chore: switch to gpt-4o-mini for parity testing

* chore: remove unused script

* feat: improve instruction clarity for irrelevance detection

* Sync prompt template for parity testing

* Add BFCL parity experiment results (gpt-5-mini: 82.11% vs Harbor 78.87%)

* Revert to working prompt template (78.87% -> 8.1% issue fixed)

* Add 'Execute a command' hint to instruction template

* Align Harbor prompt with BFCL WriteFile prompt for parity

* Update parity results: Harbor 81.83%±1.22% vs BFCL 82.1% (0.27% diff)

* Add all 6 parity comparisons (3 handlers × 2 models)

* Add adapter_pr link to all parity entries

* BFCL adapter: basic cleanup, README needs update before dataset registration

* Clean up BFCL adapter: remove redundant ID file, simplify parity_experiment.json

* Clarify BFCL adapter scope: single-turn + live only (excludes multi-turn/agentic)

* Update BFCL adapter: parity results, README, and config for Daytona

* Complete local BFCL adapter modifications, pending review

* Register BFCL datasets in registry.json

* Update BFCL registry with correct commit ID

* Complete BFCL adapter - ready for review

* Update README structure and parity_experiment.json format per review

* Merge upstream registry.json

* Add bfcl and bfcl_parity to registry

* Fix ruff linting: remove unused variable, add noqa for E402

* Fix ruff F841: remove unused functions_data variable

* Apply ruff format to bfcl adapter files

* Update README

* Fix ruff linting issues

* Remove temporary helper scripts

* Add citation

---------

Co-authored-by: Slimshilin <[email protected]>

* [Ready for Review] Adapter: QCircuitBench (#351)

* [add] qcircuitbench adapter v1

* [add] github repo clone; [fix] verification script

* [add] clone github subset

* [add] robust temp repo deletion on Windows

* [add] support for single task generation

* [add] save solution.py to verifier output

* [add] configuration.yaml and task template

* [add] task difficulty

* [rename] run_qcircuitbench.yaml

* [remove] shot-count metric

* [add] README, parity experiment results, [update] registry.json

* [fix] ruff format

* Add unified exec and xhigh reasoning to codex.

* Fix ruff check error for financeagent Adapter (#434)

* add an adapter to support financeagent benchmark

* add parity experiment and refine the draft

* remove unnecessary args for custom agents

* add terminal version for cli agents

* update git commit id

* Revise README with new links and contributor details

Updated links and added contributor information in README.

* fix ruff error

* Codex results in addition.

* Sync registry.json with upstream/main

Replaced local registry.json with upstream version to avoid formatting
conflicts and ensure consistency with the main repository.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Slimshilin <[email protected]>
Co-authored-by: Claude <[email protected]>

* [Ready for review  -Final Fix] Quixbugs adapter (#346)

* quixbugs adapter init

* full oracle pass

* Update adapters/quixbugs/run_adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/quixbugs/run_adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/quixbugs/adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* align timeout

* update

* done

* add registry

* done

* t-bench --> harbor

* Update benchmark names and metrics in JSON

* Add transitive equivalence

* done

* add marker

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Slimshilin <[email protected]>

* [Ready for review - final fix] Adapter: BixBench (#154)

* vc init

* fix some of adapters

* first oracle test pass

* some clean up

* id by capsule uuid

* copy workspace

* update adapter.py

* vc Option 3: Wrap flda env as a custom server and interact through custom cli command

* Enhance nbcli functionality and update documentation

- Added logging for nbcli copy operations in adapter.py.
- Updated project description in pyproject.toml.
- Changed default value of USE_DOCKER in README.md to false.
- Removed unnecessary USE_DOCKER environment variable setting in cli.py.
- Cleaned up imports in server.py.
- Modified Dockerfile to add uv to PATH and install with --system flag.

* Update nbcli dependencies and improve installation instructions

- Updated Python version requirement in pyproject.toml to >=3.12.
- Upgraded fhda dependency to version 1.5.0 in pyproject.toml and README.md.
- Changed build backend to setuptools in pyproject.toml.
- Enhanced error handling for fhda imports in server.py with clear installation instructions.
- Modified Dockerfile to simplify installation process by removing uv and using pip directly.

* simplify

* Add nbcli server daemon and update documentation

- Introduced a new server daemon (`nbcli-server`) for persistent background operations.
- Updated `pyproject.toml` to include the new server command.
- Enhanced README.md with architecture details and server management instructions.
- Modified CLI commands for improved usage clarity and added support for JSON output.
- Updated Dockerfile to set up the server daemon and ensure it starts automatically.

* Enhance nbcli initialization and error handling

- Updated the `init` command to require both `nb_path` and `work_dir` arguments, improving usage clarity.
- Modified error messages to guide users on proper command usage.
- Enhanced the `initialize_environment` function to accept `nb_path` and raise an error if not provided.
- Adjusted command handlers to check for environment initialization and return appropriate error messages.

* Refactor nbcli response handling and update documentation

- Removed the option for human-readable output in favor of JSON format for all responses in `cli.py`.
- Updated the README.md to remove the `NB_JSON_OUTPUT` environment variable description, reflecting the change in output format.
- Simplified the response structure in `server_daemon.py` by consolidating notebook content handling.

* heuristic detect R

* Refactor nbcli to use HTTP for communication and update dependencies

- Replaced Unix socket communication with HTTP requests in `client.py`, enhancing compatibility and ease of use.
- Updated `server_daemon.py` to handle HTTP requests instead of socket connections, improving server architecture.
- Added `aiohttp` as a dependency in `pyproject.toml` to support the new HTTP server functionality.
- Modified Dockerfile to set environment variables for HTTP server configuration.

* fix prev.

* Update BixBench adapter and instructions for answer output format

- Modified `_generate_oracle_answers` method to clarify output format in `adapter.py`.
- Updated instructions in `instruction.md` to specify the creation of a plaintext file for final answers.
- Enhanced `solve.sh` to write answers directly to `/testbed/answer.txt`.
- Refactored `test_outputs.py` to read answers from the new file location instead of log files.

* cleanups

* empty notebook to begin with

* rename

* minor cleanups

* fix prev

* some clean ups

* fix ruff

* update

* rm uv.lock

* Refactor BixBench adapter for capsule handling during Docker build

- Removed obsolete capsule download methods from `adapter.py`.
- Introduced `download_capsule.py` script to manage capsule downloads and extractions during Docker build.
- Updated `Dockerfile` to include the new download script and handle capsule data extraction.
- Adjusted workspace setup to create an initial empty notebook during the build process, aligning with previous behavior.

* simplify prev. and update doc

* mop traces of hf download

* add options to use nbterm instead

* prettier output from nbcli -h

* Refactor BixBench adapter to support question-level handling

- Introduced separate loading methods for individual questions and all questions within a capsule.
- Updated BixBenchRecord to reflect question-specific attributes.
- Enhanced prompt templates for multiple-choice and open-ended questions.
- Modified instruction and solution templates to align with new question handling.
- Updated run_adapter to accept question IDs instead of task IDs for more granular control.
- Adjusted test output validation to focus on multiple-choice answers in XML format.

* Update BixBench templates to standardize workspace paths and enhance notebook usage

- Modified instruction and solution templates to direct outputs to `/workspace/answer.txt` instead of `/testbed/answer.txt`.
- Updated the Dockerfile to set the working directory to `/workspace` and copy `nbcli` there.
- Adjusted test scripts to reflect the new answer file location and ensure proper logging.
- Added instructions for initializing and using the Jupyter notebook environment with `nbcli` commands.

* Refactor BixBenchLoader and update documentation for improved clarity

- Changed question ID handling in BixBenchLoader to directly use the question's ID from the input items.
- Simplified the randomization of answer options by using the question ID for seeding.
- Revised the instruction documentation to streamline the initialization and usage of the nbcli commands.
- Updated the Dockerfile and pyproject.toml to specify exact versions for dependencies, ensuring consistency in the environment setup.

* Refactor BixBench Dockerfile and adapter to streamline script management

- Removed the copying of `download_capsule.py` and `entrypoint.sh` from local templates, now downloading them directly from GitHub in the Dockerfile.
- Updated the Dockerfile to install `nbcli` from GitHub instead of copying it, reducing local dependencies.
- Enhanced the Dockerfile to create directories and install dependencies in a single layer for better caching and efficiency.

* Simplified the loading and parsing of questions in bix adapter

* wip: adapting for llm as a judge; starting from tests and templates

* wip: adapting for llm as a judge; per capsule templates

* wip: adapting llm as a judge; add grader cascade

* had to micro average

* expose commit

* minor fixes

* fix

* reword the instructions

* wip cleanup nbcli

* wip clean up judge

* fix adapter for range verifier and add registry

* fix ruff

* openai judge (tested on bix-3)

* draft bixbench custom agent

* wip rewrite server

* wip: simplifies server and cli (nbcli for by parity exp only and not for terminal agent)

* fix serialization

* fix submit_answer

* wip: custom agent issues atomic tool calls across harbor env interface

* wip: close the agent loop buy building the next agent obs incrementally

* wip custom agent: dummy dummy_agent_get_asv

* fix custom agent import

* wip: debugging connection issue with custom agent

* wip: health handle

* wip: fix connection and read reward issues

* _dummy_get_asv runs and minor fixes

* wip: prepare for proper get_asv

* ruff format

* add parity_debug.yaml as job config

* max_steps=1 seems to work with gpt-4o

* prev.

* use llm range verifier

* upgrade custom agent to bixbench 1.5

* wip: upgrade adapter to support bixbench1.5

* fix custom agent matching tool id

* wip: misc alignment from proxy

* wip: prev

* temp remove registry

* update registry

* update readme

* update default agent

* add parity subset

* wip: refactor custom agent and server

* wip: remove old sub commands and write to answer path

* verified on bix-37-q4, more json loading try catch (seems to be connection error)

* add parity subset question ids

* wip: micro parity judge

* setting OPENAI_BASE_URL doesn't work well with docker

* add parity exp configs, reducing retries

* clean up logging outputs

* no submission should make judge error out

* wip

* update readme

* tmp remove registry

* fix prev

* bring back registry

* consistent results in parity json vs readme

* fix

* fix dataset_pr

* more notes

* tmp remove registry

* update registry

* [Ready for Review] Adapter: StrongReject (#363)

* Add StrongReject adapter

* Update code based on gemini suggestions

* Update registry.json: move info to the middle of file

* Update contribution section

* Update code based on reviewers' feedback

* update README

* fix the import error

* remove unnecessary import

* update format based on ruff test

* Remove canary string and update README

* remove redudant comments

---------

Co-authored-by: Slimshilin <[email protected]>

* fix hello-world (#438)

* Update StrongReject adapter with new registry (#446)

* update parity_experiments.json and registry

* update harbor PR link

* Bump version.

* [Ready for Review] Adapter: DS1000 (#432)

* init

* upd

* Update README

* update README

* Update according to Gemini-code-assist's suggestions

* update parity experiment

* upd registry

* update parity

* add 1 run for original eval

* fix parity_experiment.json

* fix according to gemini-code-assist' suggestions

* fix ruff errors & format of parity_experiment.json & registry.json

* fix registry

* [Ready for Review] Adapter: Ineqmath (#403)

* [WIP]: add ineqmath adapter placeholder

* Finalize ineqmath adapter: code, config, docs, registry

* Fix typos and improve clarity in README.md

* Clarify task types and reproduction steps in README

Updated README to clarify task types and reproduction steps.

* Enhance README with evaluation logic section

Added evaluation logic details for answer validation and relation types.

* Update IneqMath test_outputs

* Update registry.json for IneqMath adapter dataset commit

* Update IneqMath adapter: run script and submission formatter

* Update Readme with official submssion instruction

* Update Readme with new section order and more details for demonstration

* Update registry.json for IneqMath adapter

* update agent version in parity experiment json

* Update IneqMath registry to latest dataset commit

* update registry json

---------

Co-authored-by: Slimshilin <[email protected]>

* Make reasoning parameters configurable via kwargs (#444)

* Make reasoning parameters configurable via kwargs

- Codex: Make reasoning_effort configurable (was hardcoded to xhigh)
- Claude Code: Make max_thinking_tokens configurable (was env-only)
- OpenHands: Make reasoning_effort configurable (was env-only)

All parameters now accept kwargs with fallback to environment variables.
This allows per-job configuration without modifying agent code.

Example usage:
  agents:
    - name: codex
      kwargs:
        reasoning_effort: high
    - name: claude-code
      kwargs:
        max_thinking_tokens: 15000
    - name: openhands
      kwargs:
        reasoning_effort: medium

* Fix: Store kwargs in agent __init__ to make them accessible

- Added self._kwargs storage in Codex, Claude Code, and OpenHands
- Changed self.kwargs references to self._kwargs
- Fixes AttributeError when accessing reasoning parameters

* Address review feedback: Make kwargs explicit with type hints and defaults

- Codex: reasoning_effort: str | None = 'high'
- Claude Code: max_thinking_tokens: int | None = None
- OpenHands: reasoning_effort: str | None = 'medium'

This provides better type safety, IDE autocomplete, and sensible defaults:
- Codex defaults to 'high' (works with gpt-5-mini)
- Claude Code defaults to None (unlimited thinking tokens)
- OpenHands defaults to 'medium' (avoids 400 errors with unverified orgs)

Addresses @alexgshaw review comment.

* [Ready for Review] Adapter: Algotune (#440)

* init algotune

* add parity

* ruff fix

* fix ruff

* fix ruff

* add oracle infor and some insights in README

* fix canary string & README

* fix harmonic mean

* update dataset pr

* update commit-id

---------

Co-authored-by: Slimshilin <[email protected]>
Co-authored-by: linhaowei <[email protected]>

* [Ready for Review] Adapter: Spider2 (#436)

* Initial commit of spider2-dbt adapter with Oracle Solution Pass Rate 100%

* spider agent

* add registry and update parity_template

* Update adapters/spider2-dbt/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/spider2-dbt/adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* update parity experiment.json

* remove duplicate title

* update readme

* accelerate evaluation. Each time, there is no need to force build docker.

* fix registry.json

* fix  "uvx ruff check --fix ."

* running “uvx ruff format adapters/spider2-dbt/__init__.py adapters/spider2-dbt/adapter.py adapters/spider2-dbt/run_adapter.py adapters/spider2-dbt/spider_agent_dbt.py adapters/spider2-dbt/template/tests/test_dbt.py”

* clarify pass tasks in readme and parity_experiment.json

* remove canary string

* remove  canary string

* fix registry

* update parity for canary

* Revise maintainer details and contributions section

Updated maintainer information and added contribution guidelines.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Slimshilin <[email protected]>

* Add custom API base URL support for claude code agent (#236)

* feat: Add custom API base URL support and fix project permissions for Claude Code agent

- Add support for ANTHROPIC_BASE_URL environment variable to enable custom API endpoints
- Add CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable for controlling output limits
- Fix permission issues on project root directory using chmod before reading JSONL files
- Prioritize ANTHROPIC_MODEL environment variable over agent model_name for better flexibility
- Configure subagent and haiku models to use the same model when custom base URL is set

These changes enable Claude Code agent to work with custom API endpoints (e.g.,
proxy servers, local model servers) and resolve permission errors when accessing
project files in sandboxed environments.

* Update src/harbor/agents/installed/claude_code.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update src/harbor/agents/installed/claude_code.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* restore the _get_session_dir modification

* restore the _get_session_dir modification

* Improve Claude Code model config priority and custom API support

* uv formated

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix(claude-code): copy skills from ~/.claude/skills when CLAUDE_CONFIG_DIR is set (#459)

When Harbor sets CLAUDE_CONFIG_DIR=/logs/agent/sessions, Claude Code looks
for user skills at $CLAUDE_CONFIG_DIR/skills instead of ~/.claude/skills.

Since /logs/agent/ is mounted from the host as an empty volume, skills
copied to ~/.claude/skills in task Dockerfiles are not found.

This fix copies skills from ~/.claude/skills to $CLAUDE_CONFIG_DIR/skills
before running Claude Code, ensuring skills work consistently.

This matches the behavior of Codex, which has a fallback to ~/.codex/skills
regardless of CODEX_HOME.

* chore: pin modal sdk to `1.3.1.dev9` (#457)

* [Ready for Review] Adapter: Spider2 - Experiment with Harbor-supported agents (#452)

* add Experiment with Harbor-supported agents and small discussion on other splits (snow and lite)

* Update adapters/spider2-dbt/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/spider2-dbt/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/spider2-dbt/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update adapters/spider2-dbt/README.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix (adapter): registery (#466)

* [ready for review] bixbench-cli addition (#451)

* copied cli instructions

* minus R and jupyternotebook

* init the dockerfile-cli

* working bixbench-cli oracle

* mv cli

* simplify cot instructions

* reverse tmp

* add bixbench-cli jobs config

* add bixbench-cli results and update readme/registry

* revert registry

---------

Co-authored-by: Slimshilin <[email protected]>

* Show hints.

* feat: add secret and volume support to modal environment (#470)

* add codex trajectory.json back (#458)

* add codex trajectory.json back

* add supports-atif var

* fix ruff

* uvx format

* resolve gemini comments

* add symlink to auth.json and trap rm

* Apply suggestion from @li-boxuan

---------

Co-authored-by: TheMikeMerrill <[email protected]>
Co-authored-by: Boxuan Li <[email protected]>

* Update the version.

* Revert litellm hack for OpenHands (#475)

* Revert litellm hack for togetherAI

* Upgrade openhand to 1.1.0 in tests

* Improve terminal bench mapper functionality (#476)

* [FEATURE] Improve Terminal-Bench mapper

- Fix timeout mapping: verifier now uses max_test_timeout_sec instead of
  max_agent_timeout_sec
- Add EXTREMELY_HARD difficulty level to support terminal-bench tasks
- Map additional metadata fields: parser_name, run_tests_in_same_shell,
  disable_asciinema
- Improve reward logging: capture exit code reliably and preserve it for
  downstream tools
- Add comprehensive unit tests for the mapper (16 tests)

* Remove base image substitution logic from Terminal-Bench mapper

The mapper now preserves original Dockerfiles without modifying base
images. Terminal-Bench images should be used as-is.

* Remove all metadata properties from Terminal-Bench mapper

Simplified the mapper to only handle essential config:
- instruction, difficulty, and timeouts
- Extra fields from terminal-bench are now ignored (extra="ignore")
- Removed docker metadata tracking (is_multi_container, custom_compose, etc.)
- Methods now return void instead of metadata dicts

* Restore terminal-bench metadata while keeping internal tracking removed

Keep terminal-bench task metadata (author, category, tags, etc.) but
still exclude internal tracking metadata (moved_*, is_multi_container,
custom_docker_compose, etc.) that was used to track mapper changes.

* Remove solution.yaml support from Terminal-Bench mapper

solution.yaml is no longer supported. If a task uses solution.yaml,
the mapper now throws an error suggesting to convert it to solution.sh.

* Add warnings for unusual docker-compose configurations

Instead of storing metadata properties, print warnings for:
- Custom command (not the expected sleep infinity)
- Custom user
- Multi-container setups
- Environment variables moved to Dockerfile
- Working directory moved to Dockerfile
- Entrypoint moved to Dockerfile

* Simplify docker-compose mapper

- Remove _move_compose_fields_to_dockerfile (mixing runtime/build concerns)
- Remove _process_dockerfile and _has_env_var_reference (unused)
- Simplify _process_docker_compose: just convert services and copy Dockerfile
- Remove tests for deleted methods

* Prefer collapsing docker-compose to Dockerfile for cloud compatibility

When docker-compose can be represented as just a Dockerfile (single
container, no networks/volumes/depends_on), move env vars, working_dir,
expose, and entrypoint to the Dockerfile instead of writing a
docker-compose.yaml file. This improves compatibility with cloud
providers that work better with pure Dockerfiles.

Only write docker-compose.yaml for complex setups that require it
(multi-container, networks, volumes, etc.).

* Fix type check error in test_ignores_unknown_fields

* Refactor terminal-bench mapper for better modularity

Structure the mapper into clear sections:
- Constants: HARBOR_MAIN_SERVICE, REWARD_LOGGING_SCRIPT, COMPOSE_ONLY_KEYS
- Models: TerminalBenchTaskConfig with to_harbor_config() method
- DockerComposeProcessor: Dedicated class for compose handling
- File utilities: Standalone functions for file operations
- TerminalBenchMapper: Orchestrates the mapping process

This makes the code easier to read, test, and maintain.

* Allow default terminal-bench compose to collapse to Dockerfile

Template-only volumes (${T_BENCH_...}) are now ignored when checking
if a compose can collapse, since Harbor provides its own volume mounts.
This means the default terminal-bench docker-compose will collapse to
just a Dockerfile, improving cloud compatibility.

* Remove unnecessary comments from terminal-bench mapper

* Use whitelist approach for docker-compose collapse detection

Instead of hardcoding specific fields that prevent collapsing, use a
whitelist of allowed fields:

- DOCKERFILE_FIELDS: Can be moved to Dockerfile (environment, working_dir,
  expose, entrypoint)
- IGNORED_FIELDS: Safely ignored (build, image, container_name, command,
  template-only volumes)

Any unrecognized field (networks, depends_on, ports, user, healthcheck,
privileged, etc.) will prevent collapsing. This is safer than trying to
enumerate all compose fields that require docker-compose.

* Check for exact terminal-bench template variables

Instead of checking for any ${...} pattern, now checks for the exact
default terminal-bench volumes and environment variables:

- TBENCH_DEFAULT_VOLUMES: The two log path mounts
- TBENCH_DEFAULT_ENV: TEST_DIR=${T_BENCH_TEST_DIR}

Custom template variables or different volume mounts will not collapse.

* Use subset check for terminal-bench default volumes/env

Real terminal-bench tasks often use only one default volume mount
(${T_BENCH_TASK_LOGS_PATH}:${T_BENCH_CONTAINER_LOGS_PATH}) rather
than both. Changed from exact set match to subset check so tasks
can collapse to Dockerfile when they use any subset of the allowed
default mounts.

Tested against terminal-bench-core==0.1.1 dataset:
- Before: All 61 tasks got docker-compose.yaml (none collapsed)
- After: Only 6 tasks need docker-compose.yaml (multi-container or
  runtime features like tmpfs)

* Report both success and failure counts in task migration

The migrate command now displays both successfully migrated and
failed task counts at the end of the migration process.

Changes:
- Added MapResult class to return both mapped paths and failures
- Updated CLI to show "✓ Successfully migrated X task(s)" and
  "✗ Failed to migrate Y task(s)" messages

* Preserve non-standard compose fields in Harbor docker-compose

When a task can't collapse to Dockerfile and needs docker-compose.yaml,
we now preserve all fields from the original main service except those
that Harbor explicitly replaces (build, image, container_name, command,
environment, volumes, deploy).

This fixes issues where fields like tmpfs, networks, depends_on, ports,
healthcheck, etc. were being dropped from the mapped docker-compose.

* Check for unsupported solution.yaml before creating directories

Moved the solution.yaml check to the beginning of _map_task so that
failed tasks don't leave partial directories in the output.

* Extract _validate_task method for pre-migration checks

* Use EXIT trap for reward logging instead of appending

The previous approach appended exit code capture at the end of the
test script, which failed if the script had explicit exit commands
or additional commands after the test.

Now we insert a trap after the shebang that runs on any exit,
ensuring the reward is always written regardless of how the script
terminates.

* Simplify reward logging to append suffix instead of trap

* Replace T_BENCH_TASK_DOCKER_NAME_PREFIX with hb__ in docker-compose

* Use 'hb' instead of 'hb__' for docker name prefix replacement

* Fix tests detection to match 'COPY tests' without trailing slash

* Add ENV TEST_DIR=/tests to Dockerfile when collapsing

* [FEATURE] Improve Terminal-Bench mapper

- Fix timeout mapping: verifier now uses max_test_timeout_sec instead of
  max_agent_timeout_sec
- Add EXTREMELY_HARD difficulty level to support terminal-bench tasks
- Map additional metadata fields: parser_name, run_tests_in_same_shell,
  disable_asciinema
- Improve reward logging: capture exit code reliably and preserve it for
  downstream tools
- Add comprehensive unit tests for the mapper (16 tests)

* Remove base image substitution logic from Terminal-Bench mapper

The mapper now preserves original Dockerfiles without modifying base
images. Terminal-Bench images should be used as-is.

* Remove all metadata properties from Terminal-Bench mapper

Simplified the mapper to only handle essential config:
- instruction, difficulty, and timeouts
- Extra fields from terminal-bench are now ignored (extra="ignore")
- Removed docker metadata tracking (is_multi_container, custom_compose, etc.)
- Methods now return void instead of metadata dicts

* Restore terminal-bench metadata while keeping internal tracking removed

Keep terminal-bench task metadata (author, category, tags, etc.) but
still exclude internal tracking metadata (moved_*, is_multi_container,
custom_docker_compose, etc.) that was used to track mapper changes.

* Remove solution.yaml support from Terminal-Bench mapper

solution.yaml is no longer supported. If a task uses solution.yaml,
the mapper now throws an error suggesting to convert it to solution.sh.

* Add warnings for unusual docker-compose configurations

Instead of storing metadata properties, print warnings for:
- Custom command (not the expected sleep infinity)
- Custom user
- Multi-container setups
- Environment variables moved to Dockerfile
- Working directory moved to Dockerfile
- Entrypoint moved to Dockerfile

* Simplify docker-compose mapper

- Remove _move_compose_fields_to_dockerfile (mixing runtime/build concerns)
- Remove _process_dockerfile and _has_env_var_reference (unused)
- Simplify _process_docker_compose: just convert services and copy Dockerfile
- Remove tests for deleted methods

* Prefer collapsing docker-compose to Dockerfile for cloud compatibility

When docker-compose can be represented as just a Dockerfile (single
container, no networks/volumes/depends_on), move env vars, working_dir,
expose, and entrypoint to the Dockerfile instead of writing a
docker-compose.yaml file. This improves compatibility with cloud
providers that work better with pure Dockerfiles.

Only write docker-compose.yaml for complex setups that require it
(multi-container, networks, volumes, etc.).

* Fix type check error in test_ignores_unknown_fields

* Refactor terminal-bench mapper for better modularity

Structure the mapper into clear sections:
- Constants: HARBOR_MAIN_SERVICE, REWARD_LOGGING_SCRIPT, COMPOSE_ONLY_KEYS
- Models: TerminalBenchTaskConfig with to_harbor_config() method
- DockerComposeProcessor: Dedicated class for compose handling
- File utilities: Standalone functions for file operations
- TerminalBenchMapper: Orchestrates the mapping process

This makes the code easier to read, test, and maintain.

* Allow default terminal-bench compose to collapse to Dockerfile

Template-only volumes (${T_BENCH_...}) are now ignored when checking
if a compose can collapse, since Harbor provides its own volume mounts.
This means the default …
wliang-whl pushed a commit to wliang-whl/harbor that referenced this pull request Mar 8, 2026
* Support interleaved thinking

* Add unit test and integration test

* Fix ruff

* Reduce duplicate code
@claude claude Bot mentioned this pull request Jul 19, 2026
7 of 8 tasks
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Oct 20, 2026
…eMo#3629)

## Summary

Inkling-Small was reported at **40.17%** on Terminal-Bench 2.1 using
Gym's Terminus 2 harness, against [64.7%
published](https://huggingface.co/thinkingmachines/Inkling-Small#5-evaluations)
with a private harness. Most of the gap turned out to come from the
surrounding harness and infrastructure (stuck terminals, grading
dependencies, dropped reasoning history), not from the model. This PR
adds a reproducible Inkling-Small Terminal-Bench 2.1 recipe (listed in
the benchmark catalog with its own `manifest.yaml`) and the fixes below.

- **Results:** a full run of this work scored **59.41% (423/712)**, and
a rerun at commit `173ec922a` scored **60.34% (429/711)**, with one
attempt cancelled by the cluster scheduler (see [Rerun at the pre-merge
commit](#rerun-at-the-pre-merge-commit)). The final code (commit
`48cc31a7f`: merged `main`, terminal guidance on) scored **58.37%
(415/711)** in a full run, with one attempt (task 17, attempt 3)
cancelled while still running and no failures. All scores use the
automatic benchmark results without manual adjustments, and individual
gains come from separate comparisons that cannot be added together.
- **Scope changes along the way:** items 1 and 3 were superseded by
upstream changes that landed in `main` (NeMo Gym NVIDIA-NeMo#3549 and NVIDIA-NeMo#3983). The
branch has merged `main` and removed the PR's own versions of those.
Item 2 (terminal guidance) was dropped too, then restored once the
merged-code run showed it is worth about 5 points.

PR references below were checked on September 24, 2026, apart from NeMo
Gym NVIDIA-NeMo#3549 and NVIDIA-NeMo#3983, which come from `main`'s git history on October 7,
2026. They provide related failure reports or implementation history;
they do not establish the accuracy gains reported here or imply that
this PR's exact changes were accepted upstream. Items without a linked
PR rely on the local evidence described here.

## Changes

1. QEMU grading dependencies (superseded by upstream)

- **Problem:** Package downloads failed while preparing the two QEMU
graders.
- **Result:** The original run had 13 incomplete graders out of 16 QEMU
attempts.
- **Original solution:** The dated Debian snapshot sources recorded in
the task images were restored and the package indexes refreshed. The
first full run with that change then graded all 16 QEMU attempts, with
seven passing, and scored 41.43% overall.
- **Current state:** [NeMo Gym NVIDIA-NeMo#3549 — retain Bullseye security packages
during sandbox setup](NVIDIA-NeMo#3549),
merged September 21, 2026, fixes the same failure in sandbox setup by
redirecting the Debian Bullseye security source to a signed snapshot. On
October 7, 2026, live sandboxes for both QEMU task images (both Debian
Bullseye) were checked: with `main`'s setup alone the verifier's
`apt-get update` and `apt-get install` succeed. The branch's own QEMU
patch was therefore removed when merging `main`.
- **See:** `_BULLSEYE_SECURITY_SNAPSHOT_SETUP` in
`resources_servers/terminal_bench_2_1/app.py:36`.
- **Related PR:** [Terminal-Bench NVIDIA-NeMo#82 — repair package installation for
the two QEMU
tasks](harbor-framework/terminal-bench-2#82)
reports expired Debian package indexes and missing downloads preventing
grading. Its proposed repair switches to `archive.debian.org` and
removes the old security source; the branch's original patch restored
the dated snapshot sources recorded in the images, and `main` now uses
its own snapshot redirect. This supports the dependency-failure
diagnosis. The PR was open when checked.

2. Terminal guidance

- **Problem:** Traces showed incorrect special-key formatting and
confusion between echoed input and executed commands.
- **Result:** The model sometimes proceeded as though commands had
executed when they had not.
- **Solution:** A short message of general instructions is appended to
every task, explaining terminal controls and how to recognize that the
shell is ready. Both the 59.41% and 60.34% runs included it.
- **Current state:** kept. It was briefly dropped so the recipe's inputs
would match vanilla TB2.1 (an earlier 24-attempt diagnostic scored 13/24
passes with and without it, and upstream NVIDIA-NeMo#3983 normalizes standalone
control keys in code, which covered the one part that was a harness
bug). The full run on the merged code without it (commit `d25578c1d`)
then scored 54.60%, against 61.16% with it restored (commit `4c6c990e6`)
on otherwise identical code (+6.3 points on the 703 attempts finished in
both). That accounts for the whole drop from the pre-merge rerun. The
24-attempt diagnostic was too small to see an effect that is
concentrated in a dozen long-running tasks. The cost is that the
recipe's task inputs differ from vanilla TB2.1.
- **See:** `prepare()` in
`benchmarks/terminal_bench_2_1/prepare_inkling_small.py`, and
`normalized_rows_sha256` in
`benchmarks/terminal_bench_2_1/inkling_small_tasks.json`, which pins the
rows with the guidance appended.

3. Ctrl+C recovery (superseded by upstream)

- **Problem:** Queued terminal input was reproduced preventing correctly
formatted Ctrl+C from taking effect.
- **Result:** The requested interrupt failed to restore terminal control
in those reproductions.
- **Original solution:** Queued input was drained through a separate
execution channel after the model requested Ctrl+C, subject to
terminal-setting checks. Targeted tests demonstrated recovery from the
reproduced condition. A larger comparison showed 43.12% with recovery
off against a full-denominator bound of 45.51–45.65% with it on, but the
enabled job hit its allocation limit with one attempt missing, so that
gain is bounded, not measured.
- **Current state:** [NeMo Gym NVIDIA-NeMo#3983 — recover Terminus controls and
exited shells](NVIDIA-NeMo#3983), merged
October 7, 2026, fixes the same failure upstream. It drains cancelled
input until quiet before sending a native Ctrl-C (with a five-second
limit), normalizes standalone control keys, and recovers exited shells,
automatically for the Terminus agent. The branch's own implementation
was removed when merging `main` (`216e8ba5a`). The 60.34% rerun used the
branch's implementation, not upstream's.
- **See:** `TerminusTmuxSession` in
`responses_api_agents/terminus_2_sandboxed_agent/terminal.py` and
`NeMoGymTerminus2._execute_commands()` in
`responses_api_agents/terminus_2_sandboxed_agent/app.py`.
- **Related PR:** [Harbor NVIDIA-NeMo#1005 — bypass queued terminal input for
Ctrl+C](harbor-framework/harbor#1005) describes
Ctrl+C getting stuck behind earlier input and proposes sending interrupt
signals directly to processes. It is evidence of the same reported
symptom, not validation of any particular recovery implementation.

4. Noninteractive package installation

- **Problem:** Installations stopped at interactive configuration
prompts.
- **Result:** The package manager remained occupied waiting for input,
blocking further installation progress.
- **Solution:** Set DEBIAN_FRONTEND=noninteractive so supported package
configuration uses defaults.
- **Result:** Diagnostic checks supported using this setting to avoid
those configuration prompts.
- **See:** `sandbox_config.env.DEBIAN_FRONTEND` in
`benchmarks/terminal_bench_2_1/inkling_small.yaml:42`.

5. Hide unrelated shared storage

- **Problem:** Filesystem searches were reproduced stalling while
traversing unrelated shared S3 storage.
- **Result:** The search kept the terminal occupied instead of
completing.
- **Solution:** Give the task terminal a private filesystem view that
hides those mounts.
- **Result:** The mounts were hidden, and the complete environment
workaround improved automatic full-run accuracy from 47.89% → 52.81%
(+4.92 percentage points).
- **See:** `private_terminal_bootstrap()` in
`responses_api_agents/terminus_2_sandboxed_agent/terminal_mounts.py:57`
and `terminal_hidden_mounts` in
`benchmarks/terminal_bench_2_1/inkling_small.yaml`. Only the Inkling
recipe sets it, so other benchmarks and models are unaffected: the
agent-level default (`terminal_hidden_mounts: []`) and the shared
`benchmarks/nemotron_3.5_super/sandbox_utils.yaml` are unchanged. It
needs Linux root, user/mount namespaces and the tmux binary that
`sandbox_utils.yaml` configures, which `sbatch_external_vllm.sh` loads
automatically; running `gym eval run` without the launcher requires
adding `--config benchmarks/nemotron_3.5_super/sandbox_utils.yaml`;
without it the mount hiding has no tmux binary and every rollout fails
with `Private terminal requires tmux`.
- **Verified after merging `main`:** on October 7, 2026, the real agent
setup was run with both mounts hidden against a live sandbox. Inside the
agent's terminal `/mnt/s3-data` and `/mnt/.s3-gate` were empty (tmpfs
mounted over them), while direct sandbox execution, which is what the
grader uses, still saw the S3 data and a file the terminal wrote to
`/tmp`. Only the agent's own tmux session remained afterward.

6. Grader HTTPS certificates

- **Problem:** Grading environments could have the download tools
installed without the required trusted-certificate bundle; that
condition was reproduced.
- **Result:** HTTPS dependency downloads failed before the graders could
run their tests.
- **Solution:** Explicitly install ca-certificates during setup of the
affected graders; the patch applies to everyone's TB2.1 grading.
- **Result:** Live checks confirmed that the reproduced setup failures
were repaired.
- **See:** The two task entries in `TEST_SH_PATCHES` in
`resources_servers/terminal_bench_2_1/app.py:127`.
- **Safeguard:** these are exact-string patches, so a patch that matches
no script now logs a warning naming the task and pattern instead of
being skipped without a trace (`_upload_folder` in the same file), and a
unit test checks that every configured patch matches the pinned task
scripts. It warns instead of failing because the default benchmark
clones the task repository unpinned, so a stale patch must not zero a
task whose upstream script was fixed. This exposed a pre-existing
`mcmc-sampling-stan` patch that targeted `solution/solve.sh` from the
`tests/` table and had never applied; it now sits in the golden-patch
table, so it only affects reference-solution validation.

**Note:** with fixes 1–6 applied, the automatic accuracy was 49.58%.
That shows the result with those changes present, not that each change
contributed to the gain. Their individual contributions have not been
isolated.

7. Preserve earlier reasoning

- **Problem:** Captured requests showed that earlier reasoning was
omitted while commands and outputs remained.
- **Result:** Subsequent requests lacked the model's earlier reasoning
text.
- **Solution:** Enable the agent's interleaved_thinking setting in the
Inkling recipe while keeping the model adapter's existing reasoning
support enabled (already its default).
- **Result:** Request checks confirmed retention, and the matched full
comparison improved automatic accuracy from 49.58% → 58.57% (+8.99
percentage points).
- **See:** `interleaved_thinking` in
`benchmarks/terminal_bench_2_1/inkling_small.yaml` (the shared agent
default in
`responses_api_agents/terminus_2_sandboxed_agent/configs/terminus_2_sandboxed_agent.yaml`
stays `false`) and `uses_interleaved_reasoning` in
`responses_api_models/vllm_model/app.py:170` (already the model
default).
- **Upstream feature:** [Harbor NVIDIA-NeMo#265 — optional interleaved
thinking](harbor-framework/harbor#265), merged
December 23, 2025, introduced the option to include earlier reasoning in
subsequent model requests. This is the existing capability this PR's
configuration enables.
- **Gym integration:** [NeMo Gym NVIDIA-NeMo#3540 — wire reasoning history through
the Terminus 2 adapter](NVIDIA-NeMo#3540),
merged September 18, 2026, added the adapter support and exposed
`interleaved_thinking`, initially set to `false`. That code predates
this branch; the Inkling recipe turns it on.

## Supporting change: POV-Ray reference-solution downloads

- **Problem and solution:** The reference solution's source downloads
failed. The download locations were replaced with archived copies, and
all three archives are verified with SHA-256 checks.
- **Related PR:** [Terminal-Bench NVIDIA-NeMo#77 — archived POV-Ray downloads with
SHA-256
verification](harbor-framework/terminal-bench-2#77)
documents the original host returning HTTP 403 and supplies the archive
URLs and checksums used by this repair. The PR was open when checked.
- **Effect on accuracy:** This only repairs validation of the
benchmark's supplied reference solution. Ordinary model evaluations use
`is_verifying_golden_patch: false`, so this change contributed **no
accuracy gain** to those runs. It is separate from the seven evaluation
changes above.
- **See:**
`GOLDEN_PATCH_SOLVE_SH_PATCHES["terminal-bench/build-pov-ray"]` and
`TerminalBench21ResourcesServer.verify()` in
`resources_servers/terminal_bench_2_1/app.py`.

## Rerun at the pre-merge commit

The rerun used commit `173ec922a` on 6 nodes with 4 GPUs each, with a
vLLM 0.29.0 image built for other evaluations (see [Reproducing the
evaluation](#reproducing-the-evaluation)). 711 of the 712 attempts
finished within about 66 minutes. The cluster's scheduler then cancelled
the job 77 minutes in, while one attempt (task 42, `train-fasttext`,
attempt 5) was still running. The model servers had been nearly idle for
roughly 12 minutes beforehand (about zero requests running), which is
consistent with an idle-job policy, but the cause is unconfirmed. The
launcher did not write its aggregate metrics file, so the numbers below
come from the saved results.

| | Rerun | Earlier full run |
| --- | --- | --- |
| Automatic score | **429/711 = 60.34%** | 423/712 = 59.41% |
| If the missing attempt is counted | 60.25% (fail) to 60.39% (pass)
over 712 | n/a |
| Agent attempts completed | 708/711 | 711/712 |
| Graders completed | 707/711 | 709/712 |
| Results in the failures file | 0 | n/a |

## Validation

- **Resources server:** 44 tests pass
(`resources_servers/terminal_bench_2_1/tests/`), including `main`'s
tests and a guard that every configured patch matches the pinned task
scripts. Removing the unmatched-patch warning, or restoring the
misplaced patch, makes tests fail.
- **Recipe and configuration:** 9 tests pass
(`benchmarks/terminal_bench_2_1/tests/test_inkling_small.py`), covering
the prepared task inputs and the resolved settings in launcher order.
The 84 benchmark-catalog tests (`tests/unit_tests/test_benchmarks.py`)
pass with the new
`benchmarks/terminal_bench_2_1/inkling_small/manifest.yaml`.
- **Agent:** 86 tests pass in the agent's own environment (`gym env test
+entrypoint=responses_api_agents/terminus_2_sandboxed_agent`), including
`main`'s `test_terminal.py` and the mount tests updated for `main`'s
session code.
- **Live sandboxes (October 7, 2026, after merging `main`):** the real
agent setup with hidden mounts left both S3 mounts empty inside the
agent terminal while the grader's view kept the data, and both QEMU task
images updated and installed packages successfully without the branch's
QEMU patch.
- **Local checks:** pre-commit passes on all files.
- **Full evaluation:** the reruns above. At the final commit
`48cc31a7f`, a full run on the container in the reproduction command
scored 58.37% (415/711, one attempt cancelled while running, no
failures). Commit `4c6c990e6` (the same code before the last cleanups)
scored 58.85% (419/712) on that container and 61.16% (433/708) on
another vLLM 0.30.0 image. A baseline run of `origin/main` plus only the
recipe files scored 45.22% (322/712).

## Follow-ups

Known gaps that this PR does not address:
- **`regex-chess` grading loophole:** some attempts pass by swapping
Python's regular-expression implementation instead of satisfying the
requested regex-based solution. The grader awards the pass. It needs a
grader fix and a trace review of the passes in the reruns.

## Reproducing the evaluation

The recipe is `benchmarks/terminal_bench_2_1/inkling_small.yaml`
(catalog entry `terminal_bench_2_1/inkling_small`, described by
`benchmarks/terminal_bench_2_1/inkling_small/manifest.yaml`), launched
through `benchmarks/nemotron_3.5_super/sbatch_external_vllm.sh`, which
loads the config file directly. Requirements: the Gym virtual
environment, a valid OpenSandbox key in `env.yaml`, a vLLM image that
includes Gym built from a recent Gym commit, and sandboxes with Linux
root, user/mount namespace support and the tmux binary configured in
`benchmarks/nemotron_3.5_super/sandbox_utils.yaml`.

The launcher mounts the repository checkout as `/opt/Gym`, so do not
edit it while the job runs. The command below, with the container shown,
was used for full runs of the current code:

```bash
(
    set -euo pipefail
    source .venv/bin/activate
    INKLING_REPO=$(pwd -P)
    INKLING_RUN_NAME="inkling-small-tb21-$(date -u +%Y%m%dT%H%M%S)-$$"

    python -m benchmarks.terminal_bench_2_1.prepare_inkling_small
    mkdir -p "results/$INKLING_RUN_NAME" slurm-logs
    git rev-parse HEAD > "results/$INKLING_RUN_NAME/gym-commit.txt"

    unset SBATCH_RESERVATION SBATCH_QOS MODEL_NAME ROLLOUTS_FPATH
    unset OPENSANDBOX_DOMAIN OPENSANDBOX_API_KEY OPENSANDBOX_PROTOCOL

    MODEL=/path/to/Inkling-Small-NVFP4 \
    VLLM_CONFIG=benchmarks/nemotron_3.5_super/vllm_configs/inkling_small.sh \
    EXPERIMENT_NAME="$INKLING_RUN_NAME" \
    VLLM_MODE=aggregated \
    NUM_NODES=6 \
    SEGMENT=6 \
    SBATCH_ACCOUNT=<your Slurm account> \
    SBATCH_PARTITION=batch_long \
    SBATCH_TIMELIMIT=08:00:00 \
    SBATCH_GRES=gpu:4 \
    CONTAINER=/path/to/evaluation-image.sqsh \
    MOUNTS="/lustre:/lustre,$INKLING_REPO:/opt/Gym" \
    WANDB_MODE=disabled \
    LITELLM_LOCAL_MODEL_COST_MAP=True \
    RAY_TMPDIR=/tmp \
    bash benchmarks/nemotron_3.5_super/sbatch_external_vllm.sh \
        --config benchmarks/terminal_bench_2_1/inkling_small.yaml \
        "++model_call_capture_dir=/opt/Gym/results/$INKLING_RUN_NAME/model-calls" \
        "++route_failures_to_sidecar=true"
)
```

---------

Signed-off-by: Frankie Siino <[email protected]>
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.

2 participants