Repository navigation
fix(gateway): avoid preview errors during worker metadata updates - #157943
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 25, 2026, 2:11 AM ET / 06:11 UTC (Revision 2). ClawSweeper reviewWhat this changesAllows Gateway session previews during worker metadata commits when the conversation attachment is unchanged, and adds regression tests and storage documentation. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open. Current main still has the reported preview fence, and this branch is a viable focused fix. The prior request for measured test costs has been addressed. Priority: P2 Review scores
Verification
How this fits togetherGateway session previews route an authorized browser request through a node to a worker's HTTP app. The Gateway reads worker attachment facts from a projection published after SQLite worker commits. flowchart LR
A[Browser preview request] --> B[Gateway session access]
C[SQLite worker commit] --> D[Attachment projection]
B --> D
D --> E{Attachment unchanged?}
E -->|Yes| F[Node and app stream]
E -->|No| G[Read fenced until publication]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +34, Tests +183, Docs +4. Total +221 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the complete attachment-record comparison in worker commit admission and projection publication, while retaining live session, environment, lease, and node checks before preview dispatch. Do we have a high-confidence way to reproduce the issue? Yes. Hold an unchanged worker metadata commit before projection publication and fetch its existing session preview; current-main source shows the read fence. This read-only review did not execute the test. Is this the best way to solve the issue? Yes. Comparing the worker's complete attachment postimage is a narrow repair, and existing live checks still govern the final preview connection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c1051da16eff. LabelsLabel changes:
Label 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)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…4-prep * commit '8fe893da516ebdc817692fb2d272e27bc3c88376': (31 commits) fix(test): wait for reload admission before restart polling (#157964) refactor(mattermost): reuse DM retry option selection (#157800) chore(i18n): refresh native locales (#157850) perf(sessions): reuse current participants across transcript appends (#157622) refactor(signal): share pending transport migration results (#157777) fix(tui): open model pickers without waiting for the Gateway (#157839) fix(gateway): apply config despite delayed file notifications (#157906) fix(auth): clear deleted account selections and support account recovery (#157745) fix: plugin reloads lose tool results and strand subagent settlement (#157339) fix(gateway): avoid preview errors during worker metadata updates (#157943) refactor(diffs): reuse native promisify for compression (#157835) fix(models): keep current choices on the first picker page (#157869) fix(plugins): retain existing quarantine across unrelated reloads (#157907) fix(openai): prioritize ChatGPT sign-in and clarify auth choices (#157792) chore(ui): refresh control ui locales (#157955) fix(ui): refresh connected accounts after auth changes (#157950) fix(scripts): avoid redundant npm version process in package checks (#157809) refactor(usage): capture hosted pricing once per operation (#157838) refactor(ui): share slash-command failure results (#157649) fix(cron): announce runs miss the channel's formatting rules (#157877) ...
Related: #154069
What Problem This Solves
Fixes intermittent “Waiting for app” responses when a session preview opens while unchanged worker metadata is being published.
User Impact
Session previews remain available during metadata reconciliation. Attachment replacement, closure, activity changes, and session revocation retain their existing fences. No configuration, schema, or migration changes are required.
Why This Change Was Made
The worker inventory fenced attachment reads for every pending environment write. The existing native commit admission now includes equality evidence for the complete attachment record, including its activity timestamp. The projection permits the read only when that record is unchanged and keeps the digest within its existing publication and disposal lifecycle.
Evidence
Single-worker costs on Linux / Node 24.21.0, measured with
node scripts/run-vitest.mjs <file> --maxWorkers=1(wall time includes preparation and verification):src/gateway/server.portals.session.test.tssrc/gateway/worker-environments/store-projection.test.tssrc/gateway/worker-environments/store-worker.test.tsReady-event product CI passed for this head in 872 seconds of total workflow wall time, including its parallel jobs. The skipped draft run is excluded. All runtime proof used synthetic state and temporary listeners.