Repository navigation
fix(ui): keep agent file saves intact during refresh - #130468
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:28 PM ET / 23:28 UTC. ClawSweeper reviewWhat this changesThe PR centralizes Agent Files read/write settlement so stale refreshes cannot overwrite a confirmed save or restore obsolete file metadata. Merge readinessKeep open. Current main lacks this distinct response-ownership repair, and the patch has no supported correctness finding; it is maintainer-owned protected work with exact-head CI still incomplete. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Control UI’s Agent Files page reads and writes workspace files through Gateway APIs, then updates the editor and shared file-list cache. This change controls which delayed responses may publish into those visible states. flowchart LR
A[Agent Files editor] --> B[Read and write lifecycle]
B --> C[Gateway file APIs]
C --> D[Response ownership check]
D --> E[Shared file metadata cache]
D --> F[Editor draft and saved base]
E --> G[Agent Files UI]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +350, Docs +2. Total +358 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single capability-owned metadata publication and per-file revision boundary, then merge only after the exact PR head completes its required CI. Do we have a high-confidence way to reproduce the issue? Yes, source provides a focused delayed-read/delayed-list path in the Agent Files E2E suite; it was not executed here because this is a read-only review. Is this the best way to solve the issue? Yes. Moving confirmed metadata publication into the shared Agent capability removes the page-local split, while per-file write revisions reject the stale reads that caused the overwrite. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b17930af5432. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Read the current ClawSweeper review and rank-up move for e4ad93d.
Exact-head CI is still finishing. Two initial CI jobs were interrupted by runner shutdowns with exit 143, without lint diagnostics; they will be retried on the unchanged source before native preparation. No required gate is being bypassed. Named follow-up: ClawSweeper proof-harness terminal/output handling and changelog-based data-model classification should be investigated separately. The bot's live-proof lane is not counted as passing proof here. |
|
Exact-head CI is green for 2875ea9f2c664e6480fb8721bfd042015684424b: CI run33025302406 completed successfully, including all four browser shards, the real-Gateway lane, baseline ratchets, lint, types, build, and CI gate. Workflow Sanity also passed. The earlier manual fallback runs failed on runner shutdowns and a missing GitHub merge ref, not a source diagnostic. A later browser run exposed a separate existing test-fixture race; we reproduced it with the original assertion and repaired the fixture's request ownership instead of retrying unchanged tests. The final head passed85 focused owner/harness tests,14 Chromium flows, the full11-file changed gate, and a fresh isolated Codex review of the complete PR diff. No production behavior or timeout was changed by the fixture fixup. The latest ClawSweeper comment remains a review-started placeholder. The last completed review is under12hours old; its changelog and production-size dispositions are recorded above. Its failed outer proof harness is not counted as passing evidence. The public PR body includes inspected before/after images and the actual proof commands. Proceeding through the repository-native prepare and merge gates; no checks or enforced review rules are waived. |
|
Merged via squash.
|
* fix(ui): keep agent file saves intact during refresh * test(ui): hold catalog requests through recovery startup
What Problem This Solves
Fixes an issue where users saving files in Settings → Agents → Files would see older content return when an overlapping refresh finished. The write had succeeded on disk, but the editor's saved baseline and draft could be replaced by the stale read. A delayed file-list response or unrelated agent publication could also restore obsolete “missing file” metadata after the file was created.
Why This Change Was Made
File reads and writes now share one lifecycle owner that retires same-file reads at write admission and settlement. Confirmed results update the canonical agent-file metadata cache, retire older list requests, and rebuild the full list after invalidation. This removes the duplicate local metadata merge and the redundant post-save refresh. Read/write errors retain their own ownership instead of being overwritten by unrelated metadata publications.
Production LOC: +94/-88 (net +6). Tests and test support: +568/-71. The small production increase introduces the missing canonical metadata publication seam and per-file write ordering while consolidating the two request paths; there is no new configuration, dependency, storage format, or protocol change.
Provenance: the independent file read/write and local metadata paths date to commit 2a68bcb (2026-02-03; code author and committer @gumadeiras; no linked PR found). The shared-cache/page-cache split and metadata error copying were introduced in #100024 (2026-07-04; code author, PR author, and merger @shakkernerd), then carried forward with generation checks and post-save refresh in #102745 (2026-07-09; code author, PR author, and merger @steipete-oai). No bot merger was involved. This repair preserves the newer-draft protections from #105359 and the explicit refresh behavior from #127086.
User Impact
Successful saves stay visible when older requests settle. Newly created files remain present, newer unsaved typing is preserved, and failed saves or metadata rebuilds remain visible with the correct error. Explicit later refreshes still adopt current server content; switching agents and reconnecting do not leak results across owners.
Evidence
AI-assisted with Codex; the final source and proof were independently inspected. Fresh structured autoreview reported no actionable findings.
server revision 3. The same Chromium flow now retainsSaved latest instructions.pnpm ui:buildpassed, including 768 finalized sidecars and the startup performance budget: 341,458 bytes gzip against a 341,845-byte limit.Hosted CI also exposed an existing remembered-cloud-destination fixture race in the new-session browser suite. Four unchanged local runs passed, then a controlled recovery-scope schedule reproduced the exact failing assertion: the fixture held only the first catalog request, allowing a replacement request to receive the default empty catalog. An opt-in held-method fixture now releases all admitted requests together with consistent catalog data, preserving existing one-shot deferrals. The original browser assertion remains, with the problematic schedule made deterministic. Both new helper cases failed before the repair; all 15 helper tests and the 11-case browser file passed afterward. This adds no production behavior change or timeout increase.
Before: the older refresh restores stale text after a confirmed save.
After: the confirmed save remains visible after the older read settles.
After: a created file remains present after a stale list response and unrelated agent refresh.
Screenshots contain synthetic test data only. Exact-head CI and Workflow Sanity passed; repository-native preparation and merge completed at fc6cf5e6907d.