Repository navigation
fix: avoid worker OOMs in full Gateway-core test runs - #148971
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. |
712df62 to
f7342f5
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 9:20 AM ET / 13:20 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR gives Gateway-core tests isolated workers, preserves awaited resource cleanup, and adds coverage for database closure and stale cross-file listeners. Merge readiness✅ Ready for maintainer review The repair remains useful: current main still shares Gateway-core workers and skips cleanup for isolated files. No actionable introduced defect was found, and the recorded full-run evidence supports the change. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s test runner executes Gateway test files and cleans up their databases, callbacks, and asynchronous resources. Worker isolation determines whether later files can inherit earlier files’ runtime state. flowchart TD
A[Gateway test files] --> B[Gateway-core test configuration]
B --> C[Isolated Vitest worker]
C --> D[Test cases and afterAll hooks]
D --> E[Await resource cleanup]
E --> F[Worker retirement]
F --> G[Next file in fresh worker]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +198. Total +198 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep Gateway-core workers isolated and drain resources through the existing lifecycle owner before retirement, preserving shared-worker policies for the other Gateway projects. Do we have a high-confidence way to reproduce the issue? Yes for the lifecycle defect: the real two-file fixture exposes retained listeners and missing database cleanup, with failing controls recorded in the PR. This read-only review did not independently reproduce the full-run OOM. Is this the best way to solve the issue? Yes. The patch uses existing isolation and cleanup owners, preserves sibling execution policies, and avoids changing production listener lifetimes to accommodate test module resets. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 83c1767446cb. LabelsLabel 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)
|
f7342f5 to
1c81ed2
Compare
|
Merged via squash.
|
* fix: avoid worker OOMs in full Gateway-core test runs * test: retain Gateway isolation policies in routing checks
Related: #139428
What Problem This Solves
Full Gateway-core test runs can retain stale listeners between files and exhaust worker memory before completing.
User Impact
There is no user-visible product change. Gateway-core test files get separate workers, with their databases and asynchronous resources drained before the next file runs. Per-file isolation repeats imports and can increase startup cost; no overall speedup is claimed.
Why This Change Was Made
Resetting a module graph does not retire callbacks retained by process-global database lifecycle state. Enable isolation for Gateway-core while retaining the custom runner's awaited cleanup, and move its isolated return after that cleanup. The existing nonisolated cleanup remains intact; production lifecycle ownership is unchanged.
The regression runs two real test files. The first leaves a live database and provenance listener through
afterAll; the second requires the prior database and asynchronous resource to have drained and verifies that its events never reach the retired listener.Evidence
The original shared-worker control fails on a stale notification. Isolation without the drain fails on missing database closure. The repaired runner passes both obligations, 135 runner/config tests, and 458 isolated-method tests across nine files.
Before the mechanical main refresh, the full Linux command passed all 670 selected files: 11,123 tests passed, eight existing Windows/Bun cases were skipped, and none failed. All 670 observed workers exited. Complete artifacts, source bindings, and lease cleanup were verified. Test wall time was 33 minutes 20 seconds without OOM; GNU time recorded 5.05 GiB maximum RSS for the waited command, not a summed process-tree peak. Delegated Testbox workflow owns the lease and ends during cleanup; the native test command exited zero.
Mapped checks passed after a braces-only lint correction, and fresh independent review found no actionable P0–P2 findings. Fresh required CI is pending after including #149049's already-landed thinking-route auth-fixture repair; the prior run used an older main snapshot and failed those six fixture cases. A local timing pair overlapped unrelated log retrieval and is not evidence of a speedup. The routing contract now explicitly checks isolated core workers and shared database/server/method workers while retaining common hooks and file ownership. All 176 routing/config tests, the 16 mapped checks, and independent review passed for that correction. The refresh onto main preserves both commit patches and all four runner/config postimages; new-head hosted CI must validate the refreshed dependency graph. This repair adds 198 physical test/support lines, to be deducted from the campaign when merged.