Repository navigation
fix(test): collect Bun garbage outside promise microtasks - #159975
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: blocked before merge. Reviewed September 29, 2026, 9:25 PM ET / September 30, 2026, 01:25 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR moves Bun garbage collection in the shared Control UI test helper into a native immediate callback, leaving the Node path and leak assertions intact. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main still collects Bun garbage from a Promise continuation, and the merged plugin-retention repair does not change this UI helper. The focused patch has no supported blocking defect. Priority: P2 Review scores
Verification
How this fits togetherControl UI retention tests create weak references to objects used by chat, usage, and desktop views. A shared test helper forces garbage collection before those tests check whether objects were released or retained. flowchart LR
A[UI retention tests] --> B[Weak references]
B --> C[Shared GC helper]
C --> D{Test runtime}
D -->|Bun| E[Immediate callback GC]
D -->|Node| F[Node collection path]
E --> G[Retention assertions]
F --> G
Decision needed
Why: The author explicitly stopped automerge and requested human review; this review cannot reverse that pause. Before merge
Agent review detailsSecurityNone. PR surfaceTests +10. Total +10 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one shared UI test helper that collects at a stable Bun task boundary while preserving the existing Node behavior and weak-reference checks. Do we have a high-confidence way to reproduce the issue? Unclear for the two original CI assertions: neither reproduced in focused baseline runs. The PR reports a controlled before/after Bun reproduction of the same helper's retention mechanism with an overview object. Is this the best way to solve the issue? Yes. Moving the existing Bun collection into the native callback is a narrow repair to the shared test helper and leaves the Node path and leak assertions intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 452c808d5b1b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
@clawsweeper automerge |
|
🦞🧹
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
Re-review progress:
|
|
@clawsweeper stop |
|
🦞✅ I added |
|
Related companion work: #160200 applies the native-callback GC correction to the plugin-retention fixture, and #160213 incorporates it alongside a separate production disposal-retention fix. The plugin-retention suite passed 10/10 under the pinned CI Bun runtime with its collection bounds and assertions unchanged. This PR applies the correction to the independent UI GC helper and UI tests. Those paths are not changed by #160213, so it does not supersede this PR. Keep this PR open; no UI test fix or broad production-memory resolution is being claimed by the plugin repair. |
Run the existing single collection in the native immediate callback so settled async values are not conservatively rooted by the promise drain stack. Preserve Node behavior, CI runtime routing, and leak assertions. Repeated consumers, three full partitioned shards, historical leak controls, selected checks and independent review passed.
a15996e to
816fac8
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…59975) Run the existing single collection in the native immediate callback so settled async values are not conservatively rooted by the promise drain stack. Preserve Node behavior, CI runtime routing, and leak assertions. Repeated consumers, three full partitioned shards, historical leak controls, selected checks and independent review passed.
What Problem This Solves
Fixes false retention failures in Bun GC tests when collection runs inside a Promise continuation that can still retain completed async values.
User Impact
Leak regression tests collect at a stable event-loop boundary. Product behavior and the existing Node/Bun test partition remain unchanged.
Why This Change Was Made
The helper performs the same single
Bun.gc(true)call directly in the nativesetImmediatecallback, then resolves the waiting Promise. The Node path, leak assertions, collection controls, and number of collections are preserved.Evidence