Skip to content

fix: resolve session resumption in Blox by passing branchId and making resume async#430

Merged
matt2e merged 5 commits intomainfrom
continue-session-in-blox
Mar 20, 2026
Merged

fix: resolve session resumption in Blox by passing branchId and making resume async#430
matt2e merged 5 commits intomainfrom
continue-session-in-blox

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Mar 20, 2026

Summary

  • Pass branchId from the UI to resumeSession so the backend can resolve workspace_name and remote_working_dir when resuming a remote session
  • Make resume_session async to avoid blocking the Tauri event loop
  • Show a spinner in the Send button while a message is being sent and prevent a visual tear when entering the sending state

Test plan

  • Resume an existing session in Blox and verify it connects to the correct remote workspace
  • Verify the Send button shows a spinner while sending and transitions smoothly

🤖 Generated with Claude Code

matt2e and others added 5 commits March 20, 2026 16:55
…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>
@matt2e matt2e requested review from baxen and wesbillman as code owners March 20, 2026 06:19
@matt2e matt2e merged commit 1e9d938 into main Mar 20, 2026
4 checks passed
@matt2e matt2e deleted the continue-session-in-blox branch March 20, 2026 06:22
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +228 to +245
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"]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant