fix(hub,cli): forward permissionMode on session resume (#460)

* feat(hub,cli): forward permissionMode on session resume

When a session is resumed, the cached permissionMode is now forwarded
through the Hub → Runner → CLI pipeline via a new --permission-mode
flag. Previously the mode was lost on resume, resetting to 'default'.

Each CLI flavor validates the flag value against its own allowed
permission modes (e.g. CLAUDE_PERMISSION_MODES) and rejects unknown
values. The existing --yolo flag is preserved as a shorthand.

* refactor(cli): extract buildCliArgs from startRunner

Extract the CLI argument construction logic into a standalone
exported function so it can be unit-tested independently.
No behavior change.

* test(cli): add buildCliArgs unit tests for --permission-mode

Verify that the runner correctly forwards valid permission modes
via --permission-mode, rejects invalid values, and falls back to
--yolo when no permission mode is set.

* fix(cli): let --permission-mode take precedence over --yolo

When both flags are present, --permission-mode was silently
overwritten by a later --yolo. Guard legacy flag branches with
a hasExplicitPermissionMode check so the explicit flag wins.
This commit is contained in:
Junmo Kim
2026-04-15 11:13:21 +08:00
committed by GitHub
parent 09c2c57eaf
commit e6eaff83c5
12 changed files with 239 additions and 45 deletions
+1
View File
@@ -9,6 +9,7 @@ export interface SpawnSessionOptions {
effort?: string
modelReasoningEffort?: string
yolo?: boolean
permissionMode?: string
token?: string
sessionType?: 'simple' | 'worktree'
worktreeName?: string