Skip to content

refactor(cli): move the mid-turn slash disposition onto the command spec - #3379

Merged
Astro-Han merged 1 commit into
apache:mainfrom
me2seeks:refactor/cli-mid-turn-disposition
Aug 21, 2026
Merged

refactor(cli): move the mid-turn slash disposition onto the command spec#3379
Astro-Han merged 1 commit into
apache:mainfrom
me2seeks:refactor/cli-mid-turn-disposition

Conversation

@me2seeks

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #3310, per the review seam observation: the routing call site in editor.onSubmit matched command names ('goal' || 'recap') to decide which slash commands answer locally while a turn is running. That knowledge now lives on MakaSlashCommand as a required midTurn field declared next to each handler:

  • 'local' (/goal, /recap) — answers immediately; the handler must be independent of the running turn and never enter runControl, 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 slashCommandHandlers is a satisfies 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 four slash commands during a running turn tests from fix(cli): stop steering known slash commands into a running turn #3310 unchanged.
  • Compile-time enforcement verified: removing one handler's midTurn fails with TS2741: Property 'midTurn' is missing … but required in type 'Omit<MakaSlashCommand, "aliases" | "name">'; restored and tsc is clean again.
  • npm run lint, npm run format:check, npm run typecheck: pass.
  • Not run: desktop e2e (no desktop change).

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Maka (AI agent) implemented the refactor and ran the verification; the commit carries the Generated-by: Maka trailer. Human contributor of record reviewed the disposition assignment per command and decided to submit.

Checklist

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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
@me2seeks
me2seeks force-pushed the refactor/cli-mid-turn-disposition branch from c5f43ba to 78ad25f Compare August 21, 2026 07:22

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Astro-Han
Astro-Han merged commit 7e16dd9 into apache:main Aug 21, 2026
1 check passed
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.

2 participants