Repository navigation
fix(sessions): isolate native workers from host session imports - #182156
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 separates native session kernels and registry reads from host actor acquisition, prepares Goal routing on demand, and preserves CLI failures during failed fork restoration. Example: An ordinary session turn runs before the worker receives its first Goal.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR provides a useful native-worker import isolation repair with no actionable defect found; exact-head CI is green. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway session operations enter the existing database executor, whose native kernels commit transcript and Goal changes and return facts for host publication. flowchart LR
A[Gateway session operations] --> B[Host preparation]
B --> C[Database executor]
C --> D[Native session kernels]
D --> E[Session database]
E --> F[Committed facts]
F --> A
B --> G[Memory actor acquisition]
Technical reviewBest possible solution: Land the existing ownership extraction while keeping broader RSS qualification and the related memory investigations separate. Do we have a high-confidence way to reproduce the issue? Base and current-main source show registry reads and native kernels reaching host acquisition or unconditional routing preparation; the supplied packaged diagnostics support the import-footprint problem, though no target code was executed during this review. Is this the best way to solve the issue? The extraction uses existing owners, removes the replaced implementations, preserves public exports and transaction guards, and prepares routing for later commands rather than only at worker initialization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ddf2e9803fcf. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
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 HistoryReview history (6 earlier review cycles)
Reviewed October 27, 2026, 12:51 AM ET / 04:51 UTC (Revision 7). |
076ddc9 to
36ce5c3
Compare
36ce5c3 to
3231618
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…after upstream openclaw#182156 Upstream openclaw#182156 (8e5abec) moved acquireSessionActorStorage from session-actor-storage-binding.ts into session-actor-storage-acquisition.ts and updated its own callers. The fork's recipient-authority incognito test still imported it from the binding module, so at the j8 merge 203d9e3 it called undefined: tsgo:core:test TS2724, and both cases red with "acquireSessionActorStorage is not a function". The test now imports each name from its owner; no assertion changed. RED (203d9e3, file unchanged): 2 failed, TypeError. GREEN: 2 passed; tsgo core:test, test:root, scripts, extensions:test exit 0. Refs karmaterminal/openclaw-bootstrap#1727 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…claw#182156) * fix(sessions): separate actor registry reads from acquisition * fix(sessions): separate memory owner type contract * test(gateway): avoid racing kill confirmation ownership * fix(sessions): preserve unbound memory owner callbacks * fix(sessions): keep native workers free of host runtime imports * fix(sessions): preserve CLI failures through stale fork restoration * test(sessions): drop redundant worker RPC count assertion * test(gateway): align incognito preflight coverage with main * test(sessions): count raw initialization payload reads * test(gateway): retain agent deletion shutdown diagnostics
Related: #181432
What Problem This Solves
Native SQLite session workers load actor creation, host orchestration, and configuration modules they do not need. Every isolate retains its own copy of that import graph.
User Impact
Existing session operations keep their behavior while loading less host code in native workers. No feature is disabled and no public configuration, schema, protocol, or SDK surface is added. Stable process RSS and latency savings are not yet established.
Why This Change Was Made
Current head
fb751906e73206984c917e17cc644aa82b642f25, tree2c765381b7446075747aaa4ad4aac960dce618f3, integrates mainc5d77b74ab192b446564a35eda787660727676e2. The two test conflicts use main's independently repaired SQL counter and worker-profile expectations exactly: #184662 and #184667.With rename/copy detection disabled: production +908/−814 (net +94), tests/support +386/−129 (net +257), plus two wrapper inventory lines. The production growth establishes native/host ownership boundaries without adding duplicate state or fallback paths.
Evidence
c5d77b74with the same installed dependencies produced 5,554,513 bytes and the same failure: inherited baseline excess, candidate +1 byte. The normal build completed runtime/plugin bundling and declaration compilation, then failed withENOSPCwhile publishing declarations; final build gates remain unverified. No size ceiling was raised.git diff --checkpass. No private paths or addresses were added.414782450952a196bbb64b1605a458c2531c47b6:codex-rs/exec/src/exec_events.rs:10-56defines thread identity and failed-turn events;codex-rs/exec/src/lib.rs:990-1050preserves failed/interrupted turn state through shutdown and exits nonzero. The generic CLI restoration change preserves that original failure as the aggregate cause.Remaining qualification
Current-head CI is green: https://github.com/openclaw/openclaw/actions/runs/40449158099 completed successfully at
fb751906e73206984c917e17cc644aa82b642f25, including the normal build and PostgreSQL conformance. Exact-head ClawSweeper review is clean, with no findings or remaining pre-merge actions. Earlier failed runs and local build limitations remain recorded below.Preceding head
2c203f87failed Linux CI https://github.com/openclaw/openclaw/actions/runs/40318146438 in memory-manager deletion cleanup, one surviving WeakRef, and QA node-control-plane setup. Its actual hosted merge passed 117/117 tests across 15 files locally with temporary diagnostic probes, which were removed; that did not explain the Linux failures.Main now includes #184616, a separately reproduced fix preventing new cache-trim writes during memory-manager shutdown. This integration does not claim that fix caused or resolves the preceding hosted deletion failure.
Historical loaded measurements
Prior-head packaged diagnostics used Node 24.22.1 on macOS arm64, concurrency 2, 32 seeded sessions with 20 × 1,024-character histories, control-plane/history/memory-search probes, and a mock provider paced at 1,000 ms. Each arm verified all turns plus two warmups and fresh samples from all 30 workers.
These are historical diagnostics, not a current-head RSS percentage or latency claim. The affected SQLite worker used about 62–63 MiB instead of 88–89 MiB. Aggregate worker heap fell about 68–75 MiB, but much larger RSS variation lacks equivalent heap attribution. Main heap increased in the longer candidate run. The short-run history slowdown did not repeat in reverse order. Earlier package-startup, checkpoint, and readiness qualification failures remain failures.
Rank-up disposition: the optional full comparative performance campaign remains deferred. A matched cohort must compare the final integrated head against its corresponding main baseline; this PR claims removal of a demonstrated unnecessary import graph.
Follow-up