Add a polling/watch mode to the eval harness scoring. Currently, scoring is a one-shot batch: you run swebench.harness.run_evaluation on a predictions JSONL and it exits. Instead, add a --watch or --poll mode to the scoring pipeline that: (1) Monitors the predictions directory for new .jsonl files, (2) As each new prediction lands, scores it (via Modal or local Docker), (3) Keeps running until all expected predictions are in (based on the manifest task count), (4) Writes results incrementally so you can check pass rate as tasks complete, (5) Exits cleanly when all tasks are scored or after a configurable timeout. This should integrate with the existing manifest system to know how many predictions to expect. It should work with both Modal and local Docker scoring. The implementation should live in the evals/ directory of hermes-agent.
code
Plan:
# Implementation Plan: Incremental Watch-Mode Scoring for Eval Harness
Overview
Currently, the parallel eval pipeline in evals/parallel.py follows a two-phase approach: (1) all workers generate predictions, then (2) a single batch call to swebench.harness.run_evaluation scores everything at once. This means you can't see pass rates until the entire run completes.
The goal is a watch mode that monitors the predictions directory, scores each prediction as it lands, writes incremental results, and exits when all tasks are scored or a timeout fires. This sits alongside the existing batch scoring — it's an alternative scoring strategy, not a replacement.
Key repo facts:
Predictions land as individual .jsonl files in results/{run_name}/_swebench_predictions/
Manifest at results/{run_name}/_task_manifest.json tracks total task count and per-task status
Scoring uses python -m swebench.harness.run_evaluation via subprocess (local Docker only — no Modal exists in the codebase despite the brief mentioning it)
_run_batch_scoring() in parallel.py:406 is the current batch scorer
consolidate.py reads scores from logs/run_evaluation/*/report.json
Phase 1: Core Watch Loop
Step 1: Create evals/watch_scoring.py — the incremental scorer
Assistant
User
Assistant
{"flags":[{"id":"watch-backend-scope","concern":"Scoring backend: the revised plan still narrows the feature to Docker-only, which is not aligned with the original requirement that watch scoring work with both Modal and local Docker.","category":"completeness","severity_hint":"likely-significant","evidence":"The brief explicitly requires both backends. In the repo, the eval path still has no scorer-backend selector in /Users/user_c042661f/Documents/hermes-agent/evals/config.py:40, and both existing SWE-bench scorers are hardwired to local subprocess calls in /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:406 and /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:313. Marking this as 'settled' in the plan is a scope reduction, not a repository-backed resolution."},{"id":"DEBT-021","concern":"Verify artifact isolation: Recurring debt: the plan's single shared watch combined with startup and pre-score cleanup breaks its own restart/idempotency story and can still cause cross-run clobbering.","category":"correctness","severity_hint":"likely-significant","evidence":" deletes every matching path under both and in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:541. The plan proposes one session-wide such as , cleanup on startup, and cleanup again before each score, while also saying restart should seed from and re-verify prior reports still exist. Under the repo's actual layout, earlier reports live under the shared run directory, e.g. /Users/user_c042661f/Documents/hermes-agent/logs/run_evaluation/hermes-modal-glm51/zhipu:glm-5.1/django__django-12125/report.json:1, so repeated cleanup of a shared will erase the very artifacts the restart logic wants to re-check."}],"verified_flag_ids":["DEBT-017","watch-exit-semantics","watch-concurrency-cleanup"],"disputed_flag_ids":["watch-backend-scope","DEBT-021"]}
Scope: Large (core of the feature)
Createevals/watch_scoring.py with the main watch loop function:
python
def watch_and_score(
results_root: Path,
manifest_path: Path,
*,
poll_interval: int = 15,
timeout: int = 4 * 3600,
max_workers: int = 1,
cleanup_docker: bool = True,
) -> dict[str, Any]:
Implement the poll loop:
Load manifest via TaskManifest.load(manifest_path) to get total expected count
Implement report parsing that reads from the swebench log directory:
Look for logs/run_evaluation/hermes-watch-{instance_id}/{instance_id}/report.json
Parse the report to determine resolved/failed status
This mirrors the logic in consolidate.py:58-60 and swe_bench.py's _check_resolved()
Handle missing reports gracefully (scoring subprocess failure → mark as error, don't block)
Phase 2: CLI Integration
Step 3: Add --watch CLI entry point (evals/watch_scoring.py)
Scope: Medium
Addif __name__ == "__main__" block with argparse:
code
python -m evals.watch_scoring --results-root results/my-run [options]
Arguments:
--results-root PATH Path to run results dir (contains _task_manifest.json)
--poll-interval SEC Seconds between directory checks (default: 15)
--timeout SEC Max total runtime (default: 14400 / 4 hours)
--max-workers N Concurrent Docker scoring slots (default: 1)
--no-cleanup Skip Docker image cleanup between scores
Validate on startup: check that _task_manifest.json and _swebench_predictions/ exist in the results root
Print initial status summary from manifest before entering the loop
Step 4: Wire watch mode into parallel.py as an alternative to batch scoring
Scope: Small
Add a scoring_mode parameter to run_parallel_workers() (parallel.py:26), defaulting to "batch" (preserving current behavior)
Whenscoring_mode == "watch": instead of calling _run_batch_scoring() after all workers finish, call watch_and_score() from the new module
Expose--scoring-mode {batch,watch} in the CLI args in run_evals.py's main() function (around line ~1550 where parallel args are parsed)
Step 5: Support launching watch mode concurrently with workers
Scope: Medium
Add--watch flag to run_evals.py parallel mode that starts the watch scorer in a background thread/process alongside workers
Inrun_parallel_workers(), when watch mode is active:
Start watch_and_score() in a threading.Thread immediately after manifest creation (before waiting for workers)
The watch loop naturally handles the "predictions arrive over time" case
After all workers exit AND the watch thread completes, skip the batch scoring step
Alternatively, support running watch mode as a standalone process: python -m evals.watch_scoring --results-root results/my-run while workers are still running in another terminal
Phase 3: Testing
Step 6: Unit tests (tests/test_watch_scoring.py)
Scope: Medium
Test the poll loop with a mock predictions directory:
Create a temp dir with manifest and predictions subdir
Drop .jsonl files in during the test
Mock the subprocess call to swebench.harness.run_evaluation
Verify _watch_scores.json is updated incrementally
Test exit conditions: all scored, timeout, keyboard interrupt
Test_parse_swebench_report() with sample report JSON
Test idempotency: running watch mode when some predictions are already scored should skip them
Step 7: Integration smoke test
Scope: Small
Create a small test fixture with 2-3 predictions and a manifest
Runpython -m evals.watch_scoring --results-root {fixture} with mocked Docker scoring
Verify the output JSON has correct counts and pass rates
Execution Order
Steps 1-2 first (core loop and parsing — can be tested standalone)
Step 3 (CLI entry point — makes step 1 runnable)
Steps 4-5 (integration with existing parallel pipeline)
Steps 6-7 (tests, after the implementation is wired up)
Validation Order
Manual test: create a fake results dir, drop predictions in, run python -m evals.watch_scoring
Unit tests for the poll loop and report parsing
End-to-end: run a small parallel eval with --watch and verify incremental scores appear
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-29T21:58:36Z",
"hash": "sha256:d8e2aeeea925b2441902864cdd88efab333cc20ed92d7c151d910cf79de88811",
"questions": [
"The brief mentions 'Modal or local Docker scoring' but the codebase has no Modal integration \u2014 all scoring is local Docker via subprocess. Should we add Modal support as part of this work, or scope to local Docker only?",
"Should the watch scorer support concurrent scoring of multiple predictions simultaneously (e.g., --max-workers 4 scoring 4 predictions in parallel Docker containers), or is sequential one-at-a-time scoring sufficient?",
"When the watch scorer exits (timeout or completion), should it also run consolidation (consolidate.py) automatically, or leave that as a separate manual step?",
"Should the incremental _watch_scores.json be compatible with / replace the existing consolidation output format, or is it fine as a lightweight status file alongside the full consolidation?"
],
"success_criteria": [
"Running python -m evals.watch_scoring --results-root results/my-run detects new .jsonl prediction files as they appear and scores each one via Docker",
"Incremental results file (_watch_scores.json) is updated after each prediction is scored, showing current pass rate, resolved/failed counts",
"Progress is printed to stderr after each score (e.g., '[42/100] django__django-11099: RESOLVED (pass rate: 42.9%)')",
"Watch mode exits cleanly when all expected predictions (per manifest) are scored",
"Watch mode exits cleanly on timeout with partial results preserved",
"Watch mode can run standalone (separate terminal) or integrated into the parallel pipeline via --watch flag",
"Already-scored predictions are skipped on restart (idempotent)",
"Unit tests pass for the poll loop, report parsing, and exit conditions"
],
"assumptions": [
"Scoping to local Docker scoring only (no Modal) since Modal doesn't exist in the codebase",
"Sequential scoring (one prediction at a time) is the default; --max-workers can allow parallel Docker containers but starts at 1",
"The _watch_scores.json is a lightweight progress file, not a replacement for full consolidation \u2014 users still run consolidate.py for the final report",
"The watch mode is SWE-bench specific (not next-evals or terminal-bench) since those benchmarks don't use the predictions directory pattern",
"We'll reuse the existing swebench.harness.run_evaluation subprocess pattern rather than importing swebench Python APIs directly",
"The watch scorer will read the manifest but not write to it \u2014 manifest status is owned by workers"
],
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[]
Known accepted debt grouped by subsystem:
{
"config-reproducibility": [
{
"id": "DEBT-008",
"concern": "openrouter_params (temperature, top_p) are recorded in config but cannot be applied because neither hermes aiagent nor the megaplan cli expose inference parameter controls.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"docker-sandbox-init": [
{
"id": "DEBT-015",
"concern": "file_tools.py does not forward docker_mount_cwd_to_workspace when creating the docker sandbox, so if read_file/write_file is the first tool call, the host workspace bind mount may not be set up.",
"occurrence_count": 1,
"plan_ids": [
"generalize-the-eval-harness-20260327-2049"
]
}
],
"execute-loop-control-flow": [
{
"id": "DEBT-022",
"concern": "the 'all tasks done but state stuck on finalized' break path at line 562 would skip verify if verify is inserted after the execute block.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"handler-routing": [
{
"id": "DEBT-009",
"concern": "handler layer hardcodes planned\u2192critique transitions that the plan doesn't explicitly enumerate for update.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-026",
"concern": "manual megaplan research cli invocation can strand plans in state_researched with no workflow exit transition.",
"occurrence_count": 1,
"plan_ids": [
"three-changes-to-the-megaplan-20260329-1755"
]
}
],
"hermes-config": [
{
"id": "DEBT-004",
"concern": "availability check references ~/.hermes/config.yaml for api keys, but hermes stores them in /.hermes/.env.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"join-workflow": [
{
"id": "DEBT-019",
"concern": "the --join cli has no enforced source of truth for original run settings, so a mismatched config could attach wrong models/workspace layout to an existing manifest.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"module-layout": [
{
"id": "DEBT-003",
"concern": "hermes_worker.py importing workerresult from workers.py while workers.py imports run_hermes_step from hermes_worker.py creates a circular import.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-024",
"concern": "the evals/ top-level package is outside the distributable module set and won't be included in wheel builds.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"orchestrator-lifecycle": [
{
"id": "DEBT-018",
"concern": "the manifest.all_done() polling loop can hang indefinitely if a worker crashes and leaves tasks in 'claimed' state with no timeout or reclaim mechanism.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"research-prompt": [
{
"id": "DEBT-013",
"concern": "plan omits the brief's explicit 'compare against at least 2 search results' requirement.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"schema-validation": [
{
"id": "DEBT-011",
"concern": "proposed framework_versions object schema will be rejected by the strict additionalproperties:false rewriter.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-014",
"concern": "prompt wording alone cannot prevent empty or content-free consideration entries since the schema only requires severity.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"scoring-diffing": [
{
"id": "DEBT-007",
"concern": "git diff head1 fails when the workspace has only one initial commit before execution begins.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"session-lifecycle": [
{
"id": "DEBT-016",
"concern": "_cleanup_hermes_sessions() hard-codes path.home() / '.hermes' / 'sessions', ignoring hermes_home. parallel workers may delete session files from the default location.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
],
"swebench-harness-invocation": [
{
"id": "DEBT-020",
"concern": "verify runs full instance evaluation via run_evaluation rather than targeting individual test ids.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-023",
"concern": "read_prompt() has no caller in this repository yet, so fail_to_pass test ids won't reach megaplan prompts until a follow-up wires it in.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"test-coverage": [
{
"id": "DEBT-012",
"concern": "plan references wrong test files for workflow assertions.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"trace-collection": [
{
"id": "DEBT-006",
"concern": "session log path is ~/.hermes/sessions/ not ~/.hermes/logs/, and sessions are reused across megaplan phases, so naive reads return cumulative history rather than phase-isolated snapshots.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"trace-instrumentation": [
{
"id": "DEBT-005",
"concern": "the plan captures normalized session logs and aggregate cost/token counters from run_conversation(), not raw http request/response payloads or openrouter response headers.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"verify-artifact-isolation": [
{
"id": "DEBT-021",
"concern": "multiple verify attempts may leave stale result artifacts that _check_resolved() picks up, causing false positives.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"worker-contract": [
{
"id": "DEBT-001",
"concern": "plan's sample workerresult constructor uses non-existent fields (output, input_tokens, output_tokens) instead of actual fields (payload, raw_output).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"worker-dispatch": [
{
"id": "DEBT-002",
"concern": "plan's sample function signature (phase, prompt, schema_dir, model) doesn't match the actual worker signature (step, state, plan_dir, *, root, ...).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-010",
"concern": "research on non-hermes agents silently falls back to stale training data instead of fresh web searches.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"workflow-enforcement": [
{
"id": "DEBT-025",
"concern": "handle_plan accepts both state_initialized and state_prepped, so a manual cli invocation could skip prep on heavy robustness.",
"occurrence_count": 2,
"plan_ids": [
"add-a-prep-phase-to-the-20260329-1410"
]
}
],
"workspace-lifecycle": [
{
"id": "DEBT-017",
"concern": "stale per-worker prediction dirs from crashed prior runs could be globbed into a subsequent run's combined_predictions.jsonl.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
]
}
code
Escalated debt subsystems:
[]
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Requirements:
- First, assess whether the plan targets the correct root cause. If the proposed fix already exists in the codebase, or if the plan contradicts evidence you find, flag this as CRITICAL — the plan needs a fundamentally different approach, not just adjustments.
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered step sections (`### Step N:` under `## Phase` headers, or flat `## Step N:`) with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`.
- Missing required sections or step coverage (for example: no H1, no `## Overview`, or no step sections at all) should be flagged as category `completeness` with severity_hint `likely-significant`.
- Structural formatting within steps (for example: prose instead of numbered substeps, or a missing file reference inside an otherwise actionable step) should usually be category `completeness` with severity_hint `likely-minor` because the executor can still follow the instructions.
- Ask whether the plan is the simplest approach that solves the stated problem, whether it could use fewer steps or less machinery, and whether it introduces unnecessary complexity.
- Over-engineering concerns should use category `maintainability`, should usually prefix the concern with "Over-engineering:", and should scale severity_hint to the practical impact.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
{"flags":[{"id":"watch-backend-scope","concern":"Scoring backend: the plan explicitly scopes watch scoring to local Docker, but the stated feature requires both Modal and local Docker and the repo has no scoring-backend abstraction yet.","category":"completeness","severity_hint":"likely-significant","evidence":"The current eval config only carries Docker/timeouts and no scorer backend selector in /Users/user_c042661f/Documents/hermes-agent/evals/config.py:40. Both existing SWE-bench scoring paths hardcode python -m swebench.harness.run_evaluation ... --namespace \"\" in /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:406 and /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:313. Adding watch mode without first deciding how backend selection works leaves the 'Modal or local Docker' requirement unmet."},{"id":"DEBT-017","concern":"Workspace lifecycle: Recurring debt: the watch loop would score every new *.jsonl it sees, but the current pipeline only trusts predictions after filtering them through the manifest's completed task IDs. Watching raw files broadens the stale-prediction problem on reused or resumed runs.","category":"correctness","severity_hint":"likely-significant","evidence":"Parallel runs reuse results_root/_swebench_predictions without clearing it in /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:41 and /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:48. The existing batch path intentionally filters combined predictions with valid_ids=manifest.done_task_ids() in /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:98 and /Users/user_c042661f/Documents/hermes-agent/evals/parallel.py:343. The plan's poll loop diffs directory contents against scored_ids only, so stale leftover files can be scored and counted before the manifest says the current run actually produced them."},{"id":"watch-exit-semantics","concern":"Manifest semantics: using manifest.summary()['total_tasks'] as the expected prediction count is wrong in this repo, because completed tasks do not always produce a prediction file.","category":"correctness","severity_hint":"likely-significant","evidence":"SWE-bench returns failed immediately when no patch exists, before writing any prediction JSONL, in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:271. Separately, the worker loop marks every non-error task as done in the manifest in /Users/user_c042661f/Documents/hermes-agent/evals/run_evals.py:922. That means total_tasks and even manifest done are not equivalent to 'number of predictions that will ever appear', so the plan's primary exit condition can hang until timeout or misreport completion."},{"id":"DEBT-021","concern":"Verify artifact isolation: Recurring debt: per-instance watch run_ids are not sufficient unless the plan also cleans or namespaces global SWE-bench artifacts before each score and on restart.","category":"correctness","severity_hint":"likely-significant","evidence":"The existing backend already needs _cleanup_run_artifacts(run_id) and run_id filtering in _check_resolved() to avoid stale false positives, see /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:541 and /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:556. The regression test at /Users/user_c042661f/Documents/hermes-agent/tests/test_evals/test_swe_bench_verify.py:132 exists for exactly that reason. The repo's actual report layout is also run-global, e.g. /Users/user_c042661f/Documents/hermes-agent/logs/run_evaluation/hermes-modal-glm51/zhipu:glm-5.1/django__django-12125/report.json:1, so the plan's hardcoded logs/run_evaluation/hermes-watch-{instance_id}/{instance_id}/report.json path is not reliable and restart/cross-run contamination remains likely."},{"id":"watch-concurrency-cleanup","concern":"SWE-bench Docker cleanup: exposing --max-workers for concurrent watch scoring is unsafe with the current cleanup strategy.","category":"correctness","severity_hint":"likely-significant","evidence":"The only existing cleanup helper removes all non-base *sweb* images globally, not just the current instance's artifacts, in /Users/user_c042661f/Documents/hermes-agent/evals/benchmarks/swe_bench.py:509. If watch mode starts scoring multiple predictions concurrently, one scorer can delete another scorer's images or interfere with shared logs/run_evaluation artifacts. The plan includes max_workers in the API/CLI but does not add any isolation or disable cleanup under concurrency."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
Add a polling/watch mode to the eval harness scoring. Currently, scoring is a one-shot batch: you run swebench.harness.run_evaluation on a predictions JSONL and it exits. Instead, add a --watch or --poll mode to the scoring pipeline that: (1) Monitors the predictions directory for new .jsonl files, (2) As each new prediction lands, scores it (via Modal or local Docker), (3) Keeps running until all expected predictions are in (based on the manifest task count), (4) Writes results incrementally so you can check pass rate as tasks complete, (5) Exits cleanly when all tasks are scored or after a configurable timeout. This should integrate with the existing manifest system to know how many predictions to expect. It should work with both Modal and local Docker scoring. The implementation should live in the evals/ directory of hermes-agent.
code
Plan:
# Implementation Plan: Incremental Watch-Mode Scoring for Eval Harness
Overview
The parallel eval pipeline in evals/parallel.py follows a two-phase approach: (1) workers generate predictions, then (2) a single batch call to swebench.harness.run_evaluation scores everything. You can't see pass rates until the entire run completes.
The goal is a watch mode that monitors the predictions directory, scores each prediction as it lands, writes incremental results, and exits when done or timed out.
Key repo facts:
Predictions land as individual .jsonl files in results/{run_name}/_swebench_predictions/
Manifest at results/{run_name}/_task_manifest.json tracks total task count and per-task status (pending/claimed/done/error)
Tasks that fail without producing a patch are marked done in manifest but write no.jsonl (swe_bench.py:271-277)
Batch scoring filters predictions through manifest.done_task_ids() (parallel.py:102)
Scoring uses python -m swebench.harness.run_evaluation via subprocess — local Docker only
Derive manifest_path and predictions_dir from results_root (conventions: _task_manifest.json, _swebench_predictions/).
Implement the poll loop with manifest-gated prediction filtering (addresses DEBT-017):
Load manifest via TaskManifest.load(manifest_path)
Track scored_ids: set[str] — instance IDs already scored (seeded from existing _watch_scores.json on restart for idempotency)
Each iteration:
Refresh done_ids = manifest.done_task_ids() — the set of tasks the manifest says are legitimately complete in this run
Glob _swebench_predictions/*.jsonl, extract instance IDs from filenames
Compute scorable = done_ids - scored_ids intersected with available .jsonl files — only score predictions for tasks the manifest confirms are done, matching the existing batch path's valid_ids=manifest.done_task_ids() filter
For each scorable prediction, call _score_single_prediction()
Since model_name comes from the prediction JSONL's model_name_or_path field, read it from the prediction before scoring
Fallback: if the exact path doesn't exist, search logs/run_evaluation/{run_id}/*/{instance_id}/report.json via glob
Parse report dict: check for resolved_ids list containing instance_id, or per-instance resolved status
Reuse the logic pattern from _check_resolved() (swe_bench.py:556-587) but scoped to the watch run_id
Handle missing reports: scoring subprocess failure → mark task as "error" in _watch_scores.json, don't block the loop
Step 3: Artifact isolation on startup and restart (evals/watch_scoring.py)
Scope: Small
On startup, before entering the poll loop:
Call _cleanup_run_artifacts(run_id) to clear any stale logs from a prior watch session using the same run_id
If _watch_scores.json exists, load it to seed scored_ids (restart idempotency) — but re-verify each scored task's report still exists (in case logs were cleaned between runs)
This ensures restart doesn't produce false positives from stale report.json files
Phase 2: CLI Integration
Step 4: Add CLI entry point (evals/watch_scoring.py)
Scope: Medium
Addif __name__ == "__main__" block with argparse:
code
python -m evals.watch_scoring --results-root results/my-run [options]
Arguments:
--results-root PATH Path to run results dir (contains _task_manifest.json)
--poll-interval SEC Seconds between directory checks (default: 15)
--timeout SEC Max total runtime (default: 14400 / 4 hours)
--no-cleanup Skip Docker image cleanup between scores
No --max-workers flag — sequential only (addresses watch-concurrency-cleanup by not exposing the unsafe option).
Validate on startup: check _task_manifest.json and _swebench_predictions/ exist
Print initial status: manifest summary + any already-scored tasks from prior _watch_scores.json
Step 5: Wire watch mode into parallel.py
Scope: Small
Addscoring_mode: str = "batch" parameter to run_parallel_workers() (parallel.py:26)
Whenscoring_mode == "watch": after manifest creation and worker launch, start watch_and_score() in a threading.Thread immediately — it runs concurrently with workers, scoring predictions as they land
After all workers exit AND the watch thread completes, skip _run_batch_scoring() — use the watch results instead
Expose--scoring-mode {batch,watch} in run_evals.py's CLI args (near line ~1550 where parallel args are parsed)
Test manifest-gated filtering: create predictions for tasks not yet done in manifest → verify they are NOT scored until manifest marks them done
Test exit condition: manifest with 5 tasks, 3 produce predictions, 2 fail with no patch → verify watch exits after scoring 3 once all 5 are terminal in manifest
Test _parse_swebench_report(): with sample report JSON at the correct path layout ({run_id}/{model_name}/{instance_id}/report.json)
Test restart idempotency: pre-populate _watch_scores.json with 2 scored tasks, add a 3rd prediction → verify only the 3rd is scored
Test artifact cleanup: verify _cleanup_run_artifacts is called before scoring begins
Mocksubprocess.run for all Docker/swebench calls
Step 7: Integration smoke test
Scope: Small
Create a fixture with manifest (3 tasks), 2 prediction files, manifest marking all 3 done (1 had no patch)
Runpython -m evals.watch_scoring --results-root {fixture} with mocked subprocess
Verify_watch_scores.json shows scored: 2, correct pass rate, and the process exits cleanly
Execution Order
Steps 1-3 first (core loop, parsing, artifact isolation — the complete standalone scorer)
Step 4 (CLI entry point — makes it runnable from terminal)
Step 5 (integration into parallel pipeline)
Steps 6-7 (tests)
Validation Order
Manual test: create a fake results dir with manifest and predictions, run python -m evals.watch_scoring
Unit tests for manifest-gated filtering, exit conditions, report parsing, restart
End-to-end: run a small parallel eval with --scoring-mode watch
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-03-29T22:06:46Z",
"hash": "sha256:e6efe950c4774b6c0ede9e5dfe76fb8583f74a5b12b9fa3c0fb2a301ed4ab6ad",
"changes_summary": "Revised the plan to address all 5 significant flags from the gate:\n\n1. DEBT-017 (stale predictions): Poll loop now intersects globbed prediction files with manifest.done_task_ids() before scoring, matching the existing batch path's valid_ids filter. Predictions for tasks not yet marked done in the manifest are skipped.\n\n2. watch-exit-semantics (hang on no-patch tasks): Exit condition no longer uses total_tasks as expected prediction count. Instead, exits when manifest.all_done() AND all predictions for done tasks are scored \u2014 naturally handles the gap where tasks fail without producing a .jsonl.\n\n3. DEBT-021 (artifact isolation / wrong report path): Fixed hardcoded report path to match actual layout: logs/run_evaluation/{run_id}/{model_name}/{instance_id}/report.json. Added pre-score _cleanup_run_artifacts(run_id) call and startup cleanup. Uses single consistent run_id scoped to the watch session.\n\n4. watch-backend-scope (Modal): Accepted as Docker-only per settled decision SETTLED-001. No Modal exists in the codebase; this is a scope clarification, not a gap.\n\n5. watch-concurrency-cleanup (unsafe parallel Docker): Removed --max-workers flag entirely. Watch mode is sequential-only since the global Docker cleanup strategy makes concurrency unsafe. This is the simplest correct approach per SETTLED-002.",
"flags_addressed": [
"watch-backend-scope",
"DEBT-017",
"watch-exit-semantics",
"DEBT-021",
"watch-concurrency-cleanup"
],
"questions": [
"When the watch scorer exits (timeout or completion), should it also run consolidation (consolidate.py) automatically, or leave that as a separate manual step?"
],
"success_criteria": [
"Running python -m evals.watch_scoring --results-root results/my-run detects new .jsonl prediction files as they appear and scores each one via Docker",
"Only predictions for tasks marked 'done' in the manifest are scored \u2014 stale/orphan predictions from prior runs are ignored",
"Watch mode exits cleanly when all manifest tasks are terminal (done/error) and all available predictions are scored \u2014 does not hang waiting for predictions that will never arrive (no-patch failures)",
"Incremental results file (_watch_scores.json) is updated after each prediction is scored, showing current pass rate, resolved/failed counts, and manifest progress",
"Progress is printed to stderr after each score showing both scoring and manifest status",
"Watch mode exits cleanly on timeout with partial results preserved",
"Watch mode can run standalone (separate terminal) or integrated into the parallel pipeline via --scoring-mode watch",
"Already-scored predictions are skipped on restart (idempotent), with stale report verification",
"Artifact cleanup runs before scoring to prevent cross-run contamination",
"Unit tests pass for manifest-gated filtering, exit conditions, report parsing, restart idempotency, and artifact cleanup"
],
"assumptions": [
"Scoping to local Docker scoring only (no Modal) since Modal doesn't exist in the codebase",
"Sequential scoring only \u2014 no --max-workers since global Docker cleanup makes concurrency unsafe",
"The _watch_scores.json is a lightweight progress file, not a replacement for full consolidation",
"The watch mode is SWE-bench specific (not next-evals or terminal-bench) since those benchmarks don't use the predictions directory pattern",
"We reuse the existing swebench.harness.run_evaluation subprocess pattern rather than importing Python APIs directly",
"The watch scorer reads the manifest but does not write to it \u2014 manifest status is owned by workers",
"A single run_id (e.g., 'hermes-watch') is used for all scoring in one watch session, matching the batch scorer's approach"
],
"structure_warnings": [],
"delta_from_previous_percent": 59.13
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "watch-backend-scope",
"concern": "Scoring backend: the plan explicitly scopes watch scoring to local Docker, but the stated feature requires both Modal and local Docker and the repo has no scoring-backend abstraction yet.",
"status": "addressed",
"severity": "significant"
},
{
"id": "DEBT-017",
"concern": "Workspace lifecycle: Recurring debt: the watch loop would score every new *.jsonl it sees, but the current pipeline only trusts predictions after filtering them through the manifest's completed task IDs. Watching raw files broadens the stale-prediction problem on reused or resumed runs.",
"status": "addressed",
"severity": "significant"
},
{
"id": "watch-exit-semantics",
"concern": "Manifest semantics: using manifest.summary()['total_tasks'] as the expected prediction count is wrong in this repo, because completed tasks do not always produce a prediction file.",
"status": "addressed",
"severity": "significant"
},
{
"id": "DEBT-021",
"concern": "Verify artifact isolation: Recurring debt: per-instance watch run_ids are not sufficient unless the plan also cleans or namespaces global SWE-bench artifacts before each score and on restart.",
"status": "addressed",
"severity": "significant"
},
{
"id": "watch-concurrency-cleanup",
"concern": "SWE-bench Docker cleanup: exposing --max-workers for concurrent watch scoring is unsafe with the current cleanup strategy.",
"status": "addressed",
"severity": "significant"
}
]
code
Known accepted debt grouped by subsystem:
{
"config-reproducibility": [
{
"id": "DEBT-008",
"concern": "openrouter_params (temperature, top_p) are recorded in config but cannot be applied because neither hermes aiagent nor the megaplan cli expose inference parameter controls.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"docker-sandbox-init": [
{
"id": "DEBT-015",
"concern": "file_tools.py does not forward docker_mount_cwd_to_workspace when creating the docker sandbox, so if read_file/write_file is the first tool call, the host workspace bind mount may not be set up.",
"occurrence_count": 1,
"plan_ids": [
"generalize-the-eval-harness-20260327-2049"
]
}
],
"execute-loop-control-flow": [
{
"id": "DEBT-022",
"concern": "the 'all tasks done but state stuck on finalized' break path at line 562 would skip verify if verify is inserted after the execute block.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"handler-routing": [
{
"id": "DEBT-009",
"concern": "handler layer hardcodes planned\u2192critique transitions that the plan doesn't explicitly enumerate for update.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-026",
"concern": "manual megaplan research cli invocation can strand plans in state_researched with no workflow exit transition.",
"occurrence_count": 1,
"plan_ids": [
"three-changes-to-the-megaplan-20260329-1755"
]
}
],
"hermes-config": [
{
"id": "DEBT-004",
"concern": "availability check references ~/.hermes/config.yaml for api keys, but hermes stores them in /.hermes/.env.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"join-workflow": [
{
"id": "DEBT-019",
"concern": "the --join cli has no enforced source of truth for original run settings, so a mismatched config could attach wrong models/workspace layout to an existing manifest.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"module-layout": [
{
"id": "DEBT-003",
"concern": "hermes_worker.py importing workerresult from workers.py while workers.py imports run_hermes_step from hermes_worker.py creates a circular import.",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-024",
"concern": "the evals/ top-level package is outside the distributable module set and won't be included in wheel builds.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"orchestrator-lifecycle": [
{
"id": "DEBT-018",
"concern": "the manifest.all_done() polling loop can hang indefinitely if a worker crashes and leaves tasks in 'claimed' state with no timeout or reclaim mechanism.",
"occurrence_count": 1,
"plan_ids": [
"two-goals-for-the-swe-bench-20260328-2006"
]
}
],
"research-prompt": [
{
"id": "DEBT-013",
"concern": "plan omits the brief's explicit 'compare against at least 2 search results' requirement.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"schema-validation": [
{
"id": "DEBT-011",
"concern": "proposed framework_versions object schema will be rejected by the strict additionalproperties:false rewriter.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
},
{
"id": "DEBT-014",
"concern": "prompt wording alone cannot prevent empty or content-free consideration entries since the schema only requires severity.",
"occurrence_count": 1,
"plan_ids": [
"improve-research-reliability"
]
}
],
"scoring-diffing": [
{
"id": "DEBT-007",
"concern": "git diff head1 fails when the workspace has only one initial commit before execution begins.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"session-lifecycle": [
{
"id": "DEBT-016",
"concern": "_cleanup_hermes_sessions() hard-codes path.home() / '.hermes' / 'sessions', ignoring hermes_home. parallel workers may delete session files from the default location.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
],
"swebench-harness-invocation": [
{
"id": "DEBT-020",
"concern": "verify runs full instance evaluation via run_evaluation rather than targeting individual test ids.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
},
{
"id": "DEBT-023",
"concern": "read_prompt() has no caller in this repository yet, so fail_to_pass test ids won't reach megaplan prompts until a follow-up wires it in.",
"occurrence_count": 1,
"plan_ids": [
"fix-two-issues-with-swe-bench-20260329-1313"
]
}
],
"test-coverage": [
{
"id": "DEBT-012",
"concern": "plan references wrong test files for workflow assertions.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"trace-collection": [
{
"id": "DEBT-006",
"concern": "session log path is ~/.hermes/sessions/ not ~/.hermes/logs/, and sessions are reused across megaplan phases, so naive reads return cumulative history rather than phase-isolated snapshots.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"trace-instrumentation": [
{
"id": "DEBT-005",
"concern": "the plan captures normalized session logs and aggregate cost/token counters from run_conversation(), not raw http request/response payloads or openrouter response headers.",
"occurrence_count": 1,
"plan_ids": [
"hermes-evals-orchestrator"
]
}
],
"verify-artifact-isolation": [
{
"id": "DEBT-021",
"concern": "multiple verify attempts may leave stale result artifacts that _check_resolved() picks up, causing false positives.",
"occurrence_count": 1,
"plan_ids": [
"add-a-verify-step-to-the-20260328-2253"
]
}
],
"worker-contract": [
{
"id": "DEBT-001",
"concern": "plan's sample workerresult constructor uses non-existent fields (output, input_tokens, output_tokens) instead of actual fields (payload, raw_output).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
}
],
"worker-dispatch": [
{
"id": "DEBT-002",
"concern": "plan's sample function signature (phase, prompt, schema_dir, model) doesn't match the actual worker signature (step, state, plan_dir, *, root, ...).",
"occurrence_count": 1,
"plan_ids": [
"hermes-megaplan-integration"
]
},
{
"id": "DEBT-010",
"concern": "research on non-hermes agents silently falls back to stale training data instead of fresh web searches.",
"occurrence_count": 1,
"plan_ids": [
"research-phase"
]
}
],
"workflow-enforcement": [
{
"id": "DEBT-025",
"concern": "handle_plan accepts both state_initialized and state_prepped, so a manual cli invocation could skip prep on heavy robustness.",
"occurrence_count": 2,
"plan_ids": [
"add-a-prep-phase-to-the-20260329-1410"
]
}
],
"workspace-lifecycle": [
{
"id": "DEBT-017",
"concern": "stale per-worker prediction dirs from crashed prior runs could be globbed into a subsequent run's combined_predictions.jsonl.",
"occurrence_count": 2,
"plan_ids": [
"add-parallel-worker-support-20260328-1222"
]
}
]
}
code
Escalated debt subsystems:
[]
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Requirements:
- First, assess whether the plan targets the correct root cause. If the proposed fix already exists in the codebase, or if the plan contradicts evidence you find, flag this as CRITICAL — the plan needs a fundamentally different approach, not just adjustments.
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered step sections (`### Step N:` under `## Phase` headers, or flat `## Step N:`) with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`.
- Missing required sections or step coverage (for example: no H1, no `## Overview`, or no step sections at all) should be flagged as category `completeness` with severity_hint `likely-significant`.
- Structural formatting within steps (for example: prose instead of numbered substeps, or a missing file reference inside an otherwise actionable step) should usually be category `completeness` with severity_hint `likely-minor` because the executor can still follow the instructions.
- Ask whether the plan is the simplest approach that solves the stated problem, whether it could use fewer steps or less machinery, and whether it introduces unnecessary complexity.
- Over-engineering concerns should use category `maintainability`, should usually prefix the concern with "Over-engineering:", and should scale severity_hint to the practical impact.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
swebench.harness.run_evaluation
run_id
_cleanup_run_artifacts(run_id)
evaluation_results
logs/run_evaluation
run_id
hermes-watch
_watch_scores.json
run_id
Not yet included in a published release.
run_id
"hermes-watch"
run_id
Parse result via _parse_swebench_report(instance_id, run_id) (Step 2)
Optionally clean Docker images after scoring (reuse _cleanup_docker_images pattern from swe_bench.py:509)
Implement exit conditions that account for no-patch tasks (addresses watch-exit-semantics):
The watch loop cannot use total_tasks as the expected prediction count because tasks that fail without a patch produce no .jsonl
Instead, exit when: manifest.all_done() AND all predictions matching done_task_ids() have been scored — i.e., every .jsonl file that exists for a done task has been processed
Also exit on: elapsed time > timeout, or KeyboardInterrupt (graceful, write partial results)
The loop naturally handles the gap: if manifest has 100 tasks, 80 produce patches, and 20 fail with no patch, we exit after scoring the 80 predictions once all 100 manifest tasks reach terminal status
Write incremental results after each score — atomic write (temp + rename) to results_root/_watch_scores.json: