Repository navigation
Refactor 2/4: task directories in Harbor's format, their own verifier, the bwrap backend; OfficeQA as task directories - #113
Merged
haizhongzheng merged 11 commits intoNov 19, 2026
Conversation
…ment, hermit/common The first of four stacked changes toward Harbor-format tasks run by Hermit's own agents (design: "Hermit agent 与 benchmark 重构设计", 第二阶段). Structure only: no behavior changes, the requests every agent sends are byte for byte main's. - hermit/environment/: the environments move out of hermit/agent/ to the top level, since a task declares what it needs of one and a judge may run in one; hermit.agent.environment forwards for one release. - hermit/task/: task.py becomes a package. Task holds a public half (what the acting agent is handed, what a run records as its input) and a private half only the judge reads; Benchmark is a task set and its splits; verify.py wraps a judge as a verifier of a Task. Every name importable from hermit.task before still is. - hermit/common.py: RunOutput and load_callable, shared by agents and tasks so that neither imports the other. - The run (hermit/trainer/rollout.py) hands the agent task.given() and the verifier the whole task; the trainer, eval and hermit check read a Benchmark. The validation file the learner gets holds each task's public half. - tests/core/test_layers.py: tasks and agents never import each other; the environments import neither. tests/core/test_task.py covers the new types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the row's id - judge_verifier calls the judge with Task.row() (the public half and `_private`), as run_one did before tasks were typed; the agent still gets only the public half. - Records keep the row's own id (7, not "7"); run_tasks keys its results by task. - run_one/run_tasks keep the `judge` parameter name; the Verifier protocol states `takes_task`; agent-layers.md shows hermit/environment/ beside hermit/agent/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… row's id) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ckend; OfficeQA as task directories
The second of four stacked changes (design: 第二阶段). A task set may now be a
directory of task directories in Harbor's format, run on Hermit's own sandbox
(B-class: Harbor's format, not Harbor's runtime).
- hermit/task/directory.py: Harbor's task format read without Harbor (moved from
hermit/harbor/dataset.py, which imports it): the instruction (line endings
kept), settings and metadata public; the task's directory and tests private.
Benchmark loads `data.tasks: <directory>` (`data.rollouts: k`).
- hermit/task/verify.py: a task's own verifier, `judge: {path:
hermit.task.verify, name: script}`, run in the judge's sandbox as Harbor runs
it: tests at /tests, a fresh /logs/verifier, reward.txt or reward.json, and
feedback.txt for learning methods. A judge is called with Task.row() (the row
plus `_private`); an agent still gets only the public half.
- hermit/environment/spec.py and bwrap.py: EnvironmentSpec (the run config's
`environment` section) and the bubblewrap backend the task sandbox is built
by; a task asking for more network or memory than the run gives is refused.
- examples/officeqa: the task set moves to utils/benchmark/ (prepare.py writes
task directories; judge.py, task-info/, splits, data.json, seed adapter); the
agents read each task as the row they always read (officeqa_fields.py), so the
prompts are byte for byte the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s as Harbor reads them
OfficeQA (the methods the move missed): ReHarness's launcher tests the tasks
directory; RRSI's rows (byte-identical to before on the real data) and AHE's come
from the task directories through officeqa_fields.question_rows; RRSI and AHE
score with utils/benchmark/judge.py; Harness²'s source hook reads a directory
row; OPRO shows the instruction; utils/.gitignore keeps the old paths ignored;
AHE's real-data tests find the prepared data again.
Task directories: a step's [verifier] settings come before the task's;
[verifier.env] is set for the script (${NAME} resolved as Harbor does);
reward.json takes a boolean as Harbor does; a task's [agent] timeout_sec bounds
its calls and the judge waits at least the verifier's timeout_sec; an allowlist
task's hosts and (with the script verifier) its verifier's network are checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…task-env/pr2-bwrap-tasks # Conflicts: # CHANGELOG.md # hermit/task/benchmark.py # hermit/task/verify.py
haizhongzheng
changed the base branch from
task-env/pr1-structure
to
task-environment-refactor
November 19, 2026 18:04
…rbor's verifier defaults and allowlists - data.view: <file.py>:<function> turns a task directory's row into the row the task set's agents and learners read. OfficeQA's configs view each task as SkillOpt's row, so records and what a learning method reads (GEPA, ACE, OPRO, SkillOpt) are the same as with its tasks.jsonl (246/246 on the real data); OPRO's question_field is `question` again. - What a task asks of its environment is kept in its private half (`needs`) and checked before each call (hermit.trainer.rollout asks a sandboxed agent's `refuses`), viewed or not. - As Harbor: a verifier's timeout_sec defaults to 600; [verifier.environment] implies a separate verifier; each phase's allowlist (a step's first) is its own; wildcard hosts are refused under an allowlist run (the proxy matches hosts as written). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k keeps its timeout; finite rewards - A step's verifier mode and environment are resolved as Harbor's verifier_mode.py does (explicit mode, else an environment implies separate, the step's level before the task's, else shared), and the verifier's network and allowlist come from that effective environment. - A step's tests/ are laid over the task's in the judge's sandbox (its test.sh first), as Harbor uploads them. - A task's agent timeout is kept in its needs, which the run hands the sandboxed agent, so a data.view that leaves it out of the row still bounds the call. - reward.txt must hold a finite number, as in Harbor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
… workspace and memory - A multi-step task directory is refused here (its steps share one environment in order, which a per-call sandbox does not give); PR 4 brings that. - The script verifier's workspace defaults to the directory the agent worked in, when its output names none. - A separate verifier's own memory_mb is checked against the run's limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
The second of four stacked PRs (design doc "Hermit agent 与 benchmark 重构设计", 第二阶段); based on #112, into
task-environment-refactoronce #112 is merged there. A task set may now be a directory of task directories inHarbor's format, run on Hermit's own sandbox: Harbor's task format without Harbor's runtime (the design's B class).
hermit/task/directory.py: Harbor's task format, read without Harbor (moved fromhermit/harbor/dataset.py,which imports it). A task's instruction (line endings kept), settings and metadata are its public half; its directory
and tests are private.
Benchmarkloadsdata.tasks: <directory>, withdata.rollouts: k.hermit/task/verify.pyscript: a task's owntests/test.sh, run in the judge's sandbox as Harbor runs it:/tests, a fresh/logs/verifier,reward.txtorreward.json, plus Hermit'sfeedback.txtfor learning methods(
judge: {path: hermit.task.verify, name: script, mode: shared | separate}). A task whose task.toml asks for aseparate verifier is refused under
mode: shared.hermit/environment/spec.py,bwrap.py:EnvironmentSpec(the run config'senvironmentsection) and thebubblewrap backend the task sandbox is built by (the same sandbox as before, moved out 8000 of
hermit/isolate.py). A taskasking for more network or memory than the run's environment gives is refused, never run with less.
data.view: <file.py>:<function>: a directory task's row as the row the task set's agents and learners read. Whata task asks of its environment (network per phase, allowlist hosts, memory, its agent's timeout, its verifier's
memory) is its private
needs, which the run checks and hands the sandboxed agent before each call, viewed or not.verifier_mode.py), verifiertimeout_secdefault 600,
[verifier.env]with${VAR}templates,reward.jsonbooleans, finite rewards only. A multi-step taskis refused on this path (its steps share one environment in order; PR 4).
examples/officeqa/utils/benchmark/): its task set is task directories now, beside itsprepare.py,judge.py,task-info/, splits,data.jsonand seed adapter; every config views each task as SkillOpt's row(
utils/agent/officeqa_fields.py:officeqa_task), so prompts, records and what each learning method reads areunchanged. Every OfficeQA method (GEPA, SkillOpt, ACE, OPRO, AHE, RRSI, Harness², ReHarness, ...) on the new paths.
Not in this PR: the Harbor environment backend and agents running in it (PR 3); the remaining benchmarks, LIBERO
among them (PR 4; ASPIRE's engine, shared with Robosuite, reads task rows in its simulator service and judge).
Validation
Linux (RHEL 9, x86_64), bubblewrap, non-root.
tasks.jsonlrow (246/246, key order too; 11 questions hold\r\n, kept). Splits, answers and seed adapteridentical. New test:
examples/officeqa/utils/tests/test_task_directories.py.gepa/smoke.yaml, seed skill, 4 test questions × 3, GLM 5.3 Flash, bubblewrap), with theview: 0 errors, 3/12 (PR 1's run of the old layout: 2/12; sampling). The system and user prompts each task's agent
sent are byte-identical between the two runs (4/4);
Benchmark.from_configgives every task exactly its old row(246/246, key order too). RRSI's generated rows are byte-identical to the old layout's.
tests/core/test_task_directory.py, 12 tests): the scriptverifier scores right 1 and wrong 0, reads feedback.txt, finds the agent's workspace without being told; the agent
sees neither
/testsnor_private; a separate-verifier task undermode: sharedis a judge error.pytest --changed --base origin/mainon the final headce800dca, in a clean worktree with the preparedOfficeQA data: 2075 passed, 118 skipped, 0 failed. CI: pass.
docs/build.sh, warnings as errors): clean. Lint (changed lines): clean.Users of OfficeQA re-run
utils/benchmark/prepare.py(CHANGELOG, Breaking).Review
docs/framework/task.md(Task directories),docs/recipes/officeqa.md,examples/officeqa/README.md,CHANGELOG.md.data.rolloutsinhermit/defaults.yaml).test_layers)./dual-review, this session and Codex gpt-6.1-sol, 5 rounds; 32 findings, all fixed orresolved): round 1, 17 (OfficeQA methods the move missed: ReHarness, RRSI, AHE, Harness², OPRO; step verifier
settings,
[verifier.env], reward.json booleans, task agent timeouts, the judge's deadline, allowlist hosts and theverifier's network); round 2, 7 (learners reading directory rows ->
data.view; Harbor's verifier defaults, phaseallowlists, wildcards); round 3, 5 (step verifier resolution, tests overlay, a view keeping the timeout, finite
rewards); round 4, 3 (multi-step refused, the verifier's default workspace, its memory); round 5, none.
🤖 Generated with Claude Code