Skip to content

fix(tui): rehydrate sessions after reconnect - #37983

Closed
nxxxsooo wants to merge 2 commits into
anomalyco:devfrom
nxxxsooo:reconnect-hydration
Closed

fix(tui): rehydrate sessions after reconnect#37983
nxxxsooo wants to merge 2 commits into
anomalyco:devfrom
nxxxsooo:reconnect-hydration

Conversation

@nxxxsooo

Copy link
Copy Markdown

Issue for this PR

Closes#32175

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI could stop receiving events after a transient global SSE failure, and sessions already mounted before the gap remained stale after transport returned.

This change keeps those two concerns separate. The SDK provider retries rejected connections, iterator failures, and normal stream completion with bounded exponential backoff. Later server.connected epochs reconcile the authoritative session list/status and atomically refresh already-loaded session metadata, messages, parts, todo, and diff state. Confirmed deletions are pruned, failed hydration preserves prior state, and reconnect storms are serialized without overlapping passes.

This replaces #37957, which was automatically closed because its description did not use the required template sections.

How did you verify your code works?

  • Transport regression suite: 15 pass, 0 fail.
  • Reconnect coordinator: 6 pass, 0 fail; 120 pass across --rerun-each 20.
  • Hydration suites: 16 isolated and 5 live tests pass.
  • Full TUI package: 228 pass, 1 skip, 0 fail; package typecheck passes.
  • Fresh arm64 native build from 00470701974fa23189a34c63f61b1932f2a4f394: SHA-256 a1ddeef525be970223b354706bf240728c07d961932a129b70bf2718c9c3953b.
  • Two isolated proxy-gap cycles kept the same mounted attach PID, converged to direct REST state after restoration, and added exactly one server SSE lifecycle each. The second outage lasted 1.624 seconds, beyond the initial retry interval.
  • The temporary session/processes were removed, QA ports were freed, and production was not contacted or modified.

Screenshots / recordings

Not applicable. This fixes transport and store reconciliation behavior; the runtime check asserted the mounted TUI pane title before, during, and after each gap.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

nxxxsoooand others added 2 commits July 21, 2026 02:31
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSE reconnection never fires after initial connection failure

1 participant

@nxxxsooo