Skip to content

feat: adapter own-timeout + usage parsing, A20 baseline runner - #409

Merged
dahai80 merged 1 commit into
mainfrom
feat/tb2-adapter-hardening
Nov 30, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/tb2-adapter-hardening

Conversation

@dahai80

@dahai80 dahai80 commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Own timeout: the external adapter now kills the fusion-code subprocess at 870s (default, FUSION_CODE_TB2_AGENT_TIMEOUT_S), just below harbor's 900s agent cap. In S1 run 8 the agent finished its work but harbor's AgentTimeoutError cancelled run() itself, so the verifier metrics pipeline was entered through an exception and token usage was lost. With the own timeout, run() returns normally, usage gets parsed, and the verifier runs cleanly.
  • Usage parsing: parse the stream-json result event into AgentContext — n_input_tokens / n_output_tokens / n_cache_tokens plus per-model modelUsage (harbor ModelUsage schema: n_input_tokens includes cached tokens, matching fusion-code's usage.input_tokens). Unit-verified against a real S1 result event (163236 in / 6723 out).
  • A20 baseline runner (run-a20.sh): sequential runs over the frozen 20-task subset (single 27B engine, concurrency 1), per-task image + repo-path detection from task.toml / Dockerfile WORKDIR, image-pull wall time recorded separately from agent wall time.

Test plan

  • python3 -m py_compile + import under harbor's interpreter
  • _populate_usage unit-tested against a real S1 result event
  • bash -n run-a20.sh
  • bun test 1892 pass / validator ERROR 0 on the same tree (main-based)

🤖 Generated with Claude Code

- fusion_code_agent_external.py: enforce an own agent timeout (default
  870s, FUSION_CODE_TB2_AGENT_TIMEOUT_S) slightly below harbor's cap so
  run() returns instead of being cancelled by AgentTimeoutError — the
  verifier still runs and metrics survive; parse the stream-json result
  event into AgentContext (n_input/n_output/n_cache_tokens + per-model
  modelUsage; input_tokens includes cache reads per fusion-code schema).
  Verified against a real S1 result event.
- run-a20.sh: sequential A20 baseline runner over the frozen subset
  (single 27B engine, concurrency 1), per-task repo-path/image
  detection from task.toml + Dockerfile WORKDIR, image-pull wall time
  recorded separately from agent wall time per the census note.

Co-Authored-By: Claude Code <[email protected]>
@dahai80
dahai80 merged commit 819f31a into main Nov 30, 2026
1 check passed
@dahai80
dahai80 deleted the feat/tb2-adapter-hardening branch November 30, 2026 07:53
dahai80 added a commit that referenced this pull request Dec 1, 2026
Survey addendum item (cost-per-task): per-trial wall seconds from
started_at/finished_at, wall column per row, wall stats + token cost
per resolved task in the summary. Verified against existing S1 job
dirs (usage fields absent there = 0, expected for pre-#409 runs).

Co-authored-by: Claude Code <[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.

1 participant