fix(cli): assign-schedule-type dispatch at top level #8

Merged
hzhang merged 1 commits from fix/assign-schedule-type-dispatch into main 2026-05-29 07:47:28 +00:00
Contributor

Summary

  • Fix hf assign-schedule-type failing with unknown assign-schedule-type subcommand: <agent-id>.
  • assign-schedule-type is registered as a Group in CommandSurface(), so the default branch of main()'s switch routes it through handleGroup, which treats args[0] (the agent-id) as a subcommand. Since this group has no subcommands, findSubCommand returns ok=false and the run aborts.
  • Add an explicit top-level case so the leaf bypasses the group dispatcher.

Test plan

  • Reproduce on prod: hf assign-schedule-type analyst1 standard → "unknown assign-schedule-type subcommand: analyst1"
  • Apply fix + rebuild: same call → reaches handleAssignScheduleType (then requires CLAW_IDENTIFIER + admin role to actually succeed, but the dispatch path now works)
  • Verified end-to-end: with sherlock upgraded to admin role and CLAW_IDENTIFIER set, hf assign-schedule-type analyst1 standard returns "Assigned schedule type 'standard' to agent 'analyst1'"
  • Existing top-level cases (version/health/config/update-discord-id/agent) still work as before

Surfaced during recruitment workflow Step 5 on prod-t2 (sherlock/agent-resource-director).

## Summary - Fix `hf assign-schedule-type` failing with `unknown assign-schedule-type subcommand: <agent-id>`. - `assign-schedule-type` is registered as a Group in CommandSurface(), so the default branch of main()'s switch routes it through handleGroup, which treats `args[0]` (the agent-id) as a subcommand. Since this group has no subcommands, findSubCommand returns ok=false and the run aborts. - Add an explicit top-level case so the leaf bypasses the group dispatcher. ## Test plan - [x] Reproduce on prod: `hf assign-schedule-type analyst1 standard` → "unknown assign-schedule-type subcommand: analyst1" - [x] Apply fix + rebuild: same call → reaches handleAssignScheduleType (then requires CLAW_IDENTIFIER + admin role to actually succeed, but the dispatch path now works) - [x] Verified end-to-end: with sherlock upgraded to admin role and CLAW_IDENTIFIER set, `hf assign-schedule-type analyst1 standard` returns "Assigned schedule type 'standard' to agent 'analyst1'" - [x] Existing top-level cases (version/health/config/update-discord-id/agent) still work as before Surfaced during recruitment workflow Step 5 on prod-t2 (sherlock/agent-resource-director).
hzhang added 1 commit 2026-05-29 07:47:19 +00:00
`assign-schedule-type` is registered in CommandSurface() as a Group, so
the default branch of main()'s switch picks it up via findGroup() and
hands it to handleGroup. handleGroup then treats args[0] (the agent-id)
as a subcommand name, fails findSubCommand, and errors:

    unknown assign-schedule-type subcommand: <agent-id>

The group has no subcommands — it's a leaf — so the call never reaches
handleAssignScheduleType. Add an explicit top-level case before the
default branch so the leaf bypasses the group dispatcher.

Pre-fix repro:
    $ AGENT_ID=ard hf assign-schedule-type analyst1 standard
    unknown assign-schedule-type subcommand: analyst1

Post-fix:
    $ AGENT_ID=ard CLAW_IDENTIFIER=server-t2 hf assign-schedule-type analyst1 standard
    Assigned schedule type 'standard' to agent 'analyst1'

Surfaced during recruitment workflow Step 5 on prod (sherlock/agent-resource-director).
hzhang merged commit c0ab087436 into main 2026-05-29 07:47:28 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: zhi/HarborForge.Cli#8