Skip to content

Add RemoteDiffStateModel#10489

Merged
MaggieShan merged 8 commits into
masterfrom
maggs/add-remotediffstatemodel
May 14, 2026
Merged

Add RemoteDiffStateModel#10489
MaggieShan merged 8 commits into
masterfrom
maggs/add-remotediffstatemodel

Conversation

@MaggieShan
Copy link
Copy Markdown
Contributor

@MaggieShan MaggieShan commented May 8, 2026

Description

  • Built on Hook DiffStateModel to remote server #10470
  • Adds client-side wiring to support git states and the code review view in remote environments
    • Moves shared types out of LocalDiffStateModel
    • Updates RemoteDiffStateModel with real logic to handle and emit the server events
    • Update RemoteServerManager to handle server events and send client events
    • Note: UI for reconnection is still tbd

Linked Issue

APP-4356

Testing

Should be no-op. Confirmed all unit tests are passing as expected.

  • I have manually tested my changes locally with ./script/run

Agent Mode

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

@cla-bot cla-bot Bot added the cla-signed label May 8, 2026
@MaggieShan MaggieShan changed the base branch from master to maggs/hook-diffstatemodel-to-server May 8, 2026 16:30
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch 7 times, most recently from 5b7dab4 to f90b9ce Compare May 11, 2026 18:32
@MaggieShan MaggieShan force-pushed the maggs/add-remotediffstatemodel branch from 6ddb274 to 2a27a41 Compare May 11, 2026 21:08
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch from b518a57 to 440c76e Compare May 12, 2026 09:17
Base automatically changed from maggs/hook-diffstatemodel-to-server to master May 12, 2026 09:35
@MaggieShan MaggieShan force-pushed the maggs/add-remotediffstatemodel branch 5 times, most recently from 4a6ae9a to c0d25df Compare May 12, 2026 21:03
@MaggieShan MaggieShan marked this pull request as ready for review May 12, 2026 21:03
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 12, 2026

@MaggieShan

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 wires remote diff state snapshots, metadata updates, file deltas, and discard/unsubscribe requests through the remote client and manager so the code review view can operate against remote repositories.

Concerns

  • Remote reconnects can leave RemoteDiffStateModel stuck on a stale subscription because reconnectable disconnects emit HostDisconnected before any SessionDisconnected clears session_id, then the HostConnected handler refuses to re-subscribe.
  • The change affects user-visible remote code review behavior, but the PR only notes ./script/run and includes no screenshot, screen recording, or justification for why visual/manual evidence is not possible.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

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

Powered by Oz

Comment thread app/src/code_review/diff_state/remote.rs Outdated
@MaggieShan MaggieShan requested a review from kevinyang372 May 12, 2026 21:25
@MaggieShan MaggieShan force-pushed the maggs/add-remotediffstatemodel branch from 4625580 to cdf34d2 Compare May 12, 2026 22:34
Comment thread app/src/code_review/diff_state/remote.rs Outdated
/// The session through which the current server-side subscription
/// was established. Used to detect subscription loss when a specific
/// session disconnects while other sessions to the same host survive.
session_id: Option<SessionId>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmmm why do we hold an Optional SessionId here given we already have the HostId? What does it mean when this is None?

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.

As discussed offline - the SessionId is still needed as we're also tracking ConnectionId on the server to handle which subscribers to fan events out to. Instead, I'll update the logic such that SessionId is required for a RemoteDiffStateModel

Comment thread app/src/code_review/diff_state/remote.rs Outdated
repo_path,
mode,
..
} => Some((host_id, repo_path, mode)),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

RemoteServerManager should be responsible for converting from proto type to actual in app type

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.

As discussed offline - the issue is that a lot of these proto types are defined in app/ which the RemoteServerManager doesn't have access to since its in the remote-server crate

Comment thread app/src/code_review/diff_state/remote.rs Outdated
Comment thread app/src/code_review/diff_state/remote.rs Outdated
Comment thread app/src/code_review/diff_state/remote.rs Outdated
Comment thread app/src/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/diff_state_proto.rs
Comment thread app/src/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/diff_state_proto.rs Outdated
Comment thread crates/remote_server/src/manager.rs Outdated
@MaggieShan MaggieShan force-pushed the maggs/add-remotediffstatemodel branch from 905c6f7 to 78685f2 Compare May 13, 2026 22:43
@MaggieShan
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 13, 2026

@MaggieShan

I'm re-reviewing this pull request in response to a review 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

@MaggieShan MaggieShan requested a review from kevinyang372 May 13, 2026 22:44
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 the remote-backed diff state model, remote server diff-state request/response wiring, and code review handling for remote diff lifecycle events.

Concerns

  • Remote diff models are removed on disconnect, so the reconnect handler cannot find the existing model to resubscribe and active code review views can remain stuck on stale disconnected state.
  • This changes user-facing remote code-review behavior, but the PR description does not include screenshots or a screen recording demonstrating the remote diff/code review flow end to end.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

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

Powered by Oz

/// to `get_or_create_diff_state_model` lazily creates a fresh one bound
/// to a currently-connected session.
fn mark_and_remove_remote_model(&mut self, key: &FileLocation, ctx: &mut ModelContext<Self>) {
let Some(model) = self.diff_state_models.remove(key) else {
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.

⚠️ [IMPORTANT] Removing the disconnected model prevents SessionReconnected from finding it to resubscribe, so existing code review views keep a stale handle in Disconnected state until the view is recreated. Keep the model cached and mark it disconnected, or explicitly recreate/rebind active views on reconnect.

Comment thread app/src/code_review/diff_state/mod.rs Outdated
Comment thread app/src/code_review/diff_state/remote.rs Outdated
@MaggieShan MaggieShan force-pushed the maggs/add-remotediffstatemodel branch from c714e38 to 706678d Compare May 14, 2026 00:14
@MaggieShan MaggieShan enabled auto-merge (squash) May 14, 2026 00:15
@MaggieShan MaggieShan merged commit 3239e96 into master May 14, 2026
25 checks passed
@MaggieShan MaggieShan deleted the maggs/add-remotediffstatemodel branch May 14, 2026 04:31
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
## Description
* Built on warpdotdev#10470
* Adds client-side wiring to support git states and the code review view
in remote environments
  * Moves shared types out of `LocalDiffStateModel` 
* Updates `RemoteDiffStateModel` with real logic to handle and emit the
server events
* Update `RemoteServerManager` to handle server events and send client
events
  * Note: UI for reconnection is still tbd 

## Linked Issue

[APP-4356](https://linear.app/warpdotdev/issue/APP-4356/create-remotediffstatemodel-for-the-client)

## Testing
Should be no-op. Confirmed all unit tests are passing as expected. 

- [x] I have manually tested my changes locally with `./script/run`

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
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