Repository navigation
fix: refresh clean file previews when reopened - #148157
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 7:16 AM ET / 11:16 UTC (Revision 2). ClawSweeper reviewWhat this changesRefreshes existing file-preview tabs when reopened, while preserving unsaved drafts, newer saves, and the user's selected tab. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still retains stale contents when an existing file is reopened. No blocking defect was found, and the previous draft/CI prerequisite is resolved. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI reads session workspace files through the Gateway and displays them in retained chat-side-panel tabs. The preview owner reconciles incoming file contents with local editor drafts and navigation. flowchart TD
A[Chat file link or Files row] --> B[Retained preview tab]
B --> C{Unsaved draft?}
C -->|Yes| D[Keep local edits]
C -->|No| E[Read file through Gateway]
E --> F[Check scope and newer edits]
F --> G[Refresh existing preview]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +127, Tests +238, Docs 0. Total +365 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep refresh decisions in the existing preview owner, with Gateway reads authoritative for clean files and local drafts protected until saved or discarded. Do we have a high-confidence way to reproduce the issue? Yes, from source: open a file, change it externally, and reopen its link; current main returns before rereading the retained preview. This review did not execute that scenario. Is this the best way to solve the issue? Yes. Extending the existing preview owner addresses the skipped read while preserving draft ownership, alias identity, newer saves, and navigation without adding configuration or another refresh mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6b3e342ddb1e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
5651ac9 to
a993b98
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes stale file previews when a user reopens a chat file link after the agent updates the file.
User Impact
Reopening a clean file refreshes its existing tab. Unsaved drafts, unchanged editor state, and newer reads or saves remain protected, including relative/absolute aliases.
Why This Change Was Made
Retained tabs previously skipped the read entirely. The preview owner now revalidates explicit opens, reconciles read order across aliases, and shares the saved buffer with the editor. Successful recovery clears only its own failed-read error.
Rebased unchanged onto main after the CI blocker was fixed upstream in #148129. Exact-head CI run 34836525290 passed. Native prepare and merge completed as ecfd906; the merged change is verified on main.
Evidence
Live model-backed QA updated an already-open file. Reopening its transcript link showed the new contents without closing the tab or reloading the page. Unsaved edits survived reopening; Discard restored the saved contents, with no UI errors.
83 focused tests and 19 Chromium editor/HTML tests passed, including original-failure regressions for stale content, overlapping aliases, saves during reads, and failed-read recovery. Affected type checks, typed lint, formatting, i18n, dead-export checks, UI build, and independent P2 review passed. Startup JavaScript is 357,189 B gzip across 7 requests.
Inspected synthetic before/after screenshots follow.