Skip to content

fix: refresh clean file previews when reopened - #148157

Merged
steipete merged 1 commit into
mainfrom
codex/qa-clean-preview-refresh
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-clean-preview-refresh

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

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.

Before: reopening retains outdated file contents

After: reopening shows the latest saved file contents

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 7:16 AM ET / 11:16 UTC (Revision 2).

ClawSweeper review

What this changes

Refreshes 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
Reviewed head: a993b9897db71ac8c1fcb56e49127fbe61253097

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with inspected visual evidence, meaningful race coverage, and no blocking correctness finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The inspected before/after screenshots show changed file contents in the same preview, supported by the captured live QA account of reopening a transcript link after an agent update and preserving drafts. Race tests provide supplemental coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The inspected before/after screenshots show changed file contents in the same preview, supported by the captured live QA account of reopening a transcript link after an agent update and preserving drafts. Race tests provide supplemental coverage.
Evidence reviewed 8 items Current main still needs the fix: At fetched main, openWorkspaceItem returns when a retained preview differs from the new loading request, before calling load(). Reopening an already-loaded file therefore does not reread it.
Introduced refresh and race protection: Explicit file opens enable revalidation. Publication checks the retained preview, request order, workspace scope, draft state, and captured content/hash; canonical aliases reconcile into the existing tab without taking a newer selection.
Save ownership and regression coverage: Successful saves update the retained content object and hash. The embedded-panel regression holds an older read pending across a newer edit/save and checks that the mounted editor and newer text survive; workspace tests additionally cover drafts, alias response ordering, closed tabs, reconnects, and unrelated listing errors.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +127, Tests +238, Docs 0. Total +365 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 278 151 +127
Tests 3 250 12 +238
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 529 164 +365

Review metrics

Metric Value Why it matters
Production versus test growth Production +127 lines; tests +238 lines net Production growth implements ordered revalidation and draft/save guards while moving existing ownership code; test growth covers the resulting races.

Technical review

Best 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.

Labels

Label justifications:

  • P2: Stale reopened previews are a bounded Control UI correctness problem with a focused repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The inspected before/after screenshots show changed file contents in the same preview, supported by the captured live QA account of reopening a transcript link after an agent update and preserving drafts. Race tests provide supplemental coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The inspected before/after screenshots show changed file contents in the same preview, supported by the captured live QA account of reopening a transcript link after an agent update and preserving drafts. Race tests provide supplemental coverage.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The inspected before/after screenshots show changed file contents in the same preview, supported by the captured live QA account of reopening a transcript link after an agent update and preserving drafts. Race tests provide supplemental coverage.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-14T10:30:47.201Z sha 5651ac9a660a5abdf6dbb6ebfebf92b550a4ccc0 :: needs changes before merge. :: none

@steipete
steipete force-pushed the codex/qa-clean-preview-refresh branch from 5651ac9 to a993b98 Compare September 14, 2026 11:06
@steipete
steipete marked this pull request as ready for review September 14, 2026 11:06
@steipete
steipete merged commit ecfd906 into main Sep 14, 2026
175 of 178 checks passed
@steipete
steipete deleted the codex/qa-clean-preview-refresh branch September 14, 2026 12:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant