fix: resolve session resumption in Blox by passing branchId and making resume async#430
fix: resolve session resumption in Blox by passing branchId and making resume async#430
Conversation
…resolution The SessionModal component had a branchId prop but wasn't forwarding it to the resumeSession call, preventing the backend from determining the correct workspace for remote sessions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_session via branch_id The resume_session command previously derived workspace_name only from commit-linked sessions and always set remote_working_dir to None. This meant replying to a remote session (notes/reviews on remote branches) would fail because it spawned a local agent instead of going through blox. Add a branch_id parameter that, when provided, looks up the branch to get workspace_name directly and resolves remote_working_dir using the same resolve_branch_workspace_subpath + resolve_workspace_repo_path pattern used by start_branch_session. The commit-based derivation is kept as a fallback for backward compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…vent loop The resume_session command was synchronous, causing blocking I/O calls (ws_exec for remote HEAD SHA, resolve_branch_workspace_subpath, and resolve_workspace_repo_path) to run on the main thread. This could freeze the UI when resuming remote sessions. - Convert resume_session to async and wrap blocking I/O in spawn_blocking / run_blox_blocking, matching start_branch_session - Deduplicate the (pre_head_sha, workspace_name) resolution by unifying the branch_from_id and commit-fallback paths into a single branch lookup followed by shared resolution logic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Display a loading spinner in the Send button during the initial resumeSession call, and disable the button to prevent double-sends. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The disabled style (opacity: 0.3) was transitioning while the icon swapped instantly from Send to Spinner, causing a hard vertical line where half the button was greyed out. Keep full opacity during sending so the spinner is clearly visible and the transition is smooth. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c836793a3
ℹ️ 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".
| let (pre_head_sha, workspace_name) = { | ||
| // Determine the branch to use: explicit branch_id takes priority, | ||
| // otherwise fall back to the commit-linked branch. | ||
| let branch = if branch_from_id.is_some() { | ||
| branch_from_id.clone() | ||
| } else { | ||
| store | ||
| .get_commit_by_session(&session_id) | ||
| .ok() | ||
| .flatten() | ||
| .and_then(|commit| store.get_branch(&commit.branch_id).ok().flatten()) | ||
| }; | ||
|
|
||
| if let Some(ref branch) = branch { | ||
| let ws_name = branch.workspace_name.clone(); | ||
| let head = if let Some(ref ws) = ws_name { | ||
| crate::blox::ws_exec(ws, &["git", "rev-parse", "HEAD"]) | ||
| let ws = ws.clone(); | ||
| run_blox_blocking(move || crate::blox::ws_exec(&ws, &["git", "rev-parse", "HEAD"])) |
There was a problem hiding this comment.
Avoid probing HEAD for non-commit session resumes
When branch_id is present, this block now runs git rev-parse HEAD before transition_to_running for every branch-scoped follow-up, not just commit sessions. But run_post_completion_hooks only consumes pre_head_sha when store.get_commit_by_session(session_id) succeeds (apps/staged/src-tauri/src/session_runner.rs:506-509), so note/review/PR/push resumes pay for an unnecessary Blox round-trip. On a slow or sleeping workspace, those remote follow-ups will sit in the send spinner until this extra ws_exec returns or times out even though no commit tracking is needed.
Useful? React with 👍 / 👎.
Summary
branchIdfrom the UI toresumeSessionso the backend can resolveworkspace_nameandremote_working_dirwhen resuming a remote sessionresume_sessionasync to avoid blocking the Tauri event loopTest plan
🤖 Generated with Claude Code