Skip to content

fix(mobile): resolve permission args when a new session launches an agent - #8469

Merged
nwparker merged 1 commit into
stablyai:mainfrom
kaynansc:fix/mobile-new-session-agent-permission-args
Jul 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
kaynansc:fix/mobile-new-session-agent-permission-args

Conversation

@kaynansc

@kaynansc kaynansc commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes mobile "New Workspace" sessions launching a picked agent in the wrong permission mode versus opening the same agent from the tab bar's +.

ELI5

On phones, starting Claude from the "new session" screen made it ask for permission on every action, while starting the same Claude from the + button didn't. Now both start it the same way.

Root cause & fix

The mobile New Workspace modal built a bare launch command (e.g. claude) client-side from a static MOBILE_TUI_AGENT_LAUNCH_COMMANDS map and passed it as startupCommand, which the host runs verbatim — skipping default launch args (notably --dangerously-skip-permissions) and host-shell quoting. The + new-tab path instead sends only the agent id and lets the host resolve args. The fix makes every client create path send startupAgent via a shared agentLaunchCreateFields(agentId) helper (returning { startupAgent, createdWithAgent }), so the host resolves launch command, args, env, and quoting through the same path as + and the CLI. The dead map and modal agentCmdOverrides type are removed.

Evidence

Validated & rebased onto latest main during a bug-bash triage on 2026-07-23. Rebase was clean onto origin/main.

  • Tests: blank-workspace-create.test.ts, workspace-create-params.test.ts, source-workspace-create.test.ts (run via vitest from mobile/).
  • On branch: 3 test files passed, 21 tests passed.
  • With the fix reverted (tests kept), it fails as expected:
Test Files  3 failed (3)
Tests       4 failed | 17 passed (21)
 - source-workspace-create: toMatchObject missing "startupAgent": "claude"
 - blank-workspace-create: startupAgent not sent
 - workspace-create-params x2: agentLaunchCreateFields is not a function
  • Lint: oxlint on the 6 changed source files — clean, no warnings/errors.
  • Regression scan: no remaining references to MOBILE_TUI_AGENT_LAUNCH_COMMANDS; agentCmdOverrides only referenced in unrelated code; isMobileTuiAgent still exported for other modules.

Trade-offs

None — pure fix.

Regression risk

Zero-regression rationale: only the client create paths change what they send (startupAgent instead of a pre-built startupCommand), converging on the already-correct host resolution used by + and the CLI. The host schema already accepted startupAgent; non-affected paths are unchanged. Proven by the passing branch tests and the reverted-fix failures. No dangling references were found.

Credit to original author @kaynansc. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Mobile worktree creation no longer resolves or sends client-side startup commands. A shared helper derives startupAgent and createdWithAgent from the selected agent identifier, and blank, source, and branch creation paths use it. Tests verify omission of startupCommand and preservation of agent metadata. The worktree schema comment now documents desktop launch commands and agent-based startup inputs.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning It covers the summary and evidence, but omits required template sections like Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections, including Screenshots/No visual change, Testing checklist, AI Review Report, Security Audit, and Notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main change: fixing mobile new-session agent permission handling.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmethystLiang
AmethystLiang requested a review from Jinwoo-H July 13, 2026 16:47
@kaynansc
kaynansc force-pushed the fix/mobile-new-session-agent-permission-args branch from 210ea26 to 33daf73 Compare July 13, 2026 22:54
@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:38
…gent

The New Workspace flow built a bare launch command client-side and sent it as
`startupCommand`, so the host ran it verbatim and never applied the default
launch args. The first Claude session therefore started in manual mode, while
opening another Claude via the "+" tab (which sends the agent id and lets the
host resolve args) started with `--dangerously-skip-permissions`.

Send `startupAgent` from every client-built create path (blank, reuse-branch,
and new-branch) so the host resolves the launch command, args, env, and
host-shell quoting through the same path the "+" new-tab and CLI use. The
work-item path already delegated via `startupDraft`. Custom `agentDefaultArgs`
are now honored on all paths.

Adds a shared `agentLaunchCreateFields` helper and removes the now-unused
client-side command map, which had also drifted from the canonical launch
commands for continue, hermes, command-code, kiro, and mistral-vibe.

Claude-Session: https://claude.ai/code/session_014iufZnQwPD2obYuvdahjaE
@nwparker
nwparker force-pushed the fix/mobile-new-session-agent-permission-args branch from 33daf73 to 92a5084 Compare July 23, 2026 11:48
@nwparker
nwparker merged commit 69d05b6 into stablyai:main Jul 24, 2026
@nwparker

Copy link
Copy Markdown
Contributor

Thanks so much @kaynansc — great catch — the mobile new-session was launching the agent in a different permission mode than the + tab. Verified (fail-on-main/pass-on-branch) and merged. 🙏

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…gent (stablyai#8469)

The New Workspace flow built a bare launch command client-side and sent it as
`startupCommand`, so the host ran it verbatim and never applied the default
launch args. The first Claude session therefore started in manual mode, while
opening another Claude via the "+" tab (which sends the agent id and lets the
host resolve args) started with `--dangerously-skip-permissions`.

Send `startupAgent` from every client-built create path (blank, reuse-branch,
and new-branch) so the host resolves the launch command, args, env, and
host-shell quoting through the same path the "+" new-tab and CLI use. The
work-item path already delegated via `startupDraft`. Custom `agentDefaultArgs`
are now honored on all paths.

Adds a shared `agentLaunchCreateFields` helper and removes the now-unused
client-side command map, which had also drifted from the canonical launch
commands for continue, hermes, command-code, kiro, and mistral-vibe.

Claude-Session: https://claude.ai/code/session_014iufZnQwPD2obYuvdahjaE

Co-authored-by: kaynan <[email protected]>
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.

5 participants