Repository navigation
test(ui): stop new-session draft restore racing durable persistence - #125548
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 11:42 PM ET / August 18, 2026, 03:42 UTC. ClawSweeper reviewWhat this changesThe PR makes New Session browser E2E tests wait for the durable composer-draft record before reloading or completing an Incognito transition. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for maintainer landing. The patch correctly synchronizes the flaky browser E2E assertions with the IndexedDB commit they exercise; no actionable patch defect was found. The branch is mergeable but behind main and its aggregate gate remains queued. Priority: P3 Review scores
Verification
How this fits togetherControl UI persists unsent New Session text and attachments in browser-local IndexedDB, then restores them after a reload. The E2E suite drives the composer and verifies recovery through the same durable store. flowchart LR
A[Composer edit] --> B[New Session persistence]
B --> C[Browser IndexedDB]
D[E2E test] --> E[Durable draft check]
C --> E
E --> F[Reload or Incognito change]
F --> G[Draft restoration assertion]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +61, Tests +8. Total +69 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the durable-record readiness check and land it after the refreshed merge result and aggregate gate are green. Do we have a high-confidence way to reproduce the issue? Yes—current main visibly reloads after input without waiting for the asynchronous durable write, while the persistence owner commits through IndexedDB after that action returns. Is this the best way to solve the issue? Yes—the helper verifies the persisted snapshot itself, avoiding sleeps, retries, or weaker restoration assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1acabe40a99e. LabelsLabel 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)
|
2ba7bd1 to
9ffe05a
Compare
|
Land-ready verification for
Known proof gaps: none for this test-only change. Production LOC is +0/-0; E2E test and test-support LOC is +69/-0. |
|
Merged via squash.
|
What Problem This Solves
ui/src/e2e/new-session-page.prompt-attachments.e2e.test.ts("restores a text-only prompt in a fresh page")fails intermittently on CI — it blocked PR #125498 twice, once as a timeout and once as
AssertionError: expected '' to be 'restore this text-only prompt after r…'. The empty string is the tell:the draft was gone, not late.
git blameattributes these lines to6b72d65ffe4/ #125332, which introduced both durable draftpersistence and this test. That feature persists through
NewSessionDraftPersistenceinto the durablecomposer draft store, which is loaded by dynamic
import()and written asynchronously to IndexedDB. Sofill()returning proves only that the input holds the text — it says nothing about a snapshot existing. Areload that beats the write destroys the draft, and the poll then waits for a value that no longer exists.
Why This Change Was Made
The test synchronized on an action (
fillreturned) instead of on the state that action is supposed toproduce (a persisted snapshot). That is the same defect already fixed in #125441 (a pid file written before
the process was running) and #125456 (a Save click racing form-state commit); this is the third instance of
the pattern.
The fix waits on the persisted snapshot itself, using the existing exported
readDurableComposerDraftreader — scoped by gateway URL, recovery scope, and route parameters — and verifying the exact text and
attachment count after the IndexedDB transaction commits. Sibling cases that fill-then-reload get the same
treatment, including incognito retirement, which waits for its persisted tombstone.
Deliberately not done: raising the poll timeout, inserting a sleep, retrying the reload, or weakening the
assertion. Each would have stopped the failure without removing the race, leaving a test that passes whether
or not drafts actually survive a restart — which is the entire behavior #125332 shipped.
User Impact
None. Test-only; production is untouched.
Evidence
Ten consecutive runs, since one green run proves nothing about a race:
pnpm check:changedgreen; Codex autoreview clean.reviewMetrics — production vs test LOC: production
0, tests+69 / −0— pure addition, so no existingassertion was relaxed. The bulk is a reusable persisted-draft probe in
new-session-page.test-support.ts.No
CHANGELOG.mdedit — release-only per repo policy; test-only change.