feat: queue sessions while workspace is provisioning#440
feat: queue sessions while workspace is provisioning#440
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e6fc77271
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| branch_id: Some(branch_id.clone()), | ||
| project_id: None, | ||
| session_type: None, |
There was a problem hiding this comment.
Populate project metadata when draining a queued session
When a queued branch session is started here, the emitted running event still has project_id: None. listenForSessionStatus only registers running sessions when eventProjectId is present (/workspace/builderbot/apps/staged/src/lib/listeners/sessionStatusListener.ts:40-47), and terminal events from emit_status do not include branch context (/workspace/builderbot/apps/staged/src-tauri/src/session_runner.rs:1012-1020). In a branch with 2+ queued items, the first drained session therefore completes as an unknown session, so handleSessionEnd never calls drainQueuedSessions for the next item and the queue stalls after one run.
Useful? React with 👍 / 👎.
| pub fn queue_branch_session( | ||
| store: tauri::State<'_, Mutex<Option<Arc<Store>>>>, | ||
| branch_id: String, | ||
| prompt: String, | ||
| session_type: BranchSessionType, | ||
| provider: Option<String>, | ||
| ) -> Result<BranchSessionResponse, String> { |
There was a problem hiding this comment.
Preserve image attachments when queueing a branch session
The modal submits imageIds for queued sessions (/workspace/builderbot/apps/staged/src/lib/features/sessions/NewSessionModal.svelte:107-109 and /workspace/builderbot/apps/staged/src/lib/features/branches/BranchCardSessionManager.svelte.ts:259-265), but this command has no image_ids parameter and never persists them. Later drainQueuedSessions is always invoked with imageIds: null (/workspace/builderbot/apps/staged/src/lib/commands.ts:572-577), so session_runner::start_session creates the eventual user message without any attachments (/workspace/builderbot/apps/staged/src-tauri/src/session_runner.rs:207-218). Queued commit/review sessions that rely on screenshots will silently lose that context.
Useful? React with 👍 / 👎.
| let review = store::Review::new(&branch_id, "", store::ReviewScope::Branch) | ||
| .with_session(&session.id); |
There was a problem hiding this comment.
Capture the review tip SHA before queueing review sessions
The normal review path stores the current tip SHA on the Review row (/workspace/builderbot/apps/staged/src-tauri/src/session_commands.rs:648-660), but the queued path hard-codes an empty commit_sha and drain_queued_sessions never patches it later. Opening that saved review reuses review.commitSha (/workspace/builderbot/apps/staged/src/lib/features/branches/BranchCard.svelte:392-399), and the local diff builder treats Some("") as the target rev instead of falling back to HEAD (/workspace/builderbot/apps/staged/src-tauri/src/diff_commands.rs:97-104). For queued reviews on local branches, the review can finish, but reopening its diff later points Git at an invalid ref.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ands Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ing, and startup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… timeline Queued sessions were previously misclassified as failed. Now they display "Queued" as their subtitle and sort after active rows in the branch card timeline (Completed < Active < Queued). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…egisters drained sessions When drain_queued_sessions started a queued session, it emitted the session-status-changed event with project_id: None and session_type: None. The frontend sessionStatusListener requires project_id to register a running session, so drained sessions were never tracked. When they later completed, the listener couldn't look up their branch_id, preventing drainQueuedSessions from being called for the next item in the queue. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add queued-commit, queued-note, and queued-review TimelineItemType variants so queued sessions display a Clock icon rather than a loading spinner, making it clear they are waiting rather than active. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a commit session completes and there are queued sessions waiting for the same branch, skip triggering the auto-review. The queued session takes priority and will be drained next instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…one spinners Replace the "Creating worktree…" loading div and the RemoteWorkspaceStatusView for 'starting' status with provisioning timeline rows that appear at the very start of the timeline with gray styling and a spinner icon, consistent with active session rows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6d46fb7 to
9ed0b8d
Compare
Summary
Queuedsession status variant so sessions can be created before a workspace is readyqueue_branch_sessionanddrain_queued_sessionsbackend commands to enqueue sessions and start them once the workspace is provisionedNewSessionModal,BranchCard,BranchCardSessionManager) to detect when a workspace isn't ready and queue sessions instead of starting them immediatelyTest plan
🤖 Generated with Claude Code