Repository navigation
refactor(sessions): compose incognito history and compute facades (P7m, inactive) - #165890
Conversation
Compose shared actor bindings through history, Memory, usage, and reconciliation while production routing stays host-owned. Preserve FIFO read acceptance and reject stale or revoked results after cleanup. Native routes remain for the atomic P7 activation.
|
🦞👀 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 6, 2026, 6:42 AM ET / 10:42 UTC (Revision 9). ClawSweeper reviewWhat this changesThe PR connects incognito history, Memory, usage, and reconciliation readers to a captured session actor while retaining existing production routing. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful prerequisite work that current main does not provide. No blocking introduced defect remains, and the previous review’s pending E2E now has an exact-head completion record. Likely related people: steipete, with strong merged-area history. Priority: P2 Review scores
Verification
How this fits togetherIncognito sessions keep private conversations in process-held storage. History, Memory indexing, and usage reporting consume that storage through session readers whose ownership must remain valid through asynchronous work and cleanup. flowchart TD
A[Private session requests] --> B[Capture session actor]
B --> C[Validate current authority]
C --> D[History and compute workers]
D --> E[Retain generation and snapshot]
E --> F[Validate before disclosure]
F --> G[History Memory and usage results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +808, Tests +740, Docs +26. Total +1574 across 47 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Preserve this bounded inactive composition and complete production activation through the coordinated ownership cutover with native-route retirement. Do we have a high-confidence way to reproduce the issue? Not applicable to the refactor itself. The two repaired history regressions have recorded failing-before/passing-after actor-facade checks; this read-only review did not execute tests. Is this the best way to solve the issue? Yes, for the stated inactive prerequisite: it reuses existing actor commands and ownership fences, preserves native routing, and documents the remaining activation work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8dc04b001e10. 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 (8 earlier review cycles)
|
Merge current main to resolve the compute fixture conflict while retaining shared-binding coverage and the existing native production owner. Refresh forwarded cron labels before response encoding inside retained actor custody.
|
@clawsweeper re-review Integrated main and fixed the encoded-history label ordering in 873bbd2. The real actor-facade regression fails before the fix and now verifies the named cron label in serialized response bytes. Production acquisition remains inactive and host-owned. |
|
🦞👀 Re-review progress:
|
Declare hydration reader operations as receiver-independent functions, matching both closure-based implementations and existing callback consumers. This fixes the unbound-method lint failure without changing runtime behavior.
|
@clawsweeper re-review The only additional change at 6a5aff3 corrects the hydration reader's callback types to match its existing receiver-independent closures. The exact CI lint error reproduced before the fix and passes afterward; independent P2 review and production types are clean. Runtime behavior and public SDK signatures are unchanged. |
|
🦞👀 Re-review progress:
|
Merge main to incorporate the observer background FIFO admission repair from #165680. Preserve both history capture and accepted-operation capture at the incognito binding conflict; production activation remains unchanged.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the existing empty-page response when history identity is incomplete, before implicit actor acquisition. Extend the real actor wiring regression and preserve strict explicitly supplied reader validation. Merge main to incorporate the verified gateway shutdown fixture logger repair.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…m, inactive) (openclaw#165890) * refactor(sessions): compose incognito history and compute facades Compose shared actor bindings through history, Memory, usage, and reconciliation while production routing stays host-owned. Preserve FIFO read acceptance and reject stale or revoked results after cleanup. Native routes remain for the atomic P7 activation. * fix(sessions): preserve hydration callback types Declare hydration reader operations as receiver-independent functions, matching both closure-based implementations and existing callback consumers. This fixes the unbound-method lint failure without changing runtime behavior.
What Problem This Solves
Incognito history, Memory, usage, and reconciliation algorithms already exist, but their facades require separate per-call injection. This inactive prerequisite composes them through the captured shared actor before the later atomic ownership switch.
Why This Change Was Made
Capture the original actor and current session facts before asynchronous work, reuse its existing history and compute commands, and retain custody through consumers, validation, and cleanup. History and Memory reads check authority before final disclosure; usage preserves FIFO acceptance and revision witnesses; deferred reconciliation retains its original actor. Memory also retains window identity and corpus generation across lazy preparation. Usage keeps its separately selected cache owner.
Two review repairs preserve existing history behavior: forwarded cron labels are projected before response encoding, and incomplete page identity returns the native empty page before implicit actor acquisition. Both have failing-before and passing-after regressions through the real actor facade. The hydration reader describes receiver-independent callbacks as callable properties, resolving the introduced unbound-method lint failure.
User Impact
Inactive: production acquisition remains host-owned, with native paths retained for one atomic activation/deletion change. No schema, persisted row format, retention, durability, permission, update, or released SDK contract changes. This diff adds no new
OPENCLAW_*names or host SQL.Incremental actor history still needs prepared subagent visibility facts. Without them, shared acquisition returns the existing reset response for a full history reload; activation must supply that resolver. Native transcript correction, CLI history authority, and older direct compute consumers remain activation audit items. This PR does not claim the complete cutover is ready to activate.
Evidence
Current head:
8f954e114f9fcfd7af6d47cc18a8af6168760312, incorporating main7b9405e22d7b0bbbdde1537c2a566521bed425aawith merge commits. The binding conflict in the earlier integration retained both this PR's history capture and #165895's accepted-operation capture, including main's captured-environment fallback.pnpm test <four files> --maxWorkers=1, 284.54 s wall). After the incomplete-identity repair, the complete 32-case history file passed in 245.64 s. Its new assertions failed before the guard with the captured-session error (94.76 s wall); they reuse the existing fixture without adding a process boot, timer, retry, or test case.not_foundbefore calling it when the ID is absent. Lower-level omitted store paths deliberately default or retain the captured actor path. No accepted/actionable review finding remains. Trusted ClawSweeper review completed for this exact head at 2026-10-06T10:02:23.669Z with no blocking correctness finding; its pending E2E request is now satisfied.v2026.10.1-beta.1preserves existing async Memory signatures. Actor callbacks, optional visibility facts and the moved projection type are internal; no compatibility record is required. The exact-current-head SDK report completed successfully in 2,153.84 s: 130 reachable changes, zero entrypoint additions/removals and no direct export changes. Digest:70afafe324a2c9deb5f57a9bebe3db044f5a6f74ccc0e711352bdfb3fec5f38f.The exact-head CI run 37446093758 is green, including all required security and CI contexts. The explicit final Linux full-file E2E passes all 16 cases on this head (521.86 s Vitest; 1,557 s including cold preparation), with native Crabbox aggregate exit 0 and verified artifacts. The Slack receipt records intentional suppression as failed delivery and the restart turn as delivered. Final proof run. All five baseline repetitions and artifact retrieval are complete, and their lease is released. Local timings include wrapper preparation and cold imports; isolated CI seconds for the two added assertions are not measured. No real Slack-service, cross-platform, or production activation claim is made.
CI investigation and repairs
The PR-caused
typescript/unbound-methodfailure was reproduced and fixed in6a5aff30574473af7a0905982df13a8a4d39a6ab; targeted lint and production types passed afterward.CI run 37425758183 failed the suppressed Slack-announcement case with terminal execution and pending delivery. Five ordinary full-file runs on its PR head produced four passes and one matching visible-turn failure. The same test also failed independently on merge base
98262d8b5fdaf4b1be499fc10c7426a0f2be5b6e, in the restart turn, with terminal execution and pending delivery. The two-CPU runs use Node 24.21.0; CI used 24.19.0, and provider/RAM differences are retained as limitations. Both sides completed five full-file repetitions: four passes and one failure each (79/80 cases each). Seven inspected test/observer/admission/announcement owner files have identical blobs across the merge base, actual CI main parent and old PR head; this is not a claim that the entire dependency graph is unchanged. Fixture completion markers establish response selection, not client consumption.Main #165680 independently traced this failure class to observer background persistence borrowing its publisher's FIFO admission. Its repair detaches that async context while retaining explicit authority and observer shutdown ownership; its regression fails before the repair and passes afterward. This PR incorporates that repair, and the explicit final-tree E2E now passes all 16 cases. Passing replays alone are not claimed as a fix.
The next CI run, 37441108007, exposed main-only TS18004 in
run-loop-shutdown-completion.test-support.ts: cleanup #166012 removed thegatewayLogbinding but retained its use. Both failing type lanes report that error; this PR does not touch the file. The same core typecheck fails on the exact tested main parent7f483b7a23a9ac57e05a8bbfb0e69d6f47f46e1c(21.37 s). The one-line repair was independently reviewed, passed core types and all three existing timeout cases, and landed directly on main as7b9405e22d7b0bbbdde1537c2a566521bed425aabefore integration here. No CI job has been rerun merely to obtain green, and no admin exception has been used for this PR.Overlap: #156673 also touches native usage extraction; its route is preserved. #162433 covers broader session ownership. This integrates #165895 and preserves the merged session-authority/creation owners. P7k #165885 and the separate P7m2 child #165901 remain part of the coordinated activation; the child branch was not modified.
Native routes the final activation must delete
Estimates count deleted production lines, including obsolete imports where identifiable; they are not an executed deletion diff. Shared worker kernels and named durable SDK/Doctor contracts must remain.
src/config/sessions/session-transcript-hydration.ts:135,155,180,202,208,223,229session-transcript-read-source.ts:60,session-transcript-context-read.ts:136,session-transcript-watermark.ts:25,session-transcript-message-presence.ts:30,session-transcript-stats.ts:25(all undersrc/config/sessions/)src/config/sessions/session-transcript-anchor-read.ts:87,session-transcript-events.ts:71,session-transcript-match.ts:87,session-transcript-search.ts:257src/config/sessions/session-accessor.sqlite-branch-list.ts:83;src/gateway/session-transcript-title-reader.ts:300,session-transcript-preview.ts:121src/gateway/session-transcript-readers.ts:87,170,295,327,350,381,415src/gateway/session-history-state.ts:68,209,server-methods/chat-history-pages.ts:96,166,180,server-methods/chat-history-delta.ts:87src/infra/session-cost-usage-worker-runtime.ts:307,341,406,522;session-cost-usage-cache.sqlite.ts:176src/config/sessions/session-transcript-reconcile.ts:218,527,637src/config/sessions/session-transcript-projection-writer.ts:117,296;session-transcript-reconcile-memory.ts:69packages/memory-host-sdk/src/host/session-files.ts:540;session-reset-recall-read.ts:43;session-transcript-corpus.ts:554Additional activation audit items outside this slice:
src/config/sessions/session-transcript-correction.ts:43–81native correction andsrc/agents/cli-runner/history-boundary.ts:61plus synchronous retained authority. Workshop explicitly excludes private sources; the persisted-user-turn composition already retains its manager actor. Confirm conversation-binding reachability before activation rather than assuming a zero-SQL route.