Skip to content

Refresh Cloud transcript bindings when chat reconnects - #18038

Closed
azooz2003-bit wants to merge 5 commits into
fix/cloud-terminal-rpc-lifetimefrom
fix/cloud-transcript-reconnect-resolution
Closed

azooz2003-bit wants to merge 5 commits into
fix/cloud-terminal-rpc-lifetimefrom
fix/cloud-transcript-reconnect-resolution

Conversation

@azooz2003-bit

Copy link
Copy Markdown
Collaborator

When a Cloud Agent Chat page reconnects, the server previously reused its cached transcript session without consulting the current terminal hook record. If the agent resumed in another pane or its transcript path moved, Focus Terminal targeted the old pane and the page could keep tailing the old file.

Subscriptions now re-resolve terminal sessions first, refresh changed terminal bindings, reattach changed transcript paths, and fall back to cached history when the hook store is temporarily unavailable.

Depends on #16069 and targets fix/cloud-transcript-terminal-rebind.

Validation

  • Regression commit: 485660de8d3de3a416cf35a3afeba4c9f8f8c03c.
  • Fix head: 7285635d7dbc0426b602f743d1225a3138a37e63.
  • From agent-chat, bun test/transcript-reconnect.test.ts: red before the fix because reconnect Focus Terminal used OLD-SURFACE; green after the fix. Covers Claude and Codex, same-path binding refresh, changed transcript paths, new event delivery, and cached-history fallback during hook-store misses.
  • bun run check: passed (typecheck, 28 scripts, 44 tests across 13 bun:test files).
  • Production browser bundles for src/main.tsx and src/gallery-main.tsx: passed.
  • git diff --check 25677e569383a99a9fd3a898328b19b85b069797..HEAD: passed.

No live Cloud instance or browser validation.

Changelog

Fixed: Cloud Agent Chat reconnects now follow the agent's current terminal and transcript.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes Cloud Agent Chat reconnects so Focus Terminal and transcripts follow the agent's current terminal instead of a stale cached session. Previously the server reused its cached transcript session without consulting the terminal hook record; if the agent resumed in another pane or its transcript path moved, the page kept tailing the old file.

Subscriptions now re-resolve terminal sessions first, refresh changed terminal bindings, reattach changed transcript paths, and fall back to cached history only when the hook store is temporarily unavailable.

  • Swaps the session lookup order in the subscribe handler so the current hook record wins over the session cache.
  • Adds a regression test covering Claude and Codex, same-path rebinds, transcript path changes, new event delivery, and cached-history fallback.

Depends on #16069.

Written for commit 7285635. Summary will update on new commits.

Review in cubic


Migrated from #16070 after correcting the PR author identity. The original head commit 7285635 is preserved.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: faf197d2-bc00-4fe6-a54f-c6e54e71f808

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants