Files
hapi/cli/src
SSU-WEI HUANGandGitHub b744414241 fix(cli): skip invalid set_mode for interactive Copilot sessions (#1463)
* fix(cli): skip invalid set_mode for interactive Copilot sessions

applyInitialAgentMode() unconditionally sent session/set_mode with
modeId 'interactive', which the Copilot ACP server rejects (Invalid
mode 'interactive' - supported: agent/plan/autopilot), killing every
default-mode Copilot session at startup.

- Short-circuit applyAgentMode('interactive') as a no-op success,
  mirroring buildCopilotAcpArgs which already omits --mode at spawn
- Classify 'Invalid mode' responses as unsupported runtime switching so
  server-side mode rejections degrade gracefully (restart to apply)

Verified: bun typecheck + bun run test (full suite green).

* fix(cli): map Copilot interactive mode to ACP agent mode

Address review findings: the previous no-op for interactive left the
backend in Plan/Autopilot after a runtime switch while HAPI reported
Interactive, and classifying 'Invalid mode' responses permanently
disabled switching for valid modes too.

- Map interactive -> the ACP 'agent' mode id (the spawn default) so
  session/set_mode always receives a valid mode and runtime switches
  back to Interactive stay in sync with the backend
- Keep 'Invalid mode' out of the capability-loss classifier: it is a
  per-mode rejection, not evidence that set_mode is unavailable
2026-08-10 10:44:24 +08:00
..
2025-12-16 15:03:50 +08:00