Skip to content

Hook DiffStateModel to remote server#10470

Merged
MaggieShan merged 5 commits into
masterfrom
maggs/hook-diffstatemodel-to-server
May 12, 2026
Merged

Hook DiffStateModel to remote server#10470
MaggieShan merged 5 commits into
masterfrom
maggs/hook-diffstatemodel-to-server

Conversation

@MaggieShan
Copy link
Copy Markdown
Contributor

@MaggieShan MaggieShan commented May 8, 2026

Description

  • Built on Add proto messages for remote DiffStateModel #10428
  • Adds the server-side changes to support DiffStateModel and git states on remote environments
    • Adds type conversions
    • Adds a GlobalDiffStateModel to track each LocalDiffStateModel per repo_path, diff_mode
    • Adds subscription to repositories to send server messages
    • Adds handlers for client messages

Linked Issue

APP-4355

Testing

No-op

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 title hook diffstatemodel to remote server Hook DiffStateModel to remote server May 8, 2026
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch from 6d72bb7 to 56a3a62 Compare May 8, 2026 13:37
@MaggieShan MaggieShan marked this pull request as ready for review May 8, 2026 14:19
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 8, 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 adds server-side diff-state models, proto conversions, subscriptions, and remote-client event forwarding for diff-state snapshots and deltas.

Concerns

  • New GetDiffState requests can be left pending forever when repo detection does not produce a LocalDiffStateModel event.
  • Immediate snapshots for already-loaded models drop content_at_head, so later subscribers do not receive the same renderable diff data as the initial async load.

Security

  • DiscardFiles forwards client-supplied file paths into destructive git restore/clean/stash behavior without validating that every path is repo-relative and contained by the requested repo.

Verdict

Found: 0 critical, 3 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/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/server_model.rs Outdated
Comment thread app/src/remote_server/server_model.rs Outdated
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch 2 times, most recently from d837ed7 to 04a8618 Compare May 8, 2026 16:28
@MaggieShan MaggieShan force-pushed the maggs/diffstatemodel-protos branch from d72a06a to faad40b Compare May 8, 2026 21:32
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch 3 times, most recently from 1f57582 to 7e9e78e Compare May 8, 2026 22:47
@MaggieShan MaggieShan force-pushed the maggs/diffstatemodel-protos branch from faad40b to 527e04a Compare May 11, 2026 13:33
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch from 7e9e78e to f4013d8 Compare May 11, 2026 13:37
@MaggieShan MaggieShan force-pushed the maggs/diffstatemodel-protos branch from 527e04a to 672bfdb Compare May 11, 2026 14:15
Base automatically changed from maggs/diffstatemodel-protos to master May 11, 2026 15:24
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch 3 times, most recently from 5b7dab4 to f90b9ce Compare May 11, 2026 18:32
@MaggieShan
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 11, 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

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 server-side diff-state subscriptions, proto conversions, and discard-files handling for remote environments.

Concerns

  • DiscardFilesResponse reports success before the async git operation completes, so failures are only logged and the client can present a false success state.
  • Client-controlled discard inputs need stronger validation before they reach destructive git operations.
  • Manual testing is required for changes that can be manually tested. Please include screenshots or a screen recording that show the remote diff/discard flow working end to end, or justify why manual testing is not possible.

Security

  • Renamed-file old_path and branch_name are accepted from the client without enough validation before being passed into git restore/checkout paths.

Verdict

Found: 0 critical, 3 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/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/server_model.rs
m.discard_files(file_infos, msg.should_stash, msg.branch_name, ctx);
});

HandlerOutcome::Sync(server_message::Message::DiscardFilesResponse(
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] This returns success before the async git restore/stash finishes; discard_files only logs failures, so clients can report a successful discard while files remain unchanged. Keep the request pending until the git result and return an error on failure.

Copy link
Copy Markdown
Contributor Author

@MaggieShan MaggieShan May 11, 2026

Choose a reason for hiding this comment

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

The current request and response set up is closer to an ack than an actual success - this follows the local model which currently also doesn't handle success or errors. Alternatively, can update this to a fire and forget client message - don't have a strong opinion for this

@MaggieShan MaggieShan requested a review from kevinyang372 May 11, 2026 20:01
conn_id: ConnectionId,
ctx: &mut ModelContext<Self>,
) -> HandlerOutcome {
let Some(mode_proto) = &msg.mode else {
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.

Mode should never be empty no? Should we enforce that in the proto schema?

Comment thread app/src/remote_server/server_model.rs Outdated
Comment thread app/src/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/diff_state_proto.rs Outdated
Comment thread app/src/remote_server/diff_state_tracker.rs Outdated
Comment thread app/src/remote_server/diff_state_tracker.rs Outdated
.iter()
.filter(|(_, conns)| conns.contains(&conn_id))
.map(|(key, _)| key.clone())
.collect_vec();
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.

Do we need to collect here?

Comment thread app/src/remote_server/server_model.rs Outdated
Comment thread app/src/remote_server/server_model.rs Outdated
@MaggieShan MaggieShan force-pushed the maggs/hook-diffstatemodel-to-server branch from b518a57 to 440c76e Compare May 12, 2026 09:17
@MaggieShan MaggieShan enabled auto-merge (squash) May 12, 2026 09:30
@MaggieShan MaggieShan merged commit adceb65 into master May 12, 2026
24 of 25 checks passed
@MaggieShan MaggieShan deleted the maggs/hook-diffstatemodel-to-server branch May 12, 2026 09:35
@MaggieShan MaggieShan mentioned this pull request May 12, 2026
2 tasks
cephalonaut pushed a commit that referenced this pull request May 12, 2026
## Description
* Built on #10428 
* Adds the server-side changes to support `DiffStateModel` and git
states on remote environments
  * Adds type conversions
* Adds a `GlobalDiffStateModel` to track each `LocalDiffStateModel` per
`repo_path`, `diff_mode`
  * Adds subscription to repositories to send server messages
  * Adds handlers for client messages

## Linked Issue

[APP-4355](https://linear.app/warpdotdev/issue/APP-4355/hook-up-diffstatemodel-to-remote-server)

## Testing
No-op 

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
dagmfactory pushed a commit that referenced this pull request May 12, 2026
## Description
* Built on #10428 
* Adds the server-side changes to support `DiffStateModel` and git
states on remote environments
  * Adds type conversions
* Adds a `GlobalDiffStateModel` to track each `LocalDiffStateModel` per
`repo_path`, `diff_mode`
  * Adds subscription to repositories to send server messages
  * Adds handlers for client messages

## Linked Issue

[APP-4355](https://linear.app/warpdotdev/issue/APP-4355/hook-up-diffstatemodel-to-remote-server)

## Testing
No-op 

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
MaggieShan added a commit that referenced this pull request May 14, 2026
## Description
* Built on #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