Repository navigation
refactor: prepare plugin and Codex incognito session consumers - #168398
Conversation
Inactive P07 preparation: retain explicit actor ownership, exact session policy, physical history sources, and synchronous effect guards. Production incognito acquisition and fresh Gateway creation remain host-owned until P12. No schema, retention, permission, or update migration change.
|
🦞👀 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 real behavior proof before merge. What this changesThis PR retains selected session ownership and execution policy across asynchronous plugin and Codex operations while leaving production actor routing inactive. Example: A private session selects execHost=node and execNode=synthetic-node while configuration defaults to gateway execution.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this maintainer-directed PR open: it provides distinct incognito consumer preparation, and inspection found no new actionable code defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherPlugin runtime adapters and the Codex harness consume session metadata, prepare policy, and carry live guards to storage mutations, tool execution, and native requests. flowchart TD
A[Plugin or Codex operation] --> B[Canonical session selection]
B --> C[Native session owner]
B --> D[Explicit incognito actor]
C --> E[Prepared facts and live guards]
D --> E
E --> F[Asynchronous preparation]
F --> G[Guarded storage or transport effect]
Technical reviewBest possible solution: Complete the inactive consumer preparation through the existing session, lifecycle, and transport owners. Do we have a high-confidence way to reproduce the issue? This is a staged refactor; source confirms the selected-session preparation paths, but this read-only review ran no target code. Is this the best way to solve the issue? Extending canonical session preparation and carrying synchronous guards to effects fits the ownership model while preserving the explicitly inactive production cutover. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d0e1bbc8586d. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass was established; final-effect authority verification remains governed by the proof gate. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 10, 2026, 9:12 AM ET / 13:12 UTC (Revision 5). |
Update rollover diagnostics and synchronize fake-timer tests with asynchronous admission. Prepare native policy in canonical-fork fixtures and defer session-runtime loading until native thread execution.
# Conflicts: # test/vitest/vitest.extension-database-workers-paths.mjs
Resolve the P07/P08 documentation overlap by retaining both consumer sections and regenerate the worker inventory from the merged source. No conflict resolution changes executable behavior.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…law#168398) * refactor(plugins): prepare bound incognito admission and Codex policy Inactive P07 preparation: retain explicit actor ownership, exact session policy, physical history sources, and synchronous effect guards. Production incognito acquisition and fresh Gateway creation remain host-owned until P12. No schema, retention, permission, or update migration change. * fix(plugins): retain actor rollback and Codex lifecycle authority * fix(codex): retain selected sandbox policy through admission * fix(plugins): retain sandbox authority through workspace preparation * fix: retain actor storage root during initializer rollback * fix: preserve private bindings through refused Codex resumes * test: consolidate prepared native tool policy cases * test: retain session history fixture message contract * fix: preserve SDK boundaries in incognito preparation * refactor: keep prepared authority callbacks explicit * chore: shrink retired incognito assertion allowances * docs: refresh incognito worker inventory locations * fix(plugins): repair session preparation fixtures and registry boundaries * fix(codex): align admission fixtures and preserve lazy registration Update rollover diagnostics and synchronize fake-timer tests with asynchronous admission. Prepare native policy in canonical-fork fixtures and defer session-runtime loading until native thread execution. * test(codex): align side-question policy rejection
… (step 20) Conflicts: - test/helpers/source-import-closure.ts: keep our dependencyCache, add upstream's rawImportPattern. - docs/reference/database-schemas/worker-access-inventory.md: regenerated. Repairs needed because of the absorbed changes: - reduceSessionEntryPatch gained an existingEntry argument; the work-span store mocks pass the in-memory row as both the write base and the existing row (16/16). - openclaw#168398 lets an explicit incognito store path name its own state root. Our lazy lifecycle boundary (68984b9) pinned ambient OPENCLAW_STATE_DIR onto every call, which retargeted that path and made a failed incognito initializer's rollback throw. Explicit incognito sentinels now pass through unchanged (registry.runtime-incognito 7/7; it fails 6/7 without this). Sweep, 588 files: remaining reds match plain upstream at 27193f8 (memory-core reindex-backoff 2/6, dispatch-from-config.tts-stream 1/12, cli-json-stdout.models e2e 2/8); heartbeat-runner.live has no runnable tests offline. tsgo core/extensions/core-test/extensions-test 0; SDK surface check 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
What Problem This Solves
Prepares plugin admission and Codex session consumers to retain the selected incognito owner through asynchronous policy, history, and lifecycle work.
User Impact
Inactive preparation: production incognito remains host-owned and allocates no actor. Explicitly bound consumers retain execution host/node and consent policy; storage refusal is reported instead of selecting defaults. Existing installations need no migration. This PR does not activate incognito workers or retire native incognito T1 paths.
Why This Change Was Made
Registry and runtime preparation now carry the physical session source through delegated admission, callbacks, initialization, recovery, and rollback. Authority callbacks stay synchronous and live. Codex carries the same source through commands, conversation bindings, native tools/monitors, sandbox preparation, and marker/by-ID history, rejecting replacement or policy revocation after awaited work.
Fresh creation remains with the existing Gateway creator. Production acquisition, fresh actor-creation composition, and native selector/history-worker deletion remain P12 work. Workboard's synchronous sandbox contract and durable catalog/migration paths remain supported. No schema, retention, permission, content-cap, feature-flag, or worker-service change is included.
Evidence
Publication head:
9f083971d57bd62dc4911bc5a38496bacd2a88e7. SQL measurement source:5f79d6ea12ec55e3d0923da85383d819f55af0fb; baseline:2f532dfc6942ea28a820160a23f0da3b7d039555, including P03. Those source trees and tracked bytes were verified remotely. Later changes regenerate inventory source-line references and repair the fixtures/module boundaries described below; they do not change SQL behavior.The original regression, type, SDK, build/lazy-import, changed-plan and inventory proof remains preserved at its recorded sources. Final repair checks and the unrelated local type failure are detailed below. The original failed receipts remain recorded; this is not a claim that one uninterrupted
pnpm check:changedinvocation passed. The published-driver × candidate update cell is pending (lander).Lander repair at
9f083971d57bThe five native-thread failures came from fixtures mocking the previous getter seam while production now prepares through the canonical session owner. The existing tests now seed and mutate the canonical isolated session store; every ownership, dispatch, binding, invocation, and client-lifetime assertion is retained. Unbound incognito still uses the native host owner and allocates no actor.
Agent, Gateway, and subagent session wrappers are back in
registry-runtime.ts. Deletingregistry-runtime-session.tsremoves its cyclic ownership-implementation type dependency and restores the write call to its existing debt allowance. Independent namespace facade projection now lives inregistry-runtime-facades.ts, using the existing runtime type owner. No debt allowance or line-cap baseline changed. The repair is four files, +366/−409 (production +339/−405; tests +27/−4).The initial six-file focused run passed 88 tests in 207.402 s, including all five failures and unbound/native plus explicitly bound actor coverage. After the final namespace-only move, 39 registry tests passed in 126.055 s on the publication commit. The unchanged native-thread/SDK fixtures retain the initial passing receipt.
pnpm check:architecture(including madge)pnpm lint:tmp:session-accessor-boundarypnpm check:line-cap-ratchet --base 2f532dfc6942ea28a820160a23f0da3b7d039555pnpm tsgo:coreThe final architecture run reports 0 runtime value cycles and 0 madge cycles. Its four Kysely generator tests also pass. Local core types report TS2769/TS2353 in
packages/ai/src/providers/google-stream.ts:67,70: the installed Google SDK lacksFinishReason.CONTINUATION. That file andpnpm-lock.yamlare byte-identical to the integrated baseline, and the same local mismatch was recorded before this repair. There are no touched-file diagnostics; this is not reported as a passing type run. Earlier remote type receipts remain attached to their original source.Exact focused commands and proof cost
Repair proof ran under the coordinator-authorized local proof slot (six total slots, two reserved), with no remote lease or hosted proof job allocated: 0 added hosted proof job-seconds. The slot is released. The original failed line-cap probe is preserved; moving the independent facade projection resolved it without changing an allowance. No fourth P2 review round was started under the campaign's three-round convergence rule.
Existing SQL and whole-workload receipts are preserved: this repair changes fixture ownership and module placement, not emitted SQL. PM2/PM3/PM4 remain closed only for explicit actor contracts; no incognito T1 retirement is claimed. The published-driver × candidate update cell remains pending (lander).
SQL measurement
Same Linux host, equal source-performance builds with source maps, three alternating baseline/candidate pairs, followed by an extra whole-workload census pair. All eight synthetic workloads completed. Maximum canonical candidate/baseline phase median duration ratio: 1.007; no duration-skew invalidation.
The extra startup-through-shutdown pair records 22,207 → 22,061 all-thread statements (-146) and 3,419 → 3,397 logical worker requests (-22), with workload duration 57.211 → 57.407 seconds. Per-phase/thread/SQL conservation is exact; the transport census has no missing SQL context or duplicate sends. Its two unmatched sends and two unmatched receives occur on both sides and remain visible in the evidence.
The manual attribution accounts for every positive canonical SQL/thread/stack delta: 112 groups traverse 111 source files whose Git blobs are identical between baseline and candidate. The warmed difference is +41/−8 statements over ten turns (+33 total). The individual first warmed turn rises +24; it is covered by the additional whole-workload check, not omitted. Non-turn rises are within the documented +2% or +10-statement tolerance.
The conservative automatic classifier remains
INDETERMINATEbecause it leaves some worker SQL unassigned. Acceptance uses the preserved native-stack attribution and whole-workload statement/request check under the campaign rules; the classifier result is not rewritten.Positive phase attribution and whole-workload operation totals
Each phase is decomposed using the actual sample that equals its side's median total. These are not sums of per-statement medians. All positive stacks, including those in net-decreasing phases, were source-checked.
01.connect03.turn-0103.turn-0203.turn-0303.turn-0503.turn-0903.turn-1004.second-session06.cron03.warmed-meanThe whole-workload operation deltas below sum exactly to −22 requests and −146 statements. All 86 positive whole-workload native stack groups also traverse unchanged source. In particular, patch-commit SQL rises by 34 with unchanged request count; equal requests alone are not treated as equal SQL.
readonly-process / auth-profile-rowssqlite-broker / database.domain.bindsqlite-broker / database.domain.closesqlite-broker / database.domain.executesqlite-broker / database.domain.publishsqlite-broker / pluginState.compareDeletesqlite-broker / pluginState.compareUpdatesqlite-broker / pluginState.observesqlite-broker / session.entry.patch.commitsqlite-broker / session.entry.patch.preparesqlite-broker / session.maintenance.readsqlite-broker / session.pendingInputs.readsqlite-broker / session.transcript.anchors.readtask-worker / agentDatabaseRegistry.readtask-worker / config.health.readtask-worker / deliveryQueue.outboundtask-worker / mentions.snapshottask-worker / placementJournals.ownerstask-worker / plugins.deferredMigrations.readtask-worker / preparetask-worker / session-activity-summary-sourcetask-worker / session-corpus-inventorytask-worker / session-entry-readtask-worker / session-exact-entriestask-worker / session-identity-evidencetask-worker / session-maintenance-readtask-worker / session-row-backfilltask-worker / session-row-factstask-worker / session-runtime-targettask-worker / session-target-inventorytask-worker / skillLibrary.readtask-worker / transcript-anchorstask-worker / userProfiles.authority.resolvetask-worker / workerPlacements.changeSnapshottask-worker / workers.placementProjectiontask-worker / workers.placementRecoveryCandidatesunassigned / unassignedIn particular,
session.entry.patch.commithas 168 → 168 requests but +34 SQL. It is included, not offset out of the attribution: all positive native stacks in the whole pair (86 groups / +127 gross executions) are in unchanged source. The two request-positive operation families, session maintenance and placement projection, also have unchanged sender stacks. Equal request counts alone are not treated as proof of equal SQL.The Memory domain breakdown is consistent with less complete work: execute 125 → 118 requests / 864 → 812 SQL, bind 91 → 88 / 521 → 503, close 91 → 88 / 63 → 60; publication remains 93 requests with 1,601 → 1,597 SQL.
source.refreshrises 1 → 2 / 6 → 12, whilesource.replacefalls 8 → 7 / 234 → 208 andcache.writefalls 9 → 8 / 146 → 121. Domain sender stacks originate in unchanged Memory database-context source. Full subtype and caller tables are retained in the JSON.The two formally unmatched startup requests on each side are
workerEnvironments.snapshotanduserProfiles.catalog: their send target was not yet known to the observer, but process/task/type identifies one receive and one completion in timestamp order. Formal unmatched counters remain unchanged.Counts above are successful statements. Connect admission observed one handled
BEGIN IMMEDIATE: database is lockedrefusal in baseline runs [1,1,1] and candidate runs [0,1,1]; the extra census pair had one on each side. No workload failed. These original diagnostics are retained.Commands, source-qualified receipts, review, and cost
pnpm testfor history-worker, conversation-control, native-policy incognito, and SDK async files,--maxWorkers=15f79d6ea12ec--maxWorkers=1873a4b3325c1--maxWorkers=1ea673e10e24d--maxWorkers=1ea673e10e24d--maxWorkers=1 -t ...029e8c7900e7pnpm tsgo:core:testea673e10e24dpnpm tsgo:core,tsgo:extensions,tsgo:extensions:test5f79d6ea12ec029e8c7900e7plus final correctionspnpm plugin-sdk:api:diff --base 2f532dfc6942ea28a820160a23f0da3b7d039555 --head HEAD5f79d6ea12ec8925d16a.pnpm buildincluding lazy CLI bootstrap and compiled SDK exportsdac8648cb8d5node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance5f79d6ea12ecpnpm db:worker-inventory:checkand canonical regenerationThree isolated autoreview rounds completed. The final sandbox-policy predicate finding was accepted and repaired with a controlled-await regression. Subsequent source tracing repaired physical sandbox selection, retained-actor rollback root capture, premature private-binding publication on refused resume, and marker-only by-ID routing; their targeted replays pass. No fourth P2 round was run under the campaign convergence rule.
The sandbox old-code negative replay fails at the intended physical-source assertion. The earlier SDK execNode negative also reached its intended failing assertion, but its outer process receipt was interrupted; it is qualified negative evidence, not a completed command pass. Final positive SDK proof passed.
The six changed-plan failures were fixture typing, private core test imports, exported-wrapper shadowing, core/extension lint, and a stale assertion allowance. Repairs preserve behavioral assertions. The allowance update was canonically generated and shrink-only; timeout-race allowances were not expanded.
Recorded remote command wall, including failures and corrections: 7,242.107 s. This includes SQL builds/measurement/classification (703.075 s) and inventory generation/verification (7.909 s), and excludes provisioning, queue waits, downloads and outer wrapper overhead. Known GitHub Actions cost: 942 job-seconds for an expired initial Testbox that ran no lane tests; later queued admission billing and dollar cost are unavailable. Remote wall time is not GitHub CI billing.
Heavy proof used the same task-owned Hetzner lease after Testbox admission timeout and AWS vCPU-cap refusal. An initial SQL attempt stopped before measurement because
/tmpwas a small memory filesystem; fresh disk-backed paths passed the unchanged free-space floor. No local Docker was used. Raw SQL was compacted after exact conservation checks; no evidence archive was retained.Measured scope, inactive audit closure, and release-note context
Measured against the integrated baseline: production 54 files, +2,134/−1,208 (3,342 changed; +926 net); tests/support 23 files, +1,242/−332; docs 3 files, +33/−3; tooling/config 2 files, +4/−2. The private SQLite testing export is test support. Growth covers the complete plugin/Codex caller migration and retained-source guards, including owner-module moves.
PM2, PM3, PM4 close for the explicit actor consumer contracts only: plugin/delegated ownership; runtime admission and retained initializer lifecycle; Codex commands, policy, bindings, guards/monitors, and marker/by-ID history. P12 still owns production selection, fresh actor-creation composition, and native deletion. Shared P01/P02/P04 contracts are not charged again. No incognito T1 retirement is claimed.
Release-note context: internal preparation for worker-owned incognito session consumers, without production activation. Codex policy preparation preserves explicit execution host/node settings and reports storage refusal instead of falling back to defaults.
Landing follow-up
The landing fixes preserve the lazy registration import boundary, supply the canonical-descendant fixture with the prepared native execution policy, align host-rollover diagnostics, and wait for asynchronous admission before advancing fake timers. Assertions about no writes, no resume, no attachment publication, and diagnostic privacy remain intact. Fix-only P0/P1 reviews found no actionable issues.
Main was integrated through merge commits, with no rebase. The final conflict resolution retains both P07 and P08 documentation and regenerates the worker inventory from the merged source. Formatting and whitespace checks passed. Prepared head:
af4bdf311b2975819d05ff50bb216acafa337cf5.The published-driver update cell passed on
8420438826e8bfb5ec11e6ba6a45211e618b507f, reused across the subsequent documentation-only conflict resolution: published 2026.9.9 to the candidate,/readyz200, installed version verified, and durable plus incognito sessions survived. The disposable Linux runner needed Docker buildx installed before the successful run; no product workaround or budget change was used.Final-head CI retains three independently inherited failing test jobs: four session-send cases, one ordinary-directory placement case, and three Agents API retry-history cases. The session-send failures also occur in main CI; placement and Agents API failures were independently reproduced on main. All 11 named failure input paths are identical in the original qualified baseline, the current tested baseline
a2d159cadcaf384fc6f7f4d84a7dc785e0fa401d, and the tested PR merge. These failures remain failures and qualify only for the explicitly authorized inherited-CI admin exception; security and review gates are not waived.