Skip to content

fix: recover shared-session viewer initial joins#12140

Open
captainsafia wants to merge 6 commits into
masterfrom
oz/remote-1661-shared-session-join-specs
Open

fix: recover shared-session viewer initial joins#12140
captainsafia wants to merge 6 commits into
masterfrom
oz/remote-1661-shared-session-join-specs

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

@captainsafia captainsafia commented Jun 3, 2026

Description

  • Add the PRODUCT and TECH specifications for recoverable initial shared-session viewer joins.
  • Retry transient websocket/connect failures before the viewer receives its initial join acknowledgement, with bounded exponential backoff and stale-attempt protection.
  • Transition failed initial joins to an in-pane error surface instead of leaving the pane loading indefinitely, exposing same-pane Retry only for recoverable failures.
  • Stop heartbeat work between attempts and keep established-session reconnect semantics separate from initial join recovery.

Linked Issue

Demo

Testing

  • ./script/format --check
  • cargo check --manifest-path Cargo.toml -p warp --tests
  • cargo test --manifest-path Cargo.toml -p warp initial_join -- --nocapture
  • cargo test --manifest-path Cargo.toml -p warp failed_viewer_join -- --nocapture
  • cargo clippy --manifest-path Cargo.toml --workspace --exclude warp_completer --all-targets --tests -- -D warnings
  • cargo clippy --manifest-path Cargo.toml -p warp_completer --all-targets --tests -- -D warnings
  • Attempted ./script/presubmit; its full-workspace cargo test --no-run phase was terminated by SIGKILL in the sandbox after formatting and Clippy completed successfully.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

Co-Authored-By: Oz oz-agent@warp.dev

Conversation: https://staging.warp.dev/conversation/a5926e17-47ce-4726-a86b-aa2da38db2bc
Run: https://oz.staging.warp.dev/runs/019e8e03-950a-7cc7-9bde-6662dcf1932d
Plans:

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 3, 2026
Co-Authored-By: Oz <oz-agent@warp.dev>
@captainsafia captainsafia changed the title docs: add REMOTE-1661 viewer join recovery specs fix: recover shared-session viewer initial joins Jun 3, 2026
captainsafia and others added 2 commits June 3, 2026 19:20
Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
@captainsafia captainsafia marked this pull request as ready for review June 3, 2026 22:41
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Jun 3, 2026

@captainsafia

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a recoverable initial shared-session viewer join lifecycle: transient pre-ack transport failures now retry with bounded backoff, failed initial joins transition to an in-pane error state, retryable failures can be retried in the same pane, and established-session reconnect behavior remains separate.

Concerns

  • No blocking correctness, security, or approved-spec-drift concerns found in the annotated diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@captainsafia captainsafia requested a review from seemeroland June 3, 2026 22:58
@captainsafia
Copy link
Copy Markdown
Contributor Author

@seemeroland There's a small overlap in the diff between this and what you're doing in #12111 but this addresses an issue with the viewers joining the session share as opposed to initializing the session share.

Copy link
Copy Markdown
Contributor

@seemeroland seemeroland left a comment

Choose a reason for hiding this comment

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

Nice!

initial_load_mode: SharedSessionInitialLoadMode,

stage: Stage,
initial_join_attempt_id: u64,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can move this state within Stage::BeforeJoined since they're strongly coupled. Would also simplify some of the checks checking against that stage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call! Fixed this.

if can_retry_failed_initial_join {
Self::update_current_network(&current_network, ctx, |network, ctx| {
model.lock().set_write_to_pty_events_for_shared_session_tx(
network.write_to_pty_events_tx(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we actually need to store the write_to_pty_events_tx on the network to reset it here on retry? I thought this would be the same terminal manager which would have already set the same write_to_pty_events_tx before creating the network

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was aiming for symetry with the receiver here but you're right that the network doesn't actually do anything with the sender at the moment outside of relying it to he terminal manager. I think it's probably fine to split the two up.

captainsafia and others added 2 commits June 4, 2026 16:03
Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to 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.

2 participants