Repository navigation
fix(mobile): surface host create warnings and terminal-create errors - #20125
Conversation
A workspace created from the phone could land on "No tabs in this session"
with a bare red "Failed to create terminal" and no way to tell why. Two
independent drops hid the host's own explanation:
- createWorktreeWithNameRetry returned only {worktreeId, name}, discarding
worktree.create's `warning`, and hostNewWorktreeSessionRoute built the
session route with only `name` + `created=1`. The session screen has always
had the banner (MobileSessionContentRow + createWarningState) -- only the
tasks create path ever fed it, so the New Workspace path could never report
a startup terminal that failed to spawn.
- handleCreateTerminal collapsed every failure to the literal
'Failed to create terminal', throwing away response.error.message.
Both now propagate, so the daemon's pty-allocation hint ("Your system cannot
allocate any more pty devices.") reaches the phone instead of dying in the
main process. Behaviour is otherwise unchanged: a blank warning is still
omitted from the route, and a host that gives no reason still reads
'Failed to create terminal'.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Create-warning propagation —
createWorktreeWithNameRetrynow returns the host's non-fatalwarning(WorktreeCreateResultsuccess variant gains a trimmed, blank-omittedwarning?: string), threaded throughonCreatedintohostNewWorktreeSessionRoute'swarningquery param, which the session screen already consumes viacreateWarningState. - Terminal-create error surfacing —
handleCreateTerminalreplaces the collapsed'Failed to create terminal'with areportCreateFailurehelper that sets the inline error to the host's real reason (falling back to the quick-command label / generic text) while keeping the toast on its labellederrorToast. - Tests — three new behavioral tests with exact
toEqual/toBestring assertions (route carries warning, warning omitted when blank, host reason surfaced, generic fallback preserved), plus a trimmed-warning unit test.
Both changes are minimal, well-scoped, and match the existing tasks-create path (use-mobile-tasks-workspace-create-actions.tsx already sets queryParams.set('warning', ...)). The host's warning field is confirmed present in RuntimeWorktreeCreateResult.warning? (src/shared/runtime-worktree-contracts.ts:118). Type changes to onCreated are backward-compatible (optional third arg). No behavioral regressions identified.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe worktree creation result now preserves non-blank host warnings. Callback types and handlers forward the warning to the session route, which URL-encodes it when present. Terminal creation now displays the host-provided failure reason and falls back to the configured or generic error message when the reason is empty. Tests cover warning propagation, whitespace handling, terminal error messages, and updated route parity hashes. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Host warnings and terminal failure reasons are surfaced without changing the documented fallback behavior. The reported validation passes, so the PR is mergeable. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives a detailed and relevant explanation of the problem, implementation, scope, and testing. However, it omits required template sections, including a linked issue, visual proof or an explicit N/A justification, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the checklist items. Resolution Update the description to follow the repository template. Add a real issue reference under Linked Issue, add before/after visual proof or write N/A with a reason, complete the Testing checkboxes, and provide the remaining required sections and checklist information. Preserve the existing technical explanation and test results.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
Mobile visual proof — iOS SimulatorNative iOS QA for this PR, driven end to end through Rig
On the two strings. Reproducing real pty exhaustion would take down the machine's terminal fleet, so the mock replays the real host's verbatim text rather than inventing a message:
The mock was patched locally and uncommitted so Flow exercised (identical in both runs): Host list → New workspace → name → Create worktree → lands on the new session, which hydrates with zero tabs and auto-creates its first terminal (which fails). Before — pre-fix (all 7 non-test source files reverted to merge-base
|
|
Review complete. I ran the readiness checklist at the start and end, plus an adversarial same-model review loop. No proven in-scope P0/P1/P2 issues remain; no fixes were needed. Validation:
The warning propagation and terminal error fallback are wired through the mobile create flow. Residual gaps are runtime emulator/SSH/network validation; Electron is not applicable because this PR is mobile-only. Backward compatibility impact is limited to optional warning data and route query state. |
|
Follow-up: CI had two failures in the existing mobile route parity hash assertions because the source changes intentionally altered the extracted nested-function/runtime-string bodies. Updated only those two expected SHA-256 baselines in commit |
|
Correction to the earlier review note: this PR does include visible mobile changes. The create-warning banner and host-provided terminal error are user-facing UI states, so mobile visual QA is applicable. The existing iOS Simulator evidence is recorded in the earlier “Mobile visual proof — iOS Simulator” comment with before/after screenshots, and Electron remains inapplicable because the diff is mobile-only. I also completed the requested local OSS reference review for mobile remote-control/error-delivery patterns; the relevant mechanism here is already aligned with the repository flow: preserve the host result, carry it through navigation state, and render actionable failure text at the affected surface. No production changes were needed from that comparison. |



What happened
Creating a workspace from the phone with Claude as the default agent landed on
No tabs in this sessionwith a bare redFailed to create terminaland nothingto act on.
The underlying cause that day was pty pressure on the host. At the time of the
failure
kern.tty.ptmx_maxread 511 with 506 ttys in use, 484 of them held bylogin(Orca's macOS TCC-wrapped spawn strategy). Note the cap is dynamic, not aconstant: it later read 999, and the highest device node is now
/dev/ttys513--the kernel grew the table past 511, which is consistent with it having been pressed
against that ceiling when the spawn failed. The host's startup Claude terminal
failed to spawn, and so did the phone's follow-up create. Both failures were
reported by the host with a real reason -- the phone just never showed either of
them.
Two independent drops
createWorktreeWithNameRetryreturned only{worktreeId, name}, discardingworktree.create'swarning, andhostNewWorktreeSessionRoutebuilt thesession route with only
name+created=1.The session screen has always had the banner for this (
MobileSessionContentRowcreateWarningState) -- only the tasks create path(
use-mobile-tasks-workspace-create-actions.tsx) ever fed it, so the NewWorkspace path could never report a startup terminal that failed to spawn.
handleCreateTerminalcollapsed every failure to the literal'Failed to create terminal', throwing awayresponse.error.message.After
Both propagate, so the daemon's existing pty-allocation hint reaches the phone:
The hint is already composed by
addNodePtyRecoveryHint; it was dying in the mainprocess. The same change surfaces every other host reason on this path -- a disabled
agent, an unresolved worktree owner,
after_tab_not_found.Behaviour is otherwise unchanged: a blank
warningis still omitted from the route,and a host that gives no reason still reads
Failed to create terminal. Quick-commandtoasts keep their labelled text; the reason goes to the inline error the empty state
renders.
Testing
tsc --noEmit,oxlintandoxfmt --checkclean;
check:code-quality:changedreports 0 new findings (incl. React Doctor) acrossall 10 changed files.
pre-fix state and re-ran: exactly the three new behavioural tests go red, one per
fix, and the two negative tests (blank warning omitted, generic fallback preserved)
stay green. Restored and re-verified at the rebased head.
Not fixed here (deliberately out of scope)
Two follow-ups this investigation turned up, both wider than "show the error":
prefersStructuredNativeChatByDefault()hasexactly two consumers -- the desktop renderer (
agent-launch-routing.ts) andorchestration worker-start. The
worktree.createstartup path never consults it, sowith structured native chat on, a desktop create gets an
agent-sessiontab while amobile create gets a PTY (
launchAgent: claude,viewMode: "chat"). That is why themobile create burned a pty it did not need and died first, while
Create Tab -> Claude(which does route structured) succeeded.
runtime-local-worktree-terminal-startup.ts, the fallback terminal is gated on!args.createdWithAgent, so when an agent workspace's startup terminal fails there isno fallback at all. Shared by desktop, CLI and mobile.