Skip to content

fix: honor agent model routing - #5

Open
mathewtbenjamin wants to merge 1 commit into
vigolium:mainfrom
mathewtbenjamin:fix/honor-agent-model
Open

fix: honor agent model routing#5
mathewtbenjamin wants to merge 1 commit into
vigolium:mainfrom
mathewtbenjamin:fix/honor-agent-model

Conversation

@mathewtbenjamin

Copy link
Copy Markdown

Summary

Sub-agents declaring a model family in frontmatter (haiku, sonnet, opus) previously fell through to the parent model — the declaration was silently ignored. This PR makes agent-runner resolve the declared family against the authenticated Pi model registry:

  • Resolution prefers the parent's provider when it offers that family, then direct Anthropic, then Anthropic Vertex, choosing the newest matching model by version.
  • Unresolvable declarations fall back to the parent model (previous behavior, now explicit).
  • prompt.md transcripts record both the requested and resolved model for auditability.

Also included (surfaced while testing the routing paths):

  • Provider policy refusals explicitly flagging cybersecurity content are treated as non-retryable — retrying an unchanged phase prompt can't succeed and wastes requests. The refusal is still recorded in audit-state.json so the operator can resume with another model.
  • Replaced a Model<any> + biome-ignore with Model<Api>.

Tests

  • test/agent-runner.test.ts: family resolution (provider preference, version ordering, fallback).
  • test/retry.test.ts: non-retryable refusal classification.

Docs updated in HACKING.md.

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