fix(hermes): cli-auto capacity failover uses automatic Switchyard reclassification #32
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/cli-auto-failover-effort"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
cli-autocapacity/auth/quota failover previously calledselect_routewith ahardcoded manual lane (
cli-{alternate}-{effort}), so the retry boundary wasclassified
switchyard-manualinstead of going through automatic Jetsonclassification — misleading routing evidence, even though effort happened to
be preserved as a side effect of the hardcoded lane string.
services/hermes/scripts/cli_lane_failover.pynow retries through Switchyardautomatic selection:
select_route(context, assignee, exclude_provider=route.provider, exclude_reason=...)with
assigneestillcli-auto. If the classifier reclassifies to a lowereffort than the original route (including when its own excluded-provider
health guard fires), the lane re-pins the chosen provider at the original
effort floor via one manual-lane call, so a capacity failure never silently
downgrades a high/xhigh task. Effort is allowed to escalate if the classifier
picks something higher. Explicit manual lanes (assignee other than
cli-auto)are unchanged and still fail closed without switching providers. Both-hosted
failure still blocks transient and never falls to a local or metered path.
What changed
services/hermes/scripts/cli_lane_failover.py— automatic reclassificationwith provider exclusion, plus effort-floor preservation/escalation.
testing/tests/test_hermes_cli_quota_failover.py— new coverage forautomatic classification on retry, the
exclude_provider/exclude_reasonkwargs, and effort-floor escalation when the classifier downgrades; manual
fail-closed tests kept and unaffected.
testing/tests/test_hermes_cli_fallback.py,testing/tests/test_hermes_cli_review_lane.py,testing/tests/test_hermes_cli_router_outage.py— updated stubs so theretry
select_routecall is distinguished by the exclusion kwarg instead ofa hardcoded manual lane string, matching the new call shape. Two of these
tests were also isolated onto tmp-path provider-health files instead of the
real
/opt/data/provider-health/*.json, closing a latent test-isolation gapthat the old hardcoded-lane stubs happened to mask.
Evidence
implementing) and pass after.
pytest testing/tests/test_hermes_cli_quota_failover.py testing/tests/test_hermes_cli_fallback.py testing/tests/test_hermes_cli_router_outage.py testing/tests/test_hermes_cli_review_lane.py testing/tests/test_hermes_cli_lane_routing.py testing/tests/test_hermes_cli_routing.py testing/tests/test_hermes_cli_lane_goal.py— all pass.pytest testing/tests/— 2538 passed, 4 skipped, 4 failed. The 4failures (
test_hermes_agent_layout.pyx2,test_hermes_gitea_pr_integration.py::test_http_error_path_redacts_token,test_hermes_kanban_supervisor.py::test_auto_supervise_flag_defaults_false_in_configmap)reproduce identically on unmodified
origin/main, confirmed by stashingthis change and re-running them — unrelated pre-existing failures.
kustomize build services/hermeswas needed.Known related gap (not fixed here, out of scope)
services/hermes/scripts/execution_pool_worker.py(the newer two-workerconcurrency execution path) has the same hardcoded-manual-lane pattern at its
own capacity-failure retry call. This PR only touches
cli_lane_failover.py, the file named in the task. Flagging it here for afollow-up.
Test plan
pytest testing/tests/test_hermes_cli_quota_failover.py(new + updatedcoverage)
pytest testing/tests/test_hermes_cli_fallback.py testing/tests/test_hermes_cli_router_outage.py testing/tests/test_hermes_cli_review_lane.py testing/tests/test_hermes_cli_lane_routing.py testing/tests/test_hermes_cli_routing.py testing/tests/test_hermes_cli_lane_goal.pypytest testing/tests/full suite (only pre-existing unrelatedfailures)
Capacity/auth/quota failover for cli-auto previously called select_route with a hardcoded manual lane (cli-{alternate}-{effort}), so the retry boundary was classified as switchyard-manual instead of going through Jetson automatic classification, making the routing evidence misleading. Now the retry calls select_route(context, "cli-auto", exclude_provider=...) so the boundary stays automatically classified with an explicit failed-provider exclusion. If the classifier reclassifies to a lower effort than the original route, the lane re-pins the chosen provider at the original effort floor so a capacity failure never silently downgrades a high/xhigh task. Manual lanes (assignee != cli-auto) remain unchanged and still fail closed without switching providers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>WIP: fix(hermes): cli-auto capacity failover uses automatic Switchyard reclassificationto fix(hermes): cli-auto capacity failover uses automatic Switchyard reclassification