Skip to content

refactor(sessions): add actor read commands for hydration and pending-input history (P7c, inactive) - #164819

Merged
steipete merged 12 commits into
mainfrom
dbasync/incogp7c
Oct 4, 2026
Merged

steipete merged 12 commits into
mainfrom
dbasync/incogp7c

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The inactive incognito actor path lacked four hydration navigation reads and the pending-input history/interruption composition needed before atomic activation. Production incognito still belongs to the host.

Why This Change Was Made

Add typed actor reads for current-turn entries, maintenance facts, recent active events, latest active messages, and pending-input pages. Bind hydration to its captured actor/session generation; extra runtime request fields cannot override that target. The existing inactive compute reader exposes hydration preparation, and the inactive history composition exposes pending-input list and exact reads with retained loading and disclosure checks.

Reuse the existing bounded pending-history and interruption kernels on the actor's FIFO. Recheck live host custody at transaction and commit admission, recover the exact interrupted IDs from the native commit receipt when the ordinary reply is lost, and retain the complete composition through settlement without holding a FIFO turn across another actor request.

Based on main after #164727 merged. Its canonical ACP leaf contract is reused; the duplicate local extraction was removed. The main integration preserves every P7c production file byte-for-byte. Related overlap: #164747 (history-reader work), sibling P7a/P7b preparation, and #162433 (the broader ownership draft). This branch does not implement those lanes or activate their routes.

User Impact

Inactive preparation only. Native production arms remain for P7d's atomic switch and deletion. Durable flows, schemas, storage, retention, permissions, and update behavior are unchanged. No new OPENCLAW_* names, dependency, worker service, or persistent cache.

P7c-only production delta against final main: +380 / −8 / net +372, across ten production modules. Four test/support files, test routing, and the worker-access reference complete the 16-file diff. T1: 907 → 907 against final main (3e9d7d38c2aa23). The initial branch measured 914 → 914; the seven-site reduction came from later upstream integration. No P7c main-thread reduction is claimed before activation.

Pending-input staging/source/withdrawal and the other P7 activation prerequisites remain separate work. This PR must not be used as the activation switch.

Evidence

All focused commands used --maxWorkers=1 locally. Tests use synthetic isolated state and the real actor/broker; only pending-row fixture boot data is seeded by a test backend.

Proof Result Measured wall time
Actor history + existing durable pending-history suites 19 tests passed; durable byte bounds, custody and receipt behavior preserved 396.89 s command wall
Actor pending history, real Gateway close, reply/history/reconciliation import closures 10 tests passed; zero caller-thread SQL, both custody races, lost reply without replay, borrow settlement, scheduler abort before transport close 1056.18 s command wall
Final hydration regression + ACP behavior + runtime-process build graph 29 tests passed 588.84 s command wall
Shared-state worker import closure 2 tests passed 194.63 s Vitest wall

The final composition-entry-point proof reran all 20 hydration, pending-history, and real-close tests successfully in 449.37 s command wall. The fixture-cleanup follow-up reran all six pending-history/close tests successfully in 418.14 s.

The new pending-history file took 208.73 s Vitest wall (49.5 s test time), and the real-close file took 149.24 s (35.4 s test time) on this loaded host. They reuse suite-level actors and do not boot a Gateway. Real native grants, commit receipts, and the actual close order are the contracts that require these integration boundaries. The two hydration additions took 61 ms of test time in the final run. CI seconds are not yet available.

The captured-target regression failed before the explicit-field fix with an actor generation mismatch, then passed with all 14 history tests. Initial fixture failures were corrected by selecting the existing host-owned database-worker test pool and using the canonical transaction owner for seed writes. The inherited Git baseline-buffer and mock-isolation gate failures were resolved through main/P6 integration, without weakening guards.

  • Runtime-process build-graph and import-closure checks: passed.
  • Madge: 0 cycles after adopting P6's canonical contract.
  • Database-worker ratchet: passed on the committed final head against main 3e9d7d38c2aa23c7aed4655e19e4c7dbad952f50; T1 remains unchanged.
  • Codex autoreview through P2: scoped-clean on the final P7c-only diff against 6663bac175fcba157a8064646b0e2ef2add7396e.
  • node scripts/check-changed.mjs was run repeatedly and exposed issues that were repaired. All 27 core-test type groups passed on the reviewed candidate; final core and affected test-graph checks were rerun after the routing/cleanup follow-up. Scoped lint of every changed core file and script lint passed. Landing recheck: main already fixed the chat-metadata max-lines overage in perf(gateway): admit agent databases when the listener binds #164670 (3f6c1d3a). Direct oxlint of both current-main-identical files reports only the unchanged sessions-patch-engine.ts overage (719 counted lines; limit 700). Repository policy makes untouched-file limits advisory in scoped changed checks and size limits advisory in GitHub Actions. Scheduled main CI passed check-lint and every core lint shard. The original broad local failure remains recorded as historical evidence; no guard, baseline, or assertion was weakened. Exact-head CI remains the landing gate.
  • Local SDK API comparison (6663bac175fcba → a72e1450bd1363, including the routing composition): passed in 1322.19 s; 127 reachable declaration-closure changes, no entry-point or direct export declaration changes. Subsequent cleanup and main integration leave P7c declarations unchanged. These actor types are absent from shipped v2026.9.8; no released service method was changed.
  • Gateway qaRuntime build: passed, including bundled plugin assets, standalone worker outputs, CLI bootstrap import guard, runtime postbuild, and stamps; 416.19 s wall including artifact-lock wait.

No live Gateway was modified and no remote lease was used.

The final core typecheck and the state/logging and Gateway-server test type graphs passed. All remaining schema, database-first storage, media, runtime-sidecar, runtime-import-cycle, webhook-auth and pairing guards passed.

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.
Keep production incognito routing inactive until P7d. Add typed actor navigation reads and pending-input reconciliation with live custody and exact native receipt recovery; preserve durable behavior and native arms for the atomic activation.
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.
Keep hydration navigation bound to the captured target and carry the confirmed result across read grants. Extract shared ACP access signatures into a leaf contract to remove the inherited P6 import cycle without changing runtime behavior. Include the leaf in compiled-wrapper dependencies.
Adopt P6s canonical incognito ACP type contract and remove the duplicate local extraction. Hydration and pending-input behavior remain the reviewed P7c implementation.
Expose hydration preparation through the existing inactive compute reader and pending-input list/exact reads through the existing history composition. Retain lazy loading, current disclosure authority, and accepted persistence settlement. Drive focused proofs through these production composition entry points.
Keep the captured pending-input payload immutable without reassigning the caller parameter, and join test backend cleanup before surfacing a fixture failure.
Preserve the reviewed P7c implementation and keep the P6 activation checklist with its original section. Place the inactive P7c documentation after that checklist.
@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 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 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 3:56 AM ET / 07:56 UTC (Revision 2).

ClawSweeper review

What this changes

Adds inactive worker-backed incognito transcript navigation and pending-input history readers, preserving live custody checks and recovering committed interruption results after a lost reply.

Merge readiness

✅ Ready for maintainer review

This remains useful preparation for the accepted incognito worker migration. Current main lacks the added compositions, and the reviewed delta introduces no concrete blocking correctness or security finding.

Priority: P2
Reviewed head: 630ba39a3a83af69105682ba1a0e1c2e8eb1e299

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable preparation patch with relevant production-boundary fault evidence and no actionable introduced finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduction and merge ownership: Reviewed the introduced delta from 3e9d7d3 to the original head. Raw test-merge parent records match the pinned base followed by that head; its result preserves the focused preparation surface. Endpoint drift was not attributed to this PR.
Current-main necessity: Fetched main still uses host-owned incognito hydration and lacks the five added actor history operations. The existing runtime path does not provide the requested prepared worker compositions; no containing release tag was returned for the PR head.
Intentional inactive migration stage: The worker-access contract explicitly retains production host routing until the atomic activation and deletion stage. Call-site inspection found the new compositions confined to prepared adapters and tests; schemas, retention, permissions, configuration, and update behavior remain unchanged.
Findings None None.
Security None None.

How this fits together

Incognito sessions keep conversation data in a process-lifetime SQLite database. These prepared readers send captured session requests to its worker owner and return authorized transcript or pending-input results to the Gateway.

flowchart TD
  A[Captured session request] --> B[Inactive reader composition]
  B --> C[Actor FIFO]
  C --> D[Existing SQLite kernels]
  D --> E[Live authority and custody checks]
  E --> F[Committed receipt or read snapshot]
  F --> G[Authorized Gateway result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +372, Tests +643, Docs +23. Total +1038 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 10 380 8 +372
Tests 5 643 0 +643
Docs 1 23 0 +23
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1046 8 +1038

Review metrics

Metric Value Why it matters
Preparation cost production net +372 LOC; tests/support +642 LOC; 0 main-thread SQL sites retired The growth is justified as inactive migration preparation, so this stage should not be counted as a runtime SQL reduction.

Technical review

Best possible solution:

Keep these prepared reads with the existing actor owner and reserve production activation and native-path removal for the documented atomic cutover.

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

Not applicable: this is inactive migration preparation rather than a reported current-runtime bug; its focused authority and settlement scenarios are defined in the inspected harnesses.

Is this the best way to solve the issue?

Yes: extending the existing actor FIFO and reusing canonical hydration and interruption kernels fits the accepted staged migration without adding another storage owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is bounded internal migration preparation with no immediate production activation or urgent user-facing regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.

Label justifications:

  • P2: This is bounded internal migration preparation with no immediate production activation or urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports passing final composition runs through the real actor, broker, worker client, and close owner. Inspected fault harnesses verify custody protection and rollback before commit, exact receipt recovery without replay, hydration revocation refusal, and settlement before transport close; execution was not independently repeated. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the introduced delta from 3e9d7d3 to the original head. Raw test-merge parent records match the pinned base followed by that head; its result preserves the focused preparation surface. Endpoint drift was not attributed to this PR. (src/config/sessions/session-incognito-actor.ts:505, 630ba39a3a83)
  • Current-main necessity: Fetched main still uses host-owned incognito hydration and lacks the five added actor history operations. The existing runtime path does not provide the requested prepared worker compositions; no containing release tag was returned for the PR head. (src/config/sessions/session-transcript-hydration.ts:37, c071d238483a)
  • Intentional inactive migration stage: The worker-access contract explicitly retains production host routing until the atomic activation and deletion stage. Call-site inspection found the new compositions confined to prepared adapters and tests; schemas, retention, permissions, configuration, and update behavior remain unchanged. Public docs: docs/reference/database-schemas/worker-access.md. (docs/reference/database-schemas/worker-access.md:353, 630ba39a3a83)
  • Authority and final-effect checks: The interruption worker verifies the exact session generation inside the existing synchronous transaction. Host admission checks live custody at transaction and commit, while native receipt reconciliation recovers only confirmed interrupted IDs. Hydration captures its target and rechecks current caller authority around worker waits. (src/config/sessions/session-incognito.worker.ts:160, 630ba39a3a83)
  • Production-boundary fault evidence: The captured PR body reports successful final composition runs. Inspected harnesses use the real actor backend, broker, and worker client with synthetic boot rows: custody acquired at transaction protects its row, custody acquired at commit rolls back interruption, lost ordinary replies recover exact committed IDs without replay, and release joins accepted work. These tests were not executed during this review. (src/state/openclaw-agent-execution-incognito.pending-history.test.ts:184, 630ba39a3a83)
  • Hydration and shutdown coverage: Added hydration cases exercise navigation, version refusal, target-override resistance, revoked authority during a FIFO wait, and mismatched generation. The close harness invokes the real close owner and verifies scheduler abort, interruption settlement, scheduler drain, then transport close. (src/state/openclaw-agent-execution-incognito.history.test.ts:289, 630ba39a3a83)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • joshavant: 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 (1 earlier review cycle)
  • reviewed 2026-10-04T07:48:11.362Z sha 630ba39 :: needs maintainer review before merge. :: none

@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
@steipete
steipete merged commit d0c2795 into main Oct 4, 2026
167 of 170 checks passed
@steipete
steipete deleted the dbasync/incogp7c branch October 4, 2026 09:02
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…-input history (P7c, inactive) (openclaw#164819)

* 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): prepare actor hydration and pending-input history

Keep production incognito routing inactive until P7d. Add typed actor navigation reads and pending-input reconciliation with live custody and exact native receipt recovery; preserve durable behavior and native arms for the atomic activation.

* fix(sessions): preserve actor targets and separate ACP contracts

Keep hydration navigation bound to the captured target and carry the confirmed result across read grants. Extract shared ACP access signatures into a leaf contract to remove the inherited P6 import cycle without changing runtime behavior. Include the leaf in compiled-wrapper dependencies.

* refactor(sessions): compose inactive actor history and hydration readers

Expose hydration preparation through the existing inactive compute reader and pending-input list/exact reads through the existing history composition. Retain lazy loading, current disclosure authority, and accepted persistence settlement. Drive focused proofs through these production composition entry points.

* fix(sessions): retain cloned inputs and await fixture cleanup

Keep the captured pending-input payload immutable without reassigning the caller parameter, and join test backend cleanup before surfacing a fixture failure.
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