Repository navigation
refactor(sessions): compose history and SessionManager reads on the incognito actor (P7f1, inactive) - #165134
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: blocked before merge. Reviewed October 4, 2026, 9:26 PM ET / October 5, 2026, 01:26 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR composes incognito transcript reads on the existing session actor, retains managers’ original actor bindings, and adds awaited full-fidelity context consumption while preserving the synchronous SDK method. Merge readiness⛔ Blocked before merge - 1 item remains The PR remains useful and distinct from the merged worker-reader foundation. Both prior durable-reader findings are resolved, and no remaining actionable patch defect was found. The previous migration checklist is inapplicable because the introduced changes do not alter a stored-data contract. Priority: P2 Review scores
Verification
How this fits togetherSessionManager supplies transcript history and context to agents and plugins. Its readers consume durable or incognito session storage and return context only after checking source lifetime and current admission. flowchart TD
A[Agent or plugin request] --> B[SessionManager reader]
B --> C{Captured storage owner}
C --> D[Incognito session actor]
C --> E[Durable history worker]
D --> F[Consume context]
E --> F
F --> G[Validate source and admission]
G --> H[Return accepted context]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +659, Tests +713, Docs +38. Total +1410 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one session actor and history-reader owner, preserving synchronous SDK compatibility while preparing the separately reviewed atomic activation. Do we have a high-confidence way to reproduce the issue? Not applicable as a standalone bug report. The prior defects have specific worker-boundary regressions and recorded failing-before/passing-after results, which were inspected but not executed here. Is this the best way to solve the issue? Yes. The patch composes existing actor and reader owners, fences acceptance through the established writer boundary, and preserves the released SDK contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e91a31639560. LabelsLabel 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)
|
Pause the actual model-context worker read after the retained-manager refactor changed the initial-context call path. Preserve the branch/reset rejection and transcript assertions, and fail promptly when SDK creation finishes without entering the reader pause. Always settle and dispose the created session during cleanup. This repairs the PR-caused SDK metadata-admission CI timeouts without changing production routing or the released SDK contract.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Retain the existing history read source across scanning, awaited consumers, validation, and cleanup. Accept full-fidelity context through the existing anchor reader so writer FIFO custody and the native mutation witness fence synchronous rewrites between validation and publication. Remove the independent context-validation worker operation. Add regressions for delayed validation replies and database closure during consumption; both returned stale context before the repair. Preserve the released synchronous SDK signature and inactive production incognito routing.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ncognito actor (P7f1, inactive) (openclaw#165134) * refactor(sessions): compose incognito history and manager reads * test(sessions): observe worker reads in SDK selection races Pause the actual model-context worker read after the retained-manager refactor changed the initial-context call path. Preserve the branch/reset rejection and transcript assertions, and fail promptly when SDK creation finishes without entering the reader pause. Always settle and dispose the created session during cleanup. This repairs the PR-caused SDK metadata-admission CI timeouts without changing production routing or the released SDK contract. * fix(sessions): retain durable context read ownership Retain the existing history read source across scanning, awaited consumers, validation, and cleanup. Accept full-fidelity context through the existing anchor reader so writer FIFO custody and the native mutation witness fence synchronous rewrites between validation and publication. Remove the independent context-validation worker operation. Add regressions for delayed validation replies and database closure during consumption; both returned stale context before the repair. Preserve the released synchronous SDK signature and inactive production incognito routing.
What Problem This Solves
The incognito actor could serve individual history commands, but transcript anchor/accounting/tail facades and SessionManager context reads still lacked the composition needed for atomic activation. Managers also needed to retain their original actor incarnation beyond their opening scope.
Why This Change Was Made
Add explicit, inactive actor bindings for anchor, accounting, and bounded-tail reads. Anchor and model-context publication remain synchronous inside the actor FIFO. SessionManager retains its captured actor, validates retargeting and context lifetime, rejects fresh work after retained or current admission closes, and joins already accepted persistence.
Add
SessionManager.readSessionContextAsyncwith awaited full-fidelity consumption, iterator closure, and source revalidation. Keep the synchronous SDK method deprecated with its compatibility record, migration note, once-per-method warning, and type contract. Build on the merged transcript-context worker facade from #164989.User Impact
Production incognito routing remains host-owned. This is P7f1, an inactive prerequisite; atomic activation still owns native route deletion. Compute, fork, deferred reconciliation/readiness, and usage composition are split into P7f2. Schema, retention, durability, and update behavior are unchanged. The compatibility record is static SDK deprecation metadata; it introduces no stored-data migration, backfill, schema, or format change. ClawSweeper's data-model checklist is therefore not applicable, consistent with its finding of no introduced stored-data contract changes.
28 files; production +747 / −88 / net +659 (835 changed production lines). T1: 895 → 895. Adds 0 new
OPENCLAW_*names.Overlaps: incogp7e, incogcell, #164922, sessauthtail A/B/C, nativepatchtail, and the inactive umbrella draft #162433. Hunks remain scoped to P7f1; the later lander rebases.
Evidence
Base pinned to
0816aa1b57dc815d0c1e0d48bcb9517980985438.Released SDK surface check:
v2026.9.8exportsSessionManagerthroughopenclaw/plugin-sdk/agent-sessions. Its synchronousreadSessionContext<T>(target, read, options): Tsignature is preserved, with thesession-manager-sync-context-readdeprecation record and a type contract; the awaited twin is additive. Other changed actor/context helpers are internal, and added facade parameters are optional.Initial SDK acknowledgement digest (PR-base comparison at
c9dbbfc46e0):dffe69c0. The diff reports 166 reachable affected exports across 10 declaration changes: the async context method, typed read commands, optional internal parameters, and compatibility record.qaRuntimerebuild--maxWorkers=1--maxWorkers=1--maxWorkers=1check-changedTMPDIRLanding routing audit: production callers do not install the actor scope or supply explicit actor bindings. The affected manager suites already use the
agents-supportfork project, and the shutdown suite uses Gateway forks. Indirect callers retain existing database-worker routing; no additional host-owner routing is needed. The focused proof below includes the required runtime build graph and import-closure suites.The focused proofs cover zero caller-thread SQL for moved reads, FIFO publication, physical/source replacement, original actor retention, iterator lifetime, and the real server-close order. Regression baselines demonstrated queued/in-flight reads accepting revoked admission and a following actor operation overtaking model publication. The final code rejects those reads while accepted append and branch persistence still settle; publication stays inside validation. All test type graphs passed, and the affected tests were replayed after the final lint-only cleanup. Hosted CI runtime is not yet measured.
Focused test command
pnpm test \ src/state/openclaw-agent-execution-incognito.history.test.ts \ src/agents/sessions/session-manager-incognito.test.ts \ src/agents/sessions/session-manager-model-context.test.ts \ src/agents/sessions/session-manager-model-context-snapshot.test.ts \ src/agents/sessions/session-manager-target-capture.test.ts \ src/gateway/server-close.incognito-manager.test.ts \ src/plugin-sdk/agent-sessions.context-compat.test.ts \ src/plugins/compat/registry.test.ts \ src/config/sessions/session-transcript-anchor-read.worker.test.ts \ src/config/sessions/session-transcript-context-read.worker.test.ts \ src/gateway/session-transcript-readers.test.ts \ test/scripts/runtime-process-build-graph.test.ts \ src/auto-reply/reply/get-reply.imports.test.ts \ src/state/openclaw-state.worker.imports.test.ts \ src/config/sessions/session-history-read.imports.test.ts \ src/config/sessions/session-transcript-reconcile.imports.test.ts \ src/gateway/session-archive.imports.test.ts \ src/worker/worker.runtime-imports.test.ts \ --maxWorkers=1CI repair at
5745cfdffe2The initial changed-Node CI shard timed out in the two SDK bounded-selection race cases. Initial context now reads through the retained-manager helper, so their spy on
SessionManager.openModelContextAsyncnever ran. The tests now pause the real context worker read, retain their rejection/leaf/transcript assertions, and fail promptly if SDK creation bypasses the pause. This repair changes only the test.The original PR file reproduced the same two 120-second timeouts locally. Four further replays with unchanged original production code and a stricter fail-fast diagnostic failed the same two missing-hook cases; all five exact merge-base replays passed all 12 cases. The repaired file passed all 12 cases (
pnpm test src/agents/sessions/sdk.metadata-admission.test.ts --maxWorkers=1, 231.66 s wall time on the loaded local host), targeted changed checks passed (840.94 s), and independent P2 AutoReview was clean. The first CI run's SDK shard spent 270.75 s before failing; fresh-head CI run 37242367714 failed in Bun Doctor owner-repair tests and a Doctor scale subprocess timeout, with sibling jobs cancelled afterward. Production proof above remains applicable because this repair changes no production source.Durable reader repair at
b759cc69cacBoth late ClawSweeper findings are addressed through the existing owners. The durable reader retains
withSessionTranscriptReadSourceacross scanning, awaited consumption, validation, and cleanup. Final acceptance usesreadSessionTranscriptAnchorsAsync, retaining writer FIFO custody and checking the native mutation witness before publication. The separate worker-validation operation and its path-checking wrapper were removed. The released synchronous SDK method and inactive production actor routing remain unchanged.Both new regressions failed before the fix by returning context instead of rejecting: one holds the actual validation reply while a synchronous SDK rewrite occurs, and the other closes the database during a held async consumer. They use held promises, with no real timers. All 103 focused tests across 10 files passed (161.47 s wall), including incognito/context siblings, the SDK type contract, runtime build graph, and import closures. The regression file alone passed all 11 cases (156.98 s wall, including compiler preparation). Production types, every test type graph, ratchets, formatting, and dead-export checks passed; final targeted lint passed after an identifier-only no-shadow correction. The full candidate and final repair delta received clean P2 AutoReview.
The refreshed comparison against released
v2026.9.8has digestcc961c68. Its eight removed subpaths are inherited from the PR base; this PR changes no package export entrypoints. The releasedSessionManager.readSessionContext<T>(target, read, options): Tsignature remains intact in source and its type test. The final current-head PR-base comparison passed with digestc69de1a8: 166 reachable affected exports, zero added or removed entrypoints, and zero removed exports.Current-head CI 37249385458, attempt 1 tested merge
723bbaea9fdd8cbb6d722c45da26ee364acd24a4, with main parentc5012333049eef43cefe9c38ee4805a0dce971beand PR headb759cc69cac85d390557db81c3e84fad70724c2e. Two Doctor jobs are independently qualified as inherited: 12 canonical-key cases and one race case reproduced on exact main c501 with pinned Bun; nine owner-repair broker failures and the scale child's 60-second SIGTERM independently reproduced on main parentd2167f41b6d3a93757d175307b885a1d5b5db51e. The relevant d216-to-c501 projection change affects a maintenance-preservation branch Doctor bypasses. All 27 named failure inputs match c501 and the tested merge. The scale child's internal stall remains unexplained; its identical main failure is recorded without attributing it to the broker errors. Scheduled-main Node failures were not used as Bun evidence.Job
111573913628failed; job111573913730was cancelled after its Node step 18 failed and remains a second root. The successful fail-fast monitor cancelled 36 other jobs. Those cancellations are incomplete coverage, not passing evidence. The operator authorized the native inherited-failure admin exception; complete exact-head source, checkout, failure, and cancellation evidence is retained for native verification. CI is not claimed green.Completed ClawSweeper review at this head confirms both durable-reader findings are addressed and reports no remaining actionable patch defect. Its remaining automatic data-model checklist is inapplicable: the compatibility record is static SDK metadata, with no schema, persisted-format, retention, or durability change.