fix(desktop): process pending terminal setups for already-initialized workspaces#1322
Conversation
… workspaces WorkspaceInitEffects only processed pending terminal setups when a matching initProgress entry existed with step "ready". When start_claude_session was called via MCP for a workspace that was already initialized, no initProgress entry existed (it had been cleared after initial setup), so the pending terminal setup was never processed and the Claude session never started. Handle the case where a pending setup has no corresponding initProgress entry by treating the workspace as already ready and processing the setup immediately.
📝 WalkthroughWalkthroughAdds an immediate processing path in WorkspaceInitEffects to run terminal setup when no initProgress entry exists, and adjusts how Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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 |
…ing setup When start_claude_session appends a command to an existing pending terminal setup, `pending?.defaultPreset ?? null` coerces `undefined` to `null`. This prevents WorkspaceInitEffects from fetching the default preset from the backend (it only fetches when `defaultPreset === undefined`). Use a ternary to preserve the original value: when an existing pending setup has `undefined`, keep it so the preset fetch still triggers.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
Two bugs fixed in the spawn Claude session flow:
Pending terminal setups never processed for already-initialized workspaces —
WorkspaceInitEffectsonly processed setups wheninitProgress[workspaceId].step === "ready". For workspaces that were already initialized,initProgresshad been cleared, so the pending terminal setup was never processed.Default preset silently lost when appending commands during initialization — When
start_claude_sessionappended a command to an existing pending setup (created byuseCreateWorkspace),pending?.defaultPreset ?? nullcoercedundefinedtonull. SinceWorkspaceInitEffectsonly fetches the preset from the backend whendefaultPreset === undefined, this prevented preset application.Changes
WorkspaceInitEffects.tsx: Process pending terminal setups immediately when noinitProgressentry exists (workspace already initialized)start-claude-session.ts: Use ternary to preserveundefinedvsnulldistinction fordefaultPresetTest plan
start_claude_sessionvia MCP for an already-initialized workspace and verify Claude session startscreate_workspacethenstart_claude_sessionin quick succession and verify both workspace init commands AND Claude session run, with default preset appliedstart_claude_subagentfor the active workspace and verify it still worksSummary by CodeRabbit