Repository navigation
feat(state): worker-owned incognito session actor (P1, inactive) - #163145
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 October 1, 2026, 11:36 PM ET / October 2, 2026, 03:36 UTC (Revision 6). ClawSweeper reviewWhat this changesAdds inactive worker ownership for incognito databases, including creation, cancellation, lifetime management, memory diagnostics, regression coverage, and staged migration documentation. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this is distinct, useful staged work absent from current main. No actionable introduced defect was found, and the earlier migration-proof blocker does not apply to this inactive, memory-only stage. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s agent database executor coordinates database work through the SQLite worker broker. This stage adds an explicit in-memory target for internal captures while production incognito sessions continue using their existing host owner. flowchart TD
A[Internal ephemeral capture] --> B[Agent execution owner]
B --> C[Current caller admission]
C --> D[Dedicated broker worker]
D --> E[In-memory SQLite database]
E --> F[Memory diagnostics]
B --> G[Joined close and cleanup]
G --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource +773, Tests +389, Docs +55. Total +1217 across 24 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep incognito worker lifetime under the canonical executor and defer production activation until the documented complete caller cutover. Do we have a high-confidence way to reproduce the issue? Not applicable to this inactive foundation PR; source and regression scenarios establish its intended boundary, but this read-only review did not execute them. Is this the best way to solve the issue? Yes: extending the existing executor, broker, writer queue, and cleanup lifecycle preserves one owner while leaving production routing unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fd56b79c2228. 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 (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the two creating captures as a tuple so strict indexed-access checking preserves both resolved references. Runtime behavior and concurrency are unchanged.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge main at 7fc0cfb, retaining its WAL retirement closer and P1's durable identity type. Resolve the opening-cancellation regression found during review: valid concurrent creators may retry only after failed opening and native cleanup settle, with current caller and captured owner facts rechecked. Incognito P1 remains inactive.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…nclaw#163145) * feat(state): add inactive incognito worker actor * fix(state): settle incognito capture publication * docs(state): record revised incognito SDK migration * test(state): preserve concurrent incognito capture tuple Keep the two creating captures as a tuple so strict indexed-access checking preserves both resolved references. Runtime behavior and concurrency are unchanged.
What Problem This Solves
Provides the ownership and lifetime foundation needed to move incognito session SQLite into workers without splitting a live store between the Gateway and a worker.
User Impact
No production behavior change. Production incognito remains host-owned until P7. This is an inactive, isolated-test-backed foundation; it introduces no configuration flag, schema change, migration, retention change, or content quota.
Why This Change Was Made
Design link summary
The accepted design and decisions extend the existing agent execution owner, SQLite broker, writer queue, and resource lifecycle. Explicit ephemeral targets use the existing capture API. Ordinary file captures remain synchronous and retain their existing implementation.
One agent/state-root namespace gets one pinned actor on a dedicated worker within the broker's existing capacity. Opaque handles and incarnations bind work to that actor. Concurrent creators converge; existing-only lookup never creates a store and cannot observe an unpublished actor. Close joins accepted work and native cleanup. Cancelled publication retires an unclaimed actor while preserving a valid concurrent creator.
Decisions
:memory:and set and verifytemp_store=MEMORYbefore schema work. No durable registration, lease, backing file, WAL, archive, or recovery snapshot is created. OS swap and crash dumps remain outside the application guarantee.INCOGNITO_SESSION_ENDED. Old handles never adopt a replacement.page_count * page_size, without claiming to measure total process memory.*Asynctwins for everySessionManagerpersistence method, returning committed results, and migrates all bundled/internal callers. Synchronous methods receive@deprecatedJSDoc naming the async twin, an SDK compatibility record with removal at the next Plugin SDK major, a docs migration note, and a once-per-method runtime warning. After P7 activation, synchronous persistence targeting an incognito session throws an actionable error naming the async replacement; durable targets keep working until the removal major.What is inactive
No production caller requests the ephemeral capture target. Only lifecycle operations and the memory gauge are admitted in P1. Session facts, session mutations, domain adapters, and activation remain later stages. The SDK persistence migration proceeds separately. The durable session-entry patch path is unchanged. P1 removes zero production T1 sites.
Update behavior
None: inactive. Existing installed updaters, stored databases, and Gateway restart behavior are unchanged; no operator action is required.
Evidence
Current main integration and cancellation repair
Current head:
57510ef6ddf909665a47c2344f6f13601b787960. Exact-head CI run 36960488298 passed; the watcher reported green with no pending checks. ClawSweeper completed review of this head at 2026-10-02 03:36 UTC with no actionable finding, including its review of the cancellation repair. Its generated table-warning banner remains unsupported by the code and is explicitly dismissed in its own detailed assessment. No CI rerun or admin exception was used.Merged main at
7fc0cfb379f4ba6f3eefd75a1e342f56dc859415with a merge commit. The single conflict was in the execution closer: main's joined WAL retirement remains intact, with P1'sAgentDatabaseFileExecutionIdentitytype used in its captured state.Fresh review found that cancelling the initiating worker open could also reject independent valid creators waiting on it. A real-worker regression with two valid followers failed before the repair. The existing owner now settles failed opening and native cleanup before a waiting creator can retry, and requires the initiating source to be refused plus the caller, agent, and state-root facts to remain current. Existing-only lookups, published handles, worker-loss behavior, and domain commands are not replayed. P1 remains inactive.
Validation after integration: the affected state/logging type configuration passed; 53 tests across incognito and three close-lifecycle suites passed in 138.97s command wall. After the cancellation repair, all 7 incognito tests passed (66.58s wrapper wall, including 43.19s compiler preparation); the new regression itself took 0.901s. Typechecking, scoped type-aware lint, formatting, and whitespace checks passed. Full-candidate Codex autoreview against the pinned main is clean through P2. Unchanged durable close proof is reused.
Original runtime implementation reviewed and tested at:
d00e504d7d3085e51a23fc1d61d260040abc7a6d. Codex branch autoreview is clean through P2 severity; no accepted/actionable P0–P2 findings remain.Documentation-only SDK decision correction at
f5545dec0ebc8879c02029f15f1e5f73c4a42ef4:git diff --checkand fullpnpm check:docspassed; focused Codex autoreview is clean through P2 severity. Runtime code is unchanged.All 67 focused tests passed on Blacksmith Testbox with Node 24.19.0. Commands used the repository test wrapper with
--maxWorkers=1; wall times include wrapper preparation:src/state/openclaw-agent-execution-incognito.test.tssrc/infra/sqlite-worker-broker.test.tssrc/auto-reply/reply/reply-turn-admission.worker.test.tssrc/config/sessions/session-accessor.sqlite-page-reclamation.binding.test.tsProvider:
blacksmith-testbox, leasetbx_01m3x134v0kw06gbvmjvtdkyq9, Testbox run. The focused command results above are the proof; the lease workflow's conclusion is not a claim that the full changed-check command passed.pnpm check:madge-import-cycles: 0 cycles, 157.81s wall.pnpm check:database-worker-ratchet --base e25e244b68e9b9ae03aef7bb406c2b45a2e9db47: no T1 call-count growth, 33.54s wall.git diff --check: passed.node scripts/check-changed.mjspassed core types, all 27 core test-type groups, core/scripts lint, three Knip scans (zero entries), runtime cycle checks, and preceding structural/storage/auth guards. The wrapper terminated abnormally at the final pairing-account guard after 3914.40s; that exact guard passed when replayed directly. The interrupted wrapper is not reported as green.node scripts/check-changed.mjsstopped after 45.15s at the inherited date-triggered plugin-boundary failure: 11 compatibility records are due for removal. The reporter, complete compatibility registry, and SDK-entry inputs are byte-identical to the pinned base. Running that base's reporter and records reproduced exit 1 and the same count in 20.56s. Reference scans used candidate source; the failing eligibility count depends only on unchanged records and the UTC date. No compatibility record or guard was altered or suppressed. A later remote continuation did not execute because its lease expired during local source staging; completed proof was reused.Scope: 949 changed production lines (861 additions, 88 deletions), across 17 production files; 24 files total including documentation and tests.
The publication regression failed on the pre-fix candidate because an existing-only lookup returned the cancelled creator's actor. Its concurrent valid-creator control passed. Both cases pass after the owner-level repair. Tests inspect isolated state and temp directories while actors are live and after close.
Landing validation
CI at
f5545dec0ebc8879c02029f15f1e5f73c4a42ef4exposed a test-only tuple inference error undernoUncheckedIndexedAccess. Correction40e37e93a3957retains the concurrent captures’ two-element tuple type; runtime behavior and concurrency are unchanged. The affected state/logging test type configuration passes, all 6 incognito tests pass (125.19s command wall, including 63.12s compiler preparation), formatting andgit diff --checkpass, and focused Codex autoreview is clean through P2.The earlier head
40e37e93a3957f1c4da6c12a9e00c6ad8e73f6f5CI run 36953175518 is green; the exact-head watcher reported zero pending checks. No CI rerun or admin exception was used.The prior run also had two failures independently reproduced on main in files outside this PR's test changes:
src/gateway/session-utils.test.ts: main run 36946915948, job 110651166926.attempt.spawn-workspace.context-engine.test.ts: main run 36949496803, job 110659259709. Main's attempt quota lookup uses the worker session reader while that suite still runs in Vitest's thread pool, reaching the unchanged host-only admission guard. The normalized main and PR failure-name sets match exactly.The previous completed ClawSweeper review of head
40e37e93a3957f1c4da6c12a9e00c6ad8e73f6f5reports no actionable introduced finding and explicitly concludes that migration proof is inapplicable: this inactive stage introduces no persistent DDL or stored-data contract change. Its generated persisted-table warning is a false positive;sqlite-worker-store.tschanges broker admission, not tables.Next stages P2–P7