Skip to content

feat(state): incognito actor history routing (P5a, inactive) - #163987

Merged
steipete merged 2 commits into
mainfrom
dbasync/incognito-p5
Oct 3, 2026
Merged

steipete merged 2 commits into
mainfrom
dbasync/incognito-p5

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The inactive incognito actor needs history reads that observe its committed writes without reopening its memory database. Reads also need current source authorization after queue waits and before disclosure.

Solution

Add actor-bound history pages and deltas, selected reads, title/preview, branches, context, search/matching, receipts, and hydration. Reuse the durable reader selectors and existing RPC/HTTP composition kernels with prepared display facts. Reads share the actor writer FIFO, use its read-only operation scope, and recheck caller and session authority before returning content.

Separate the transport types from runtime readers to keep the import graph acyclic. Preserve the captured state environment through title reads. Existing commit receipts and lifecycle settlement remain with their current owner.

Impact

P5a is inactive: production incognito remains host-owned until P7. No schema, durability, retention, permission, configuration, or update behavior changes. Full hydration keeps the existing incognito full-materialization behavior while acquiring one actor snapshot; it does not adopt durable hydration's lower-memory streaming contract.

P5b is stacked next for usage/projection orchestration, compute cleanup after revocation, Memory entry/reset-recall, and public-SDK Codex history.

Evidence

  • Pinned review/gate base: 06ac4a4672ea5a9ac2bcef9c01e3e1121011ed24.
  • Focused actor history, session, and lifecycle suites: 32 passed; pnpm test src/state/openclaw-agent-execution-incognito.history.test.ts src/state/openclaw-agent-execution-incognito.lifecycle.test.ts src/state/openclaw-agent-execution-incognito.sessions.test.ts --maxWorkers=1, 161.94s wall including 66.45s compiled-worker preparation. Vitest phase: 71.26s on the loaded local host; no separate CI duration measurement.
  • Boundary evidence: zero caller-thread SQL, committed-write FIFO visibility, snapshot preservation, queued revocation, cross-agent isolation, typed actor loss, bounded delta continuation, RPC/HTTP pagination parity, and final disclosure refusal after display-time revocation.
  • Main-thread SQLite inventory: T1 1,339 → 1,339. No new OPENCLAW_* names.
  • Production LOC: +1,138 / −353 / net +785 (1,491 changed).
  • Regression-before proof: removing the disclosure check makes the denied cross-agent sessions.read regression fail (122.83s wall); the candidate guard was restored byte-for-byte.
  • Fresh final Codex autoreview through P2 against the pinned base: scoped-clean, no actionable findings.
  • Final focused history suite after lint corrections: 8 passed, 56.68s wall (11.88s Vitest phase).
  • Madge: 0 cycles; database-worker ratchet passed; scoped lint passed. Full changed-file gate passed: node scripts/check-changed.mjs --base 06ac4a4672ea5a9ac2bcef9c01e3e1121011ed24 (1,228.11s wall).

Landing contract checks

  • Released SDK surface checked against v2026.9.8 (rechecked after its publication during landing), including src/plugin-sdk/**, src/plugins/runtime/**, and documented SDK subpaths. No released function changes sync/async behavior, callback shape, or export availability. Moved types retain their original re-exports and structural shapes. The optional retained-database argument on readSessionPreviewItemsReadOnly is an internal worker interface; the released SDK and api.runtime.* do not expose it. No deprecation adapter is needed for this inactive phase.
  • Host admission/disclosure changes consume worker-supplied session facts and current in-memory actor claims; this diff adds no SQL in host grant callbacks and no new OPENCLAW_* names.

Landing correction and CI attribution

3e4c0e4de9780 fixes the PR-caused check-dependencies unused-file failure by placing the inactive actor reader in the existing session-history-snapshot.ts composition owner and deleting the standalone module. RPC kernels stay lazy; no activation or ignore is added. The P5b import location is now src/gateway/session-history-snapshot.ts.

The corrected candidate passed the actor-history and durable-pagination suites (18 tests, 122.71s wall including compiled-worker preparation), both pnpm deadcode:full passes, scoped lint, and the import-cycle check (0 runtime cycles). Fresh full-candidate Codex autoreview through P2 is scoped-clean; its source evidence includes the existing incognito read-only helper that reuses the actor's open memory connection.

The original CI run's separate subagent settled-batch failure is inherited from main: fdbf48d1383bf added retireSubagentGatewayBinding, while the restart fixture omits chatAbortControllers. Scheduled main run 37091047803 / job 111111464003 reports the exact same test and stack (subagent-parent-recovery.restart-integration.test.ts:349, subagent-registry-execution-cleanup.ts:55). Those files, the fixture, and lifecycle caller are unchanged by this PR and have identical blobs between that main run and the original PR test merge. Five single-worker exact-file runs on the PR candidate and five on merge base 06ac4a4672ea5a9ac2bcef9c01e3e1121011ed24 each passed 14/14. This records attribution, not a claim that inherited CI is green. Exact-head CI run 37093467566 completed with 97 successful jobs, 20 skipped jobs, the same inherited fixture failure in job 111118697616, and its downstream aggregate failure in job 111120158561. check-dependencies is now green. The tested merge is 5023769cf5c1b10ff6e29dafc320cf109ef6fb96 (main 81987cd91a5af220833778db5e440993e22db936 plus head 3e4c0e4de97809a28ae65ca83611d6d4ceb98763). There were no cancelled CI jobs or reruns. Landing uses the explicitly authorized native pre-existing-failure exception, retaining failed CI and all required security/review checks.

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.
@clawsweeper

clawsweeper Bot commented Oct 3, 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 size: XL labels Oct 3, 2026
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 11:44 PM ET / October 3, 2026, 03:44 UTC (Revision 3).

ClawSweeper review

What this changes

Adds inactive worker-owned incognito history reads that reuse the session’s memory database, share existing history selectors, and recheck authorization before returning content.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, inactive step in the accepted incognito worker migration. The pinned diff introduces no concrete blocking defect, and the supplied production-worker evidence covers disclosure denial and revocation.

Priority: P2
Reviewed head: 3e4c0e4de97809a28ae65ca83611d6d4ceb98763

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent staged implementation with strong production-boundary evidence and no concrete blocking finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied passing production-path harness uses real database actors and Worker transport, observes committed history through RPC/HTTP composition, and verifies cross-agent denial, queued revocation, and refusal after display-time revocation. No stored-data contract changes require migration proof; tests were inspected, not rerun by this reviewer.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied passing production-path harness uses real database actors and Worker transport, observes committed history through RPC/HTTP composition, and verifies cross-agent denial, queued revocation, and refusal after display-time revocation. No stored-data contract changes require migration proof; tests were inspected, not rerun by this reviewer.
Evidence reviewed 8 items Pinned introduction and clean checkout: Reviewed the introduced delta from 06ac4a4 to the exact original head. Endpoint drift and the stale test merge were not treated as PR-introduced changes. The checkout remains clean.
Retained database and admission boundary: History execution validates the canonical incognito key, acquires current session facts, requests admission, and executes inside the existing query-only scope. The existing read-only helper explicitly reuses an already-open incognito connection instead of opening its sentinel.
Final disclosure authorization: The composition owner binds requests to the captured agent, store, and session, then rechecks caller, actor, session claim, and source authorization after asynchronous reads and display formatting. Actor read results also authorize current worker facts before disclosure.
Findings None None.
Security None None.

How this fits together

Incognito sessions hold conversation data in memory. This adapter sends history requests through the retained database worker and formats its results for Gateway RPC and HTTP readers.

flowchart TD
  A[History request] --> B[Captured session and caller]
  B --> C[Actor FIFO queue]
  C --> D[Retained memory database]
  D --> E[Shared history selectors]
  E --> F[Display formatting]
  F --> G{Current disclosure authority}
  G --> H[Return history or refuse]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +781, Tests +426, Docs +20. Total +1227 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 23 1134 353 +781
Tests 2 426 0 +426
Docs 1 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 1580 353 +1227

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +781 lines; tests +425 lines Production growth supplies retained-actor history operations and shared selectors, with boundary coverage for ordering and authorization.

Technical review

Best possible solution:

Keep history acquisition with the retained actor and shared selectors, preserving the accepted inactive rollout until the complete production cutover.

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

Not applicable to a current user-facing bug: this adds an inactive migration adapter. Its supplied harness directly exercises the production actor and history boundaries.

Is this the best way to solve the issue?

Yes: reusing the retained connection, existing FIFO, and shared selectors preserves one storage owner while keeping authorization current at disclosure.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded internal migration stage with production activation deferred and no demonstrated urgent user regression.
  • 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 supplied passing production-path harness uses real database actors and Worker transport, observes committed history through RPC/HTTP composition, and verifies cross-agent denial, queued revocation, and refusal after display-time revocation. No stored-data contract changes require migration proof; tests were inspected, not rerun by this reviewer.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied passing production-path harness uses real database actors and Worker transport, observes committed history through RPC/HTTP composition, and verifies cross-agent denial, queued revocation, and refusal after display-time revocation. No stored-data contract changes require migration proof; tests were inspected, not rerun by this reviewer.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced delta from 06ac4a4 to the exact original head. Endpoint drift and the stale test merge were not treated as PR-introduced changes. The checkout remains clean. (3e4c0e4de978)
  • Retained database and admission boundary: History execution validates the canonical incognito key, acquires current session facts, requests admission, and executes inside the existing query-only scope. The existing read-only helper explicitly reuses an already-open incognito connection instead of opening its sentinel. (src/config/sessions/session-incognito.worker.ts:136, 3e4c0e4de978)
  • Final disclosure authorization: The composition owner binds requests to the captured agent, store, and session, then rechecks caller, actor, session claim, and source authorization after asynchronous reads and display formatting. Actor read results also authorize current worker facts before disclosure. (src/gateway/session-history-snapshot.ts:223, 3e4c0e4de978)
  • Production-path authority evidence: The inspected suite creates actual ephemeral actors through the production database executor and uses real Worker transport. It covers committed-write FIFO visibility, detached snapshots, transaction/disclosure denial, queued caller revocation, equal-ID cross-agent isolation, bounded deltas, RPC/HTTP parity, display-time revocation, and worker loss. The captured PR body reports eight focused cases passing and a guard-removal negative control; this reviewer did not execute tests. (src/state/openclaw-agent-execution-incognito.history.test.ts:201, 3e4c0e4de978)
  • Inactive rollout and compatibility scope: Documentation explicitly retains production incognito’s host owner until P7 and preserves full-materialization hydration. The diff adds read operations and moves structurally equivalent types with original re-exports; it introduces no schema, stored format, operator option, or released plugin API change. Codex routing is described as future P5b work, not a dependency exercised by this patch. Public docs: docs/reference/database-schemas/worker-access.md. (docs/reference/database-schemas/worker-access.md:177, 3e4c0e4de978)
  • Current main still lacks this composition: Inspected fetched-main actor facts and history composition: they retain the earlier actor operations and lack this history adapter. No merged fixing PR was established, so an implemented-on-main closure is unsupported. (src/gateway/session-history-snapshot.ts, 4a0be71e57ab)

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 (2 earlier review cycles)
  • reviewed 2026-10-03T03:19:58.201Z sha 52058d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T03:35:25.493Z sha 3e4c0e4 :: needs maintainer review before merge. :: none

Place the incognito history adapter with the shared snapshot composition owner and remove its production-unreachable standalone module. Preserve lazy RPC kernel loading and the existing authorization and FIFO contracts. Fixes the check-dependencies unused-file failure without an ignore or activation change.
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 3, 2026
@steipete
steipete merged commit 63772b7 into main Oct 3, 2026
198 of 202 checks passed
@steipete
steipete deleted the dbasync/incognito-p5 branch October 3, 2026 03:50
@steipete

steipete commented Oct 3, 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 3, 2026
…w#163987)

* feat(state): incognito actor history routing (P5a, inactive)

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.

* fix(state): keep inactive history composition in its owner

Place the incognito history adapter with the shared snapshot composition owner and remove its production-unreachable standalone module. Preserve lazy RPC kernel loading and the existing authorization and FIFO contracts. Fixes the check-dependencies unused-file failure without an ignore or activation change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. 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