Fix a number of bugs that lead to duplicate requests on shared session load. - #15829
Fix a number of bugs that lead to duplicate requests on shared session load.#15829vorporeal wants to merge 6 commits into
Conversation
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
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 Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds in-flight guards to coalesce duplicate shared-session load requests across server metadata fetches, ancestor seed fetches, task harness fetches, and legacy viewer metadata fetches.
Concerns
- The request-deduplication regression is not covered by automated tests, and the PR description says manual HAR validation is still pending. These paths are model-level and already have nearby test hooks, so this should have a regression test before merge.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| return; | ||
| } | ||
| self.metadata_fetches.insert(task_id); | ||
| if !self.metadata_fetches.insert(task_id) { |
There was a problem hiding this comment.
metadata_fetch_dispatch_count is already available below, but the PR adds no regression test for duplicate triggers before the first request completes. Please add coverage that calls this path twice before completion and asserts only one metadata request is dispatched.

Description
Loading an agent shared session in the WASM client could issue many equivalent requests while reconstructing the session. A captured page load included 37 identical ancestor-list requests, 4–5 detail requests per run, and 9 identical conversation-metadata requests.
Several load-time events could re-enter these request paths before their first asynchronous response updated local state. Historical exchange replay also caused each completed exchange to attempt the same conversation-level metadata fetch.
This change coalesces requests at the narrowest existing ownership points:
The task-harness path keeps its direct server request. The shared task cache does not provide request-specific completion callbacks or explicit freshness semantics, so using it here would expand the change and could return stale task state.
Each commit contains one independent fix to simplify review.
Linked Issue
No linked issue.
ready-to-specorready-to-implement. — No linked issue.Testing
cargo fmt -p warp -- --checkcargo check -p warpNo automated tests were added. These changes add narrow in-flight guards to existing request paths.
Manual validation is pending. The planned check is to reload the same shared session and compare a new HAR with the original request counts.
I have manually tested my changes locally with
./script/run— Pending HAR-based validation in the WASM client.Agent Mode
CHANGELOG-BUG-FIX: Fixed duplicate network requests when loading agent shared sessions.