Repository navigation
Description
Summary
Route Agent Job Health Monitor with model routing, using goal: cost and mode: economy, instead of running every day on the Claude engine's default model, claude-sonnet-5. Only the frontmatter of .github/workflows/agent-job-health.md and the recompiled agent-job-health.lock.yml change. The agent then reaches Claude through GitHub Copilot instead of the Anthropic API key. Estimated saving: about 2,400 AI Credits (AIC; 1 AIC = $0.01) a week.
This is one of four issues filed together for gh-aw's daily Claude Code report workflows. The others are Copilot Session Insights (#73024), Claude Code User Documentation Review (#73025) and Safe Output Health Monitor (#73027).
Why model routing
Agent Job Health Monitor runs every task on one model, however easy. Model routing picks the model and reasoning effort for each run, based on its task, so the workflow no longer depends on one model name staying available. We're moving gh-aw's own workflows over one at a time, one per PR, and measuring cost and outcomes after each.
The first, Duplicate Code Detector, has been routed since 17 October (#69499):
Pinned claude-opus-4.8 (3–15 Oct) |
Routed (17–25 Oct) | |
|---|---|---|
| AIC per night, all jobs | 296 | 26 |
| Findings that led to a merged fix | 7 of 21 (33%) | 3 of 5 (60%) |
With so few runs, we read the quality result as "no worse", not "better". Avenger is next (#73009).
With the Claude engine, model routing runs through GitHub Copilot (model-provider: github) and chooses only among the claude-* models that Copilot offers. smoke-claude-routed already uses this engine configuration, with its candidates limited to claude-sonnet-5. Its last 12 runs, 18 to 29 October, all succeeded.
Why Agent Job Health Monitor next
- Almost all of its cost is the agent on
claude-sonnet-5. Agent Job Health Monitor cost 4,530, 4,532, 3,359 and 3,820 AIC in the weeks starting 28 September, 5, 12 and 19 October. A run whose agent executes costs about 553 AIC: about 552 for the agent and about 1 for threat detection and evals, which already use their default models. At its recent run rate, that's about 3,590 AIC a week. - It reads data and writes a report. It tracks the daily agent-job failure rate across all agentic workflow runs, separates known chronic failures from new regressions, and posts a discussion. We expect the router to classify a run as a hard explanation within one subsystem.
- A cheaper choice scores better. For that task, with
goal: costandmode: economy, the routing tables in AWF v0.29.0, gh-aw's current default, pickclaude-opus-5.5atloweffort. On the router's benchmarks it scores 48.4, against about 37 forclaude-sonnet-5across its efforts. It costs about 31 AIC per benchmark task, against 85–107 forclaude-sonnet-5atmediumandhigh. The benchmarks are coding tasks, so they're weaker evidence for a report than for a code fix. We estimate routed runs at about 178 AIC each, about 1,150 AIC a week. - A weaker run does little harm. It posts one discussion in the
auditscategory (an issue, if the discussion can't be created) and can open one issue, which a maintainer triages. 8 of its last 10 runs, 19 to 28 October, succeeded. The other two failed in theconclusionjob, not the agent. That's the baseline to watch.
Why economy. Agent Job Health Monitor reads data and reports on it, and people read the report before acting on it. economy already picks a model that scores above claude-sonnet-5 on the router's benchmarks. If reports get worse, balanced picks claude-opus-5.5 at medium effort. That scores 55.5 at about 49 AIC per benchmark task, still below claude-sonnet-5.
Why not auto. Agent Job Health Monitor's prompt is the same every day; only the data it reads changes. The docs recommend a fixed mode when you know what kind of tasks a workflow gets.
Proposed change
In .github/workflows/agent-job-health.md:
- Keep
engine.id: claudeandengine.mcp.tool-timeout: 10m. - Add
engine.model-provider: github. The Claude engine needs it for model routing. - Add
engine.model-routingwithgoal: costandmode: economy.
The resulting engine block:
engine:
id: claude
model-provider: github
model-routing:
goal: cost
mode: economy
mcp:
tool-timeout: 10mThen run make recompile. Only agent-job-health.md and agent-job-health.lock.yml should change. In the lock file, expect these changes:
- The AWF router image is added to the pinned images.
- A "Prepare model-routing conversation" step is added.
- Model routing is enabled in the agent's AWF config, with
github-copilot/claude-*as the candidates. - The agent no longer uses
ANTHROPIC_API_KEY. The secret, its validation step and theGH_AW_MODEL_AGENT_CLAUDEdefault are removed. Claude Code reaches Copilot through the AWF API proxy, authenticated with theCOPILOT_GITHUB_TOKENsecret. - The routed model, effort and routing status are passed to the downstream jobs.
- Threat detection runs on Copilot CLI with its
detectiondefault model, instead of on Claude Code. Evals stay on Claude Code with theevalsdefault model, now through Copilot.
On current main (e6afe3424d), this change compiles to exactly that diff, and TestCompileToolAgentJobHealthStrictDryRunRejectsHostSteps in pkg/cli/mcp_compile_diagnostics_test.go, which compiles this workflow, passes.
The docs note that Claude Code fails at none or minimal effort. The current routing tables have no such choices for Claude models, so the router can't pick them.
After merge
Over the first two weeks:
- Check the first routed runs with
gh aw audit <run>. Its Model Routing section shows the selected model and effort, as do thefirewall.model_routingrecords inusage/aw_session.jsonl. Expect mostlyclaude-opus-5.5atlow. The router classifies each run, so some runs can differ. - Compare AIC per run, for the agent and the threat detection and evals jobs together, with about 553 AIC today.
- Read any issue it opens before acting on it.
- Compare the success rate with 8 of its last 10 runs, and read the first few reports against recent ones. If the reports get worse, switch to
mode: balanced. To roll back, removemodel-providerandmodel-routingand recompile.
Merge order. We suggest merging Copilot Session Insights (#73024) and Claude Code User Documentation Review (#73025) first. Merge the two health monitors, Agent Job Health Monitor (#73026) and Safe Output Health Monitor (#73027), after the first routed runs of those two look right, on different days, so each change can be measured on its own.
Out of scope
- Other workflows. Each gets its own issue.
- Agent Job Health Monitor's prompt, schedule, tools, permissions, limits and safe outputs.
- Changes to the router or its tables.
Acceptance criteria
agent-job-health.mdsetsengine.model-provider: githubandengine.model-routingwithgoal: costandmode: economy, and keepsengine.id: claudeandengine.mcp.tool-timeout: 10m.agent-job-health.lock.ymlis regenerated withmake recompile, and no other workflow changes.TestCompileToolAgentJobHealthStrictDryRunRejectsHostStepspasses.
Activity