Repository navigation
fix(test): make retention checks portable across runtimes - #195091
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. What this changesThis PR replaces V8 heap queries in retention tests with portable garbage collection and specific-instance WeakRef assertions. Example: A plugin retention test has two pending registry instances.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides useful test portability work, with no actionable defect found, and remains under the author’s explicit draft hold. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherRetention fixtures exercise lifecycle owners, trigger collection through shared test support, and assert which created objects remain reachable. flowchart LR
A[Retention fixtures] --> B[Lifecycle owners]
B --> C[Tracked WeakRefs]
C --> D[Shared retention helper]
D --> E[Node or Bun collection]
E --> F[Exact live-instance assertions]
Technical reviewBest possible solution: Land the bounded caller migration after the support PR clears its hold, preserving the unchanged suites that still need runtime investigation. Do we have a high-confidence way to reproduce the issue? Current-main tests directly depend on V8 queryObjects, and the body reports the affected Node, stock Bun, and fork runs; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch uses the existing shared collector, preserves exact counts and bounded collection, and removes duplicate assertion implementations without production hooks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b595ee78e015. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +20, Other +1. Total +21 across 73 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 8, 2026, 2:28 AM ET / 07:28 UTC. |
55bdd38 to
b25bb5a
Compare
34d0599 to
1bc780d
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
#195158 un-exported forceFullGc and removed expectCollected as dead while #195091 concurrently added consumers (plugin-sdk/test-env, gateway session-collection test support, prepared-model-catalog inspection worker), breaking prod/test typecheck on main. Restore both exports; keep expectLiveObjects module-local so the dead-export scan stays clean.
|
Merged via squash.
|
…tooling-lint-selection-20261108 * commit 'b0e90e6a4b359fff7756698067fdce4758b1907b': (38 commits) fix(android): Talk button demands a realtime provider on a native Talk setup (#191194) chore: trace first-run Gateway work and verify later replies (#195185) fix(knowledge): keep deleted messages out of reply previews (#195126) fix(agents): preserve streamed replies across Gateway restarts (#195164) perf(ci): reuse SDK transport path boundaries (#195180) fix(sandbox): avoid pauses for unchanged command checkpoints (#195120) fix(test): make retention checks portable across runtimes (#195091) fix(knowledge): clarify temporal kind filters (#194995) improve: reduce Gateway allocation while draining SQLite receipts (#195129) fix: reduce streaming CPU after reply and voice directives (#195145) fix: reduce Markdown reparsing during streamed tool-call checks (#195161) fix: restore the main dead-export gate (#195158) improve(ci): pack small UI selections into fewer jobs (#195107) fix(muse): quota and sign-in failures end with no reply (#195148) fix: allow first release push with shipped patch bytes (#195174) fix(ci): narrow single-config tooling selections (#195147) fix(packaging): reject incompatible prepublish plugin cohorts (#195152) fix(ci): prepare verified Bun before parity checks (#195155) fix: Incognito agent turns stall before execution (#195005) fix: credentialed search and speech providers work without picking a provider (#195169) ...
…95091) * test: use portable retention checks across test suites * test: collect WebSocket callers outside promise frames * test: keep retention fixtures on supported test surfaces * test: distinguish retained instances from weak references * test: hold intermittent stock registry retention migration
openclaw#195158 un-exported forceFullGc and removed expectCollected as dead while openclaw#195091 concurrently added consumers (plugin-sdk/test-env, gateway session-collection test support, prepared-model-catalog inspection worker), breaking prod/test typecheck on main. Restore both exports; keep expectLiveObjects module-local so the dead-export scan stays clean.
Completes e003968: openclaw#195091 also imports expectLiveObjects from test-utils/retention in ten test files; keeping it module-local left test typecheck red on main. Verified with all 29 core test tsgo shards plus core tsgo.
Uses the shared GC support landed in #195064 (
754b41c65df0f72d3a6df1eb6abd810644b60190). Local runtime proof and fresh exact-head CI pass for the selected migrations.What Problem This Solves
Stock Bun lacks V8's
queryObjects, so these retention suites fail before checking whether callers and resources are released.User Impact
This changes tests and test support only. It migrates 68 test files, preserving the existing release checks and exact zero/one/multiple live-instance counts.
Why This Change Was Made
Use the existing shared retention owner and track each instance the test creates with WeakRefs. GC-only sites keep their existing job boundaries and collection budgets, including the conditional 20-turn inventory ceiling. The WebSocket test uses two native-callback collections so a suspended promise frame does not create false retention. The nested runner fixture uses the existing real-Node compiler resolver while its tests continue on the selected runtime. Extension tests consume the same GC owner through the existing SDK test-env entrypoint; fixture factories track plain objects where class identity is no longer needed.
The cutover removes 45 GC-only query sites and 36 class-count query sites, including the shared helper whose 15 assertions now use explicit WeakRef registries. No production hook, runtime version check, dependency, pin, or Bun admission change is added.
Reference: oven-sh/bun#46709
Evidence
Required runtimes: Node 26.12.1, stock Bun
2596ac5d3, and pinned fork191755ec1, throughscripts/run-vitest.mjswith one worker. At head837a8bae394, full 72-file runs pass Node (547.93s), fork (534.91s) and first stock (493.57s). Second stock completes in 375.92s with one failure in the now-held registry file. All 71 files in the landing selection (68 caller tests plus three runner suites) pass in all four runs. The failed full stock run remains recorded as failed.CI repairs for private extension-test imports, constructor-only fixture classes, and three shadowed WeakRef bindings pass configured lint/boundary checks, fresh Codex review and the full runtime selections above. The additional hold has fresh scoped P0–P2 review; its complete file matches main.
Previous runs hit pinned-Bun staging before tests/lint. Main now includes the release-asset fallback (fix(ci): cache verified Bun release assets across test jobs #195139) and lint/docs/boundary setup (fix(ci): prepare verified Bun before parity checks #195155). Merged current main
be0b106c3a9(includingea133a4a4d40) as36c23a67954, without conflicts or any change to the reviewed caller diff. All seven held files match main. Fresh exact-head CI run42473537578passes on36c23a67954; no old runs were rerun.Five real retention suites were temporarily given strong references. All three runtimes rejected all eight affected identities at the intended live-instance assertion. After restoring the source bytes, all five suites (64 tests) passed on Node, fork and two stock runs. Areas: embedded attempt callbacks, plugin service runners, Gateway scheduler callers, live-text delivery and browser import-state stores.
The new WebSocket migration rejects both deliberate strong-reference cases on all three runtimes. Its restored 12-test file passes Node, fork and two stock runs with the original two collections.
Matched five-suite Node wall time in one checkout: 61.94s before → 56.48s after (8.8% lower), with both 64-test selections passing. A matched WebSocket comparison passes all 12 tests at 5.46s before → 2.79s after. Each comparison is one measurement pair, not a statistical benchmark. A final-head repeat after the SDK test-entrypoint repair also passes all 64 tests in 53.00s.
No JIT override, extra retry, longer settle budget, or weaker assertion was used. The native callback changes where the same collection runs. The final combined caller patch has a scoped-clean P0–P2 Codex review. The exact counted test-line increase is 15 LF, with its own allocation; no new test cases were added.
These seven files remain byte-identical to main. Their migrations are held rather than weakening assertions:
packages/ai/src/transports/openai-responses-continuation.retention.test.tssrc/agents/embedded-agent-runner/run.session-prompt-state.test.tssrc/plugins/services.scheduler-context.test.tssrc/plugins/http-registry.test.tssrc/agents/prepared-model-catalog-worker.heap.integration.test.tssrc/plugins/plugin-instance-module-loader.failed-acquisition.test.tsModule.registerHooksbefore reaching collection.src/plugins/registry.runtime-config.test.tsThe four repeatable stock-only retention observations and the additional intermittent registry observation are recorded alongside oven-sh/bun#44438; they are not treated as proven product leaks. No runtime admission lists were changed.
The Node-run perf tools retain intentional heap censuses:
scripts/lib/gateway-bench-profile-preload.tsandscripts/perf/{attempt-abort-retention,audio-queue-pool-retention,context-engine-factory-retention,local-workspace-retention,plugin-generation-retention,transcript-listener-entry,transcript-listener-owner}.ts. The browser DevToolsRuntime.queryObjectstest uses a different API and remains unchanged.