refactor(cli): move the mid-turn slash disposition onto the command spec - #3379
Conversation
Follow-up to apache#3310: the routing call site matched command names ('goal' | 'recap') to decide which slash commands answer locally while a turn is running. Move that knowledge onto MakaSlashCommand as a required midTurn field ('local' | 'refuse' | 'intercepted') declared next to each handler, so the handler that has to be safe mid-turn carries the declaration, and a newly added command must state its answer — omitting midTurn is a compile error. 'intercepted' documents /exit, /swarm and /graph, which their dedicated checks claim ahead of generic routing. Behavior is unchanged; the mid-turn routing tests from apache#3310 pin it. Generated-by: Maka
c5f43ba to
78ad25f
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for moving the mid-turn disposition onto the command specification. I reviewed exact head 78ad25fb66ffa0c6ebfe0fde8ab11248cdc3f6c6. This makes the command definition the authority instead of maintaining a name-based exception at the routing call site. The required Record<TuiSlashCommandId, ...> coverage, aliases, and the dedicated /exit, /graph, and /swarm interception paths remain consistent. I found no actionable issues.
Hosted CI has not appeared for this head yet, so merge should still wait for the required checks.
AI-assisted review disclosure: Codex performed the exact-head analysis, and an independent reviewer agent adversarially checked command routing, aliases, lifecycle, and test coverage. I verified the evidence and made the final review decision.
Summary
Follow-up to #3310, per the review seam observation: the routing call site in
editor.onSubmitmatched command names ('goal' || 'recap') to decide which slash commands answer locally while a turn is running. That knowledge now lives onMakaSlashCommandas a requiredmidTurnfield declared next to each handler:'local'(/goal,/recap) — answers immediately; the handler must be independent of the running turn and never enterrunControl, whose busy gate would silently no-op.'refuse'(everything else that reaches generic routing) — rejected with the notice introduced in fix(cli): stop steering known slash commands into a running turn #3310. Safe default for anything that mutates session state or opens a picker the turn would race.'intercepted'(/exit,/swarm,/graph) — documents that dedicated checks claim these ahead of generic routing; the disposition is never consulted for them.Because
slashCommandHandlersis asatisfies Record<TuiSlashCommandId, …>and the field is required, a newly added command must state its mid-turn answer — omitting it is a compile error, instead of silently inheriting the call site's default.Behavior is unchanged; the mid-turn routing tests from #3310 pin it.
Refs #3308
Verification
npm --workspace maka-agent test: 337 pass / 0 fail, including the fourslash commands during a running turntests from fix(cli): stop steering known slash commands into a running turn #3310 unchanged.midTurnfails withTS2741: Property 'midTurn' is missing … but required in type 'Omit<MakaSlashCommand, "aliases" | "name">'; restored andtscis clean again.npm run lint,npm run format:check,npm run typecheck: pass.AI use
Select exactly one:
Tool(s) and scope: Maka (AI agent) implemented the refactor and ran the verification; the commit carries the
Generated-by: Makatrailer. Human contributor of record reviewed the disposition assignment per command and decided to submit.Checklist
Does this PR entail a change in behavior?