Skip to content

refactor(sessions): complete SessionManager actor admission for incognito (P7a, inactive) - #164869

Merged
steipete merged 10 commits into
mainfrom
dbasync/incogp7a
Oct 4, 2026
Merged

steipete merged 10 commits into
mainfrom
dbasync/incogp7a

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

SessionManager still requires a native database admission, preventing its incognito operations from running entirely on the per-agent actor. Some replay and extension adapters also turn actionable synchronous incognito refusals into absence or apparent success.

Solution

Two feature commits extract the shared SessionManager wire contracts into a leaf module, then compose actor admission, metadata, receipts, compaction, suffix/rewrite, branching, and refusal propagation. All contract importers move directly; there is no re-export shim.

The actor reuses the existing connection-bound metadata backend on its single database connection; hydration and maintenance reads use the shared P7c reader. Planning happens outside transactions, authoritative rows are reread in synchronous worker transactions, and current host authority is checked at transaction and commit. Acknowledged facts publish through their existing owners even when later authority, observer, or projection work fails. Accepted writes retain FIFO custody through close; an unknown outcome never triggers replay or native fallback.

The projection-grant failure came from checking a claim while its published facts were deliberately pending. The existing compute owner fences that claim before dispatch and after settlement; the redundant assertion was removed from the grant without adding SQL or blocking work there.

Impact

Production routing stays INACTIVE and host-owned. P7d must install the actor binding and remove the native arms atomically. This changes no schema, durability, retention, configuration, update behavior, or environment names. T1 is unchanged: 902 → 902 against main bb9f63c75069bc2522f09b441d5ec93524ab6efe.

Production diff: +1,284 / −501 / net +783 (1,785 changed lines). P6 (#164727) and P7c (#164819) have merged; this branch merges main without rebasing and targets main.

Activation follow-up: conditional worker-turn grants retain pre-existing indexed placement-authority reads from another owner (src/gateway/worker-environments/worker-turn-launcher.ts:439, :444; placement-turn-claims.ts:422; placement-row-codec.ts:122). The same-owner read in worker-turn-transcript-target.ts:28 must be routed before P7d activates the cloud actor path. Boundary proof covers the operations moved here; it does not claim these existing authority reads disappeared. Static-note preparation conservatively refuses any secret-registry revision drift, including an unrelated registration, and must be repeated outside the transaction.

Sibling/overlap context: merged P7c owns general hydration and pending-input history/interruption; SessionManager reuses its hydration owner, and the redundant P7a maintenance-read command has been removed. P7b owns Board/ACP/outbox/lifecycle composition. Incidental overlap with RoboClaw #162433 is limited to the required ownership changes.

Inactive-export exception (removed by P7d)

P1–P6 have no false-valued route predicate: inactivity is the absence of production actor selection. Two exact export-level @internal annotations therefore suppress only production Knip findings: withSessionManagerIncognitoActor and IncognitoSessionSyncAccessError. P7d removes each annotation when installing its real runtime caller or sync-refusal preflight. The full-tree Knip scan still audits both exports against their test consumers; no file-wide suppression or route activation was added.

Evidence

Validation is bound to the integrated candidate tree 12c7ebb1862f6e96822c21b9e94d12ea53be7472 against main bb9f63c75069bc2522f09b441d5ec93524ab6efe.

  • Core production typecheck: passed.
  • Madge: 0 cycles, 126.52 s. Inventory is T1 902 → 902; the other tiers are unchanged too.
  • Integrated actor, durable compatibility, P7c history/pending-input, and both real close-order regressions: 49 tests passed across six files, 883.20 s wall, using --maxWorkers=1. This includes exact committed interruption-ID recovery after a lost ordinary reply, without replay.
  • Shared-registry import/build-graph tests: 29 passed across 10 files, 537.32 s wall, using --maxWorkers=1.
  • node scripts/check-changed.mjs --staged --base bb9f63c75069bc2522f09b441d5ec93524ab6efe: passed, 2,631.33 s wall, against the fully staged merge result. Includes all typecheck groups, production/full-tree/script Knip (zero findings), formatting, lint, guards, and the SQLite worker ratchet (no T1 growth against the pinned base).
  • Fresh local SDK comparison (realpath TMPDIR): 0 entrypoint/export/direct-signature changes; 131 exports with reachable declaration changes, comprising 32 unique declaration differences (4 added, 8 removed, 20 modified). The local comparison and temporary-checkout cleanup completed successfully in 1,554.98 s.
  • Full pnpm build: passed, exit 0, on blacksmith-testbox lease tbx_01m437g72r12yv3rmb0zmtt6d4, run 37195647316. Exact candidate tree and source bytes were verified before execution. Build phases totaled 494.0 s, the delegated command including source/dependency preparation took 668.47 s, and the wrapper took 1,318.97 s end-to-end. The lease is stopped (completed). One earlier tooling attempt exceeded the shell argument limit before build execution; the smaller verification payload fixed that failure. The backing Actions run may show cancellation from one-shot lease cleanup; the delegated build succeeded.
  • Fresh Codex P2 review of the integrated candidate: scoped-clean, 292.38 s. The review explicitly checked both lanes’ callback ordering and acknowledged-fact publication.

The full build runs the Control UI performance check in report-only mode. It reported startup JS gzip 373,481 B vs 373,454 B (27 B over). This PR changes no Control UI executable inputs, UI build configuration, dependencies, or budget files. Build provenance affects emitted bytes; no matched baseline reproduction was run, so the cause remains unconfirmed.

Prior-to-integration proof includes 64 focused tests (644.93 s), 12 actor/real-close tests (602.19 s), 29 import/build-graph tests (766.13 s), the wrapper inventory test (70.03 s), and a passing full build on Testbox run 37192165773, whose lease stopped after success. The earlier full implementation and the narrow annotation delta both received clean P2 reviews. These are retained as prior-source evidence, not substituted for the integration checks above.

Focused-test wall times are local measurements on the loaded host; PR test CI timing is not yet available. Production activation remains a separate PR.

Landing verification

The released SDK source was checked against v2026.9.8: public SessionManager sync/async signatures remain unchanged by this PR, and no changed helper is exposed through api.runtime.* or a documented SDK subpath. SessionManagerWriteAdmission is reachable in generated declarations only through an inherited protected persistence method; the released and current SessionManager constructors are private, so this is not a callable or subclassable plugin contract. Actor callbacks and the moved incognito error are unreleased internals. The integrated SDK report's 131 reachable declaration changes are retained as evidence; zero direct-signature changes alone was not used as a compatibility claim.

The report-only UI gzip overage also occurs on main: scheduled CI run 37192694630, build job 111408171333 at 6f556a72ba112c8602bafa5494babe71ba2a7f87 reports 373,499 B against the same 373,454 B budget. This candidate reports 373,481 B, 18 B less. This is hosted baseline comparison, not a same-toolchain rebuild of both revisions.

ClawSweeper completed the exact-head review at 2026-10-04 10:58:33 UTC with no correctness or security findings. Its automatic data-model marker names session-manager-persistence-entry.ts; the change there extracts the existing message-adoption code unchanged from persistRecord, operating on an already committed snapshot. No serialized storage format, schema, or data migration changes. Existing native/durable compatibility and actor reopen tests cover the retained behavior. The review's technical assessment likewise states that no stored-data model changes require migration proof.

CI UI failure investigation

Initial CI UI shard 4 job 111420120229 failed login-gate.e2e.test.ts / “keeps generic help collapsed until requested when there is no failure” with Missing mounted login gate. Five single-worker full-file replays on head 9145490181643a97e1e26596e67d62d718347887 and five on merge base bb9f63c75069bc2522f09b441d5ec93524ab6efe each passed all 25 cases. Head wall times: 78.30, 64.29, 73.32, 87.66, 80.39 s; base: 106.95, 69.38, 71.79, 84.40, 55.31 s.

The fixture, UI owner, bootstrap, Gateway client, and UI config bytes match between revisions. A suspected fixture race remains: mountLoginGate(null) stops the Gateway and clears its error, awaits one Lit update, then queries the gate while pending application startup can render the connecting splash instead. This helper behavior predates the PR (19e87bf). Four recent scheduled main UI shard-4 jobs passed, so this is not proven inherited main-red. Classification: non-reproduced intermittent fixture/setup failure, with the precise trigger still uncertain. No assertions or source changed. The authorized single-job rerun passed (job 111424407515); no source fix is claimed.

CI Node failure: independently inherited from main

CI run 37196672301 attempt 3 remains failed only for Node compact-small-14 and its aggregate gate. The exact tested merge is b73150e7c2151225e27332b0d87da98b7500ff24, with ordered parents main 979466250d54290e42945acc1ad42923c465b8c1 and PR head 9145490181643a97e1e26596e67d62d718347887. The UI rerun and every other selected job passed; no jobs were cancelled.

The failure is run.recovery-deadline.test.ts suite warmup: “real workspace consumer was exercised: expected 0 to be greater than 0.” The underlying error is SqliteWorkerError: Agent admission requires its host owner. Main commit e95e11c (#164779) made run admission await readSessionEntryInWorker before workspace discovery; the existing embedded Vitest thread cannot acquire the host-only admission in sqlite-worker-store.ts:207–210. The guard's finally assertion masks that earlier refusal. The failing fixture, async admission owner, and host-only guard are unchanged by this PR. Fourteen relevant source/config blobs match between the main parent and the CI merge.

Controlled proof: the exact four-file CI group with CI=true, Node 24.21.0 and two workers passed 69/69 on the PR head. It failed identically on clean main 9794662 (65 passed, 4 skipped) and on the exact CI merge (65 passed, 4 skipped, 148.52 s wrapper wall). Clean current main f8f1c8af73a7b874db7c2693345e41a8a6033713 also fails the same focused file (4 skipped, 104.22 s Vitest). An additive diagnostic catch exposed the original error while retaining every assertion, then was removed byte-for-byte. Earlier five single-worker passes on the PR head and five on its merge base missed the 15 newer main commits incorporated by CI. Recent scheduled-main CI predates this upstream change.

No PR source or assertions were changed. The explicitly authorized inherited-failure admin exception retains this red CI result and the incomplete deadline-case coverage; it does not relabel CI as green or waive security/review gates. Production incognito routing remains inactive.

Preserve shared ACP metadata persistence and sequencing while preparing actor entry commands, transaction-local controller guards, board snapshots, and shared idle-pin lifetime. Keep production host-owned until P7 and document the remaining synchronous SDK and caller cutover requirements.

Validation: 44 tests passed with one platform skip on isolated Linux; four pre-fix negative controls reproduced missing pins, grant reentrancy, and revoked-policy persistence. Changed-file checks, database-worker ratchet, zero-cycle checks, and Codex review through P2 passed. T1 remains 915; no new environment names.
Merge current main to consume the Doctor-owned ACP migration contract. Keep P6 inactive, remove retired runtime legacy-key and cleanup calls, consolidate ACP composition in its existing mutation owner, and complete the compiled wrapper dependency inventory. Preserve entry-before-metadata ordering and update the focused sequence proof.
Merge main to include its suppression-inventory fix. Expose ACP operations through the inactive actor borrow, retaining the full lazy-load and operation promise before any await. Extend the nested-grant regression to both ACP methods; the unguarded binding fails this control. Document intentional model-mock isolation without expanding its baseline. Production incognito routing remains native until P7.
Merge main CI ratchet fixes and move shared ACP input/result shapes into a leaf contract. Remove static implementation-type cycles while preserving lazy runtime loading inside actor custody. Production incognito routing remains inactive and released Plugin SDK call signatures remain compatible.
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 4, 2026
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 7:50 AM ET / 11:50 UTC (Revision 4).

ClawSweeper review

What this changes

SessionManager, OpenClaw’s conversation transcript manager, gains inactive incognito actor routing for reads and writes, preserves acknowledged results after later failures, and propagates actionable incognito refusals.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this remains useful inactive preparation, and no introduced correctness or security defect was found. The prior migration blocker is unsupported by the actual storage delta; CI remains red with separately documented inherited-failure evidence.

Likely related people: @steipete, supported by recent merged session-persistence and incognito work.

Priority: P2
Reviewed head: 9145490181643a97e1e26596e67d62d718347887

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The coherent ownership refactor has meaningful boundary evidence and no actionable introduced finding; inherited red CI remains a landing-workflow fact.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured integrated results exercise SessionManager through the real incognito actor, SQLite backend, and Gateway close owner, covering successful persistence, queued revocation, redaction rollback, acknowledged-result retention, and reopen consistency. Source comparison resolves the prior migration marker: no stored-data contract changes are introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured integrated results exercise SessionManager through the real incognito actor, SQLite backend, and Gateway close owner, covering successful persistence, queued revocation, redaction rollback, acknowledged-result retention, and reopen consistency. Source comparison resolves the prior migration marker: no stored-data contract changes are introduced.
Evidence reviewed 8 items Pinned introduction and merge identities: Raw commit records confirm the original head has parents 967ab73 and bb9f63c, and tree 12c7ebb1862f6e96822c21b9e94d12ea53be7472. The test merge has the pinned main parent followed by this exact head; introduced changes were reviewed against the supplied merge base.
Prior storage blocker resolved: The new adoptPersistedMessage helper extracts existing committed-message adoption from persistRecord. Snapshot types move unchanged into the leaf contract; no DDL, serialized-format change, migration, or new persistent store is introduced. The prior review's generic migration prerequisite does not apply.
Existing owner reused; activation remains separate: The manager worker binds the existing metadata backend to the actor's sole connection and checks agent, physical path, and session target. The actor scope has test callers but no production installer. Current main's write-admission source still selects the native database owner, so merged P6/P7c preparation does not supersede this branch.
Findings None None.
Security None None.

How this fits together

SessionManager turns agent messages and transcript mutations into stored conversation history and loaded views. This branch prepares those operations to use the existing per-agent incognito worker while production continues using its current host owner.

flowchart TD
  A[Agent messages and mutations] --> B[SessionManager]
  B --> C{Captured incognito actor}
  C -->|Absent| D[Existing host owner]
  C -->|Present| E[Incognito worker]
  E --> F[Live authority and SQLite transaction]
  F --> G[Committed receipts]
  D --> G
  G --> H[Transcript views and publications]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +783, Tests +685, Docs +25, Other +1. Total +1494 across 51 files.

View PR surface stats
Area Files Added Removed Net
Source 42 1284 501 +783
Tests 5 687 2 +685
Docs 1 25 0 +25
Config 0 0 0 0
Generated 0 0 0 0
Other 3 3 2 +1
Total 51 1999 505 +1494

Review metrics

Metric Value Why it matters
Production and test growth production +1,284/−501; tests +687/−2 Production growth prepares actor composition and explicit receipt handling; this stage claims no active runtime reduction.

Stored data model

Persistent data-model change detected: serialized state: src/agents/sessions/session-manager-persistence-entry.ts, unknown-data-model-change: src/agents/sessions/session-manager-persistence-entry.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Preserve this staged composition under the existing actor owner, with production activation and removal of native arms completed together in the dedicated cutover.

Do we have a high-confidence way to reproduce the issue?

Not applicable to this staged refactor. Source inspection and supplied production-boundary results establish the actor scenarios; this read-only review did not execute tests.

Is this the best way to solve the issue?

Yes: reusing the existing metadata backend and hydration owner avoids competing persistence implementations while preserving the released synchronous compatibility path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ee5350712981.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is bounded internal session-storage preparation with production routing kept inactive.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured integrated results exercise SessionManager through the real incognito actor, SQLite backend, and Gateway close owner, covering successful persistence, queued revocation, redaction rollback, acknowledged-result retention, and reopen consistency. Source comparison resolves the prior migration marker: no stored-data contract changes are introduced.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured integrated results exercise SessionManager through the real incognito actor, SQLite backend, and Gateway close owner, covering successful persistence, queued revocation, redaction rollback, acknowledged-result retention, and reopen consistency. Source comparison resolves the prior migration marker: no stored-data contract changes are introduced.

Evidence

What I checked:

  • Pinned introduction and merge identities: Raw commit records confirm the original head has parents 967ab73 and bb9f63c, and tree 12c7ebb1862f6e96822c21b9e94d12ea53be7472. The test merge has the pinned main parent followed by this exact head; introduced changes were reviewed against the supplied merge base. (914549018164)
  • Prior storage blocker resolved: The new adoptPersistedMessage helper extracts existing committed-message adoption from persistRecord. Snapshot types move unchanged into the leaf contract; no DDL, serialized-format change, migration, or new persistent store is introduced. The prior review's generic migration prerequisite does not apply. (src/agents/sessions/session-manager-persistence-entry.ts:116, 914549018164)
  • Existing owner reused; activation remains separate: The manager worker binds the existing metadata backend to the actor's sole connection and checks agent, physical path, and session target. The actor scope has test callers but no production installer. Current main's write-admission source still selects the native database owner, so merged P6/P7c preparation does not supersede this branch. (src/config/sessions/session-incognito-manager.worker.ts:34, 914549018164)
  • Authority and settlement boundary coverage: The actor tests exercise real worker/SQLite operations through SessionManager: rejected fresh-message admission and queued revoked writers leave no entries; redaction drift rolls back; acknowledged commits survive later revocation and observer failures; reopening verifies exact persisted results. The close test uses the real Gateway close prelude and confirms accepted writes settle while new admission is refused. The captured body reports 49 integrated cases passing, including native/durable compatibility. (src/agents/sessions/session-manager-incognito.test.ts:142, 914549018164)
  • Complete captured body inspected: The live body hashes to the supplied snapshot identity 359b6cccb6e207a5eaebbfb2d81fed199585e64574f1ca1fb7ece4063b2fbbdb, allowing inspection of the omitted ending without substituting a different source. It retains the failed CI result, incomplete deadline-case coverage, and the stated inherited-failure exception; it does not claim CI passed. (914549018164)
  • Inherited CI evidence retained: GitHub job 111426352109 failed its Node test shard. Comparing the verified test merge with its main parent shows no changes to the reported recovery-deadline fixture, model-setup owner, or SQLite worker store. The captured body records matching failures on clean main and the test merge, and a passing PR-head group; those are contributor-recorded comparisons, not executions performed by this review. (src/agents/embedded-agent-runner/run.recovery-deadline.test.ts, b73150e7c215)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-04T10:58:33.656Z sha 9145490 :: blocked before merge. :: none
  • reviewed 2026-10-04T11:06:23.994Z sha 9145490 :: blocked before merge. :: none
  • reviewed 2026-10-04T11:24:19.321Z sha 9145490 :: blocked before merge. :: none

@steipete
steipete merged commit 0068b18 into main Oct 4, 2026
416 of 429 checks passed
@steipete
steipete deleted the dbasync/incogp7a branch October 4, 2026 11:56
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…nito (P7a, inactive) (openclaw#164869)

* feat(state): prepare incognito ACP ownership (P6, inactive)

Preserve shared ACP metadata persistence and sequencing while preparing actor entry commands, transaction-local controller guards, board snapshots, and shared idle-pin lifetime. Keep production host-owned until P7 and document the remaining synchronous SDK and caller cutover requirements.

Validation: 44 tests passed with one platform skip on isolated Linux; four pre-fix negative controls reproduced missing pins, grant reentrancy, and revoked-policy persistence. Changed-file checks, database-worker ratchet, zero-cycle checks, and Codex review through P2 passed. T1 remains 915; no new environment names.

* refactor(sessions): extract shared SessionManager write contracts

* refactor(sessions): complete inactive incognito actor admission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant