Repository navigation
feat(state): incognito actor compute and usage routing (P5b, inactive) - #164044
Conversation
Reuse worker history selectors on the retained incognito actor with FIFO, live disclosure authorization, and snapshot hydration. Keep production host-owned until P7; P5b compute, Memory, and Codex routing is stacked next.
Prepare usage reverse RPC and projection reconciliation on the existing actor FIFO. Retain exact compute cleanup custody after revocation and borrow release, preserve disclosure checks and typed actor loss, and keep production routing inactive until P7. Memory and Codex history adapters remain deferred to P5c.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 3, 2026, 1:30 AM ET / 05:30 UTC (Revision 2). ClawSweeper reviewWhat this changesAdds inactive worker routing for incognito usage calculations and transcript-index rebuilding, with scoped cleanup after caller revocation or borrow release. Merge readiness✅ Ready for maintainer review Keep open: the compute routing remains distinct from merged history work and is absent from fetched main. No introduced blocking defect was found at the unchanged reviewed head. Likely related people: steipete (routing candidate). Priority: P2 Review scores
Verification
How this fits togetherIncognito sessions hold temporary conversation data in an in-memory database. This change prepares usage and transcript-index workers to access that database through its existing actor while preserving authorization and cleanup ownership. flowchart TD
A[Usage or index request] --> B[Captured session and caller authority]
B --> C[Compute scope]
C --> D[Actor writer queue]
D --> E[Temporary session database]
E --> F[Usage or index worker]
F --> B
B --> G[Authorized result]
C --> H[Exact resource cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +895, Tests +577, Docs +18, Other +2. Total +1492 across 18 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep compute and cleanup under the existing actor and publication owners, with production activation reserved for the complete caller cutover. Do we have a high-confidence way to reproduce the issue? Not applicable: this prepares an inactive internal execution path. Source and focused boundary tests establish the intended contracts; no current-main failure was executed during this read-only review. Is this the best way to solve the issue? Yes: reusing actor FIFO admission, usage kernels, and projection publication avoids competing storage owners while retaining exact cleanup and live disclosure checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c4a75fa73fa. 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 (1 earlier review cycle)
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…w#164044) Reuse worker history selectors on the retained incognito actor with FIFO, live disclosure authorization, and snapshot hydration. Keep production host-owned until P7; P5b compute, Memory, and Codex routing is stacked next.
What Problem This Solves
Incognito usage extraction and transcript-index reconciliation still depend on SQLite on the host. The inactive actor needs compute routing and cleanup ownership before P7 can switch production routing.
Solution
Route usage reverse RPC and projection source/claim/chunk/finalize operations through the captured actor and existing writer FIFO. Compute retains actor lifetime without reserving that queue while another worker runs. Each compute scope owns distinct source IDs and refresh-lock tokens, allowing exact cleanup after requester revocation or borrow release while P5a's grants and disclosure checks protect results. Partial projection cleanup remains bound to the accepted claim; actor loss returns
INCOGNITO_SESSION_ENDEDwithout replay.Preserve explicit empty usage selections and the durable path's discovery-cutoff behavior. Reuse the existing reconciliation and publication owners; extract the actor adapter to keep the reconcile module within its line cap. Update the compiled-wrapper dependency inventory.
Impact
Inactive until P7: production incognito continues using the host. No schema, retention, durability, configuration, permission expansion, or update behavior changes. No new
OPENCLAW_*names. T1 remains 1,333 → 1,333.P5a (#163987) is merged and this branch incorporates main at
9e34368e594b358692f552624d4879f316ab3ddc. P5c is next: Memory entry/reset-recall and Codex history through the public SDK were saved separately and are excluded here.Integrated incidental overlap: #163960 simplified error handling in the actor's
performfunction. This PR keeps its cleanup-admission hunk there minimal; the two changes address different responsibilities.Evidence
node scripts/worktree-setup.mjs gateway: passed, including the full build (78.4s build phase).pnpm test src/state/openclaw-agent-execution-incognito.compute.test.ts src/state/openclaw-agent-execution-incognito.history.test.ts --maxWorkers=1. Covers FIFO, revocation/borrow-release cleanup, collision isolation, partial projection recovery, typed actor loss, cross-agent disclosure, and zero caller-thread SQL.pnpm test src/infra/session-cost-usage-cache.worker.test.ts --maxWorkers=1 -t 'refreshes and loads usage without executing cache SQL|retains the process-held incognito cache'(8 unrelated cases not selected).node scripts/check-changed.mjs --staged --base 9e34368e594b358692f552624d4879f316ab3ddc: passed (full plan, including all core/test typecheck shards and core/script lint).Production diff: +955 / −60 / net +895 (1,015 changed lines, 14 production files). There are 18 changed files including docs, tooling and tests. CI run
37098300862completed with 64 successful jobs, one inherited failing test job and its aggregate gate, and 20 skipped jobs (11,563 summed job seconds); the measured local wall times above include harness preparation. Production activation and P5c validation remain separate work.Released SDK and admission review
Compared the changed signatures against the latest stable release,
v2026.9.8:reconcileSessionTranscriptIndexes,runUsageCostWorker,IncognitoSessionRunner, the actor binding, and the projection worker backend are internal-only. They are not exported bysrc/plugin-sdk/**, exposed byapi.runtime.*, or documented SDK subpaths. Existing SDK consumers retain their released signatures; no deprecation compatibility record or new SDK type test is required.The new compute grant path adds no host SQL. Session-generation and projection-claim predicates execute on the actor; host authorization consumes the existing published session facts. No additional host-read debt was introduced inside grants.
Landing CI attribution
The approved head remains
ce7a4d185e521612c0b8e2cb4d7b18271f29eb07. Trusted ClawSweeper review completed at 2026-10-03 05:13:23 UTC with no actionable findings. The coordinator approved this head and its clean P2 autoreview; landing introduced no source changes.CI attempt 1 of run 37098300862 failed only
checks-node-changed-compact-small-5and its downstream CI aggregate. The root issession-accessor.sqlite-byte-size.test.ts > sizes active context without reading transcript overflow payloads, line 192. Scheduled main run 37094503398, job 111121626866 independently fails the same assertion.The failure originates in earlier main cleanup
346b89d81d8c34ebb01d790035fae4385cc1f4e1: combining header discovery and sizing exposesserialized_byteson a query whose header predicate may readevent_json. The test then treats that entire query as a sizing-only query and rejects its normal payload-read opcode. The test, active-context query, payload helper, and read-bytes helper are byte-identical between the PR, merge base, CI baseline, and scheduled-main failure. This is incidental cleanup overlap; P5b does not change those owners, and no fix was present at captured main9d2ebf60d97a44f2b72054e1c2363b8db7fdaafc.Five separate serial file runs with
--maxWorkers=1reproduced exactly one failure and 19 passes each on both the PR head and merge base9e34368e594b358692f552624d4879f316ab3ddc. PR wall times: 153.55, 93.65, 56.69, 69.16, 114.51 seconds. Baseline wall times: 129.26, 98.16, 111.59, 130.38, 138.69 seconds. These are failure-attribution runs, not passing test claims. No CI rerun was used.The CI checkout log binds tested merge
07a8ba9f0a8677c40031f364b32ab3c7b3f80d86to baseline7ff3b3be3713751de356800167d67ce752ad0d04and the approved head. The native inherited-failure admin route is explicitly authorized by the repository owner. Security-fast, production types, lint, and the Gateway usage/memory API boundary job passed; the failed and skipped results remain recorded as such. The initial PR-context failure was a missing authored problem section and was superseded by a successful run after the body was corrected.