Skip to content

refactor: move bundled session reads and authority into workers - #169622

Merged
steipete merged 230 commits into
mainfrom
dbasync/t1cut-s2-entry-workers
Oct 12, 2026
Merged

steipete merged 230 commits into
mainfrom
dbasync/t1cut-s2-entry-workers

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Ordinary session reads in Gateway routing, agent execution, sandbox policy, plugin operations, Memory SDK consumers, and status rendering still reached synchronous SQLite through owner and SDK APIs. Bundled callers now await the existing workers or consume prepared facts updated by committed write receipts. This follows #169620 (merged as 2c7cc827b309c6a2da1cd6c2aa5cb930eb326030).

The Gateway remains the single database owner. Creation and transcript writers publish their committed rows before dependent effects. Superseded write receipts invalidate derived row projections even when their member-policy facts survive. Request authorization retains those facts through dispatch and releases them with the existing owner. Catalog import binds its creation to the existing sharing authorization, forwards its creation and registration receipts, and releases the authorization when the operation ends. First-store input registration runs its existing callback inside input-actor preparation, so the committed creation is visible before chat admission. Describe-only authorization prepares its exact session row, avoiding an unrelated listing projection. Exact-run Stop captures the active controller and command cancellation targets before metadata awaits. Local model patches skip remote runtime preparation, matching runtime startup. A late superseded receipt preserves newer metadata, but still revokes an observed security-policy change; member-only successors cannot certify policy. A policy change followed by a quick restoration can conservatively reject the prepared turn; retry prepares current authority. Retained-history SSE joins the existing publication completion before its final authorization, adding no SQL. Placement maintenance merges current in-process receipts instead of rejecting an unrelated inventory revision. No new SQL, foreign-commit probes, fencing, admission phases, or cross-thread handshakes were added by these publication repairs.

All ordinary bundled reads migrate together; the four named effect-boundary readers below remain. Public synchronous SDK APIs remain warned deprecated adapters with documented async replacements. Deprecated APIs will be removed in a later release after the deprecation has shipped in a stable release. Native-incognito paths remain with #169363, still open at integration. Doctor/CLI one-shots retain their synchronous exception. Large transcript projections stay bounded in SQL. Final authority checks remain at execution, mutation, disclosure, approvals, credentials, and external publication. CLI history authorization now runs after permission/pairing/child-readiness awaits at the private-input boundary.

The host-tool and model-boundary corrections add no SQL or requests to ordinary durable chat: its composed source scopes have no leaf scoped preparation. Cold completion recovery can read readHarnessCompletionSource, and Workshop can revalidate through its anchor after a token change. Those cold paths are not claimed universally SQL-neutral or remeasured at the final head. Completed results retain their existing binding lifetime without a post-effect transcript read. Context transformation and model dispatch prepare their existing source scopes before checking authority, including a denied-tool result that bypasses tool dispatch. Cron run-now joins the existing startup owner before creating its run receipt, so startup recovery cannot mark that fresh run interrupted.

The retained synchronous SDK contracts were verified in stable v2026.10.2 (tag commit 67f65e14); no unshipped public synchronous adapter remains. Four bundled real-effect callers retain a single live check:

  • extensions/discord/src/voice/agent-control.ts:54: current permission/tool overlay before steering or cancel injection.
  • extensions/clickclack/src/discussions/binding-store.ts:39: current incarnation before cross-session disclosure or channel effects.
  • extensions/clickclack/src/discussions/binding-retention.ts:122: current absence at revocation/delete commit, preventing deletion of a returned attachment.
  • extensions/clickclack/src/discussions/service-open.ts:290: current credentials and active session before external channel creation, update, or publication.

These checks protect security or user data at the effect boundary; they are not ordinary bookkeeping reads. Deprecated APIs remain until a later release after stable deprecation.

The updater notification destination uses the async session reader. The pre-integration published-driver update cell passed; its exact scope and reuse limits are recorded below.

Removed checks and accepted edge cases

  • Duplicate admission, bootstrap, cron, status, and recovery bookkeeping reads: descriptive state can lag until the next existing publication; effect owners retain current authority.

  • Participant-only pending-publication rejection: known participant changes keep unrelated policy current; unknown and policy-changing writes still revoke it.

  • Verbosity rereads: a turn uses prepared preferences and receipts through completion.

  • Steering identity recapture: the retained source remains selected; no third read or generation handshake.

  • Suggestion target projection and post-authorization row recapture: chat dispatch uses the retained target; final chat authorization still guards the effect, and a revoked suggestion may finish its prior bookkeeping.

  • Preliminary delivery/media checks: one check remains at delivery or transcript persistence.

  • Repeated recovery entry and settings reads: recovery carries its selected facts through its own authorized writes. Stop retains one worker-prepared branch check immediately at cancellation so a request bound to a visible branch cannot cancel work on a different branch.

  • Aborted-partial rereads: reset can discard the old run's partial with a warning while cancellation succeeds. A rowless buffered Stop warns and drops its partial.

  • Repository fork rereads: an unrelated destination change conservatively retains the prepared repository for cleanup.

  • Session delete/archive repeated loads and doomed derived usage refresh: cleanup uses selected identity and committed postimages; deletion can leave the derived cache unrefreshed until removal completes.

  • GitHub option/workspace duplicate preparation: a revoked prepared response is retired even if the original state is subsequently restored; retry prepares anew.

  • Custom administrator method preparation: requests outside run/tool, communication, progress, and captured-target boundaries use the existing administrator bypass before reading session storage.

  • Retained placement pending-result/ACK/journal refusal: bookkeeping may settle while a turn uses its authorized destination; claim changes and indeterminate ownership still refuse.

  • Post-effect node ACK source recheck: an already accepted effect can acknowledge after the source projection changes; the existing pre-effect execution and publication authority remains the boundary.

  • Node maintenance response dispatch-snapshot recheck: already-dispatched pruning can settle after placement changes; live node, pairing, and coordinator custody still gate its response.

  • Same-owner draft/lifecycle custody rechecks: accepted input may finish after internal draft closure; actual revocation, changed policy, and successor-owner checks remain.

  • Unknown-tool diagnostic lookup: without prepared sandbox facts, formatting preserves the provider error.

  • Unused native retention and legacy read-plan paths: deleted with obsolete tests.

  • Sandbox source-list recapture: the compatible worker-selected sibling remains selected; final execution authority and physical custody stay enforced.

  • Deletion predicate recapture after historical cleanup: history-only invalidation retains the selected entry until the final delete transaction checks exact identity and metadata.

  • Recovery checkpoint and workspace-binding recapture: recovery may advance its own checkpoint and complete its authorized repository-to-worktree handoff; session identity, writer ownership, physical source, and placement authority still guard the effect.

  • Creation-token bind-time rereads, identity/lifetime assertions, and duplicate-token rejection: a retired internal creation token contributes no provenance; committed writer receipts and final effect authority remain authoritative.

  • Broad prepared-transcript row recheck during a mutation and duplicate source-preparation row comparison: a write can temporarily mark its own projection pending; retained lifetime and exact worker-effect identity predicates still govern the commit.

  • Stop metadata lookup behind the writer being cancelled: capture cancellation targets before the await and read metadata through the existing read-only worker. Stop continues against those captured targets; a replacement session or writer keeps its data, and stale bookkeeping is skipped with a warning.

  • Rejection of the operation’s own child-registration write: its committed receipt refreshes all prepared witnesses through their existing exact receipt filters. Registering a child in its sibling store does not itself change the parent’s security policy; genuine policy changes still revoke the relevant witness.

  • Rebinding an already admitted input to its predecessor’s session ID: accepted input may finish after an owned compaction rotates the transcript; the existing reply-admission owner still checks lineage, current database, cancellation, and live access. Original request admission remains exact, and replacements or revoked authority still refuse.

  • Placement-maintenance whole-inventory revision rejection: merge current in-process placement receipts into preservation; an obsolete placement can conservatively preserve data until the next receipt. Pending postimages add protection only. The existing deletion guard, database lifetime, and indeterminate ownership remain enforced.

  • Post-effect host-tool transcript recheck: a completed result may settle after a benign transcript write; run cancellation, Gateway lifetime, session binding, caller receipts, and workspace authority still gate it. Current source preparation remains mandatory before the next real effect.

  • Raw model context/dispatch assertions without source preparation: a benign foreground transcript write can retire the old token; the existing source scope refreshes before the next model effect, preserving revocation and cancellation authority.

  • Startup recovery racing a newly requested cron run: run-now joins the existing startup promise before recording the run; no new owner, polling, or retry.

T1 accounting

These are source sites, not statements executed in a turn. This table preserves the original lexical classification; final CI supplies the current classifier totals. The cutover changes bundled caller routes; retained mixed kernels still serve deprecated public SDK/native-incognito contracts and workers.

Original 18 files, scoped lexical inventory Base Candidate
Raw native primitive sites 46 46
Conservative mixed/native T1 sites 43 43
Doctor-only T3 sites 2 2
Existing worker-only site 1 1

This does not claim zero raw T1, zero runnable T1, or a complete T1-compat graph classification. #169620 removed one redundant cache identity query; extracting the selected-row primitive relocated one expression and is not counted as a saving. Exact fad6192d2 passed the full CI ratchet (115039311632): T1 live 463→463, deprecated-only 9→9, with dialect mechanical/design/engine-maintenance groups unchanged at 0/5/0; upstream inventory changes do not alter the scoped lexical caveat above.

Live measurement

One alternating shared-harness baseline/candidate pair used isolated state and ports, with ten warmed turns per run. The values below are within-run medians and ranges. Baseline: f2c48ebd379297acd04d5ec3598e3d6986230204; measured candidate: a7e54cd163567e1cb21534ae374a41f846ea47cf. This is integrated evidence, not an isolated measurement against the final merge base 81ad3bf71935: it includes upstream changes, including usage-cost SQL falling from 75 to 6 per turn. The later first-store registration, cold describe, cancellation, diagnostic, and type/test fixes do not add work to the measured ordinary warmed path. The host-tool and model-boundary corrections have no leaf scoped preparation on ordinary durable chat; cold Workshop and completion-recovery revalidation can read, and those paths were not remeasured. No second final-head runtime measurement is claimed.

Live pair Baseline Candidate
Warmed all-thread statements, median [min–max] 394.5 [370–420] 262 [259–275]
Warmed all-thread requests, median [min–max] 92 [80–99] 62 [61–68]
Warmed MAIN statements, median [min–max] 0 [0–1] 0 [0–0]
Whole-workload statements / requests / MAIN 10,568 / 1,796 / 1,968 7,730 / 1,401 / 1,089

All 13 turns, 40 RPCs, child execution, cron, compaction, and clean shutdown passed. Warm means were 394.3→263.2 SQL and 89.5→62.8 requests; the whole reduction is not attributed solely to this lane. The descriptive session-operation group fell from 164.7→153.4 SQL and 40.1→36.3 requests per turn, with MAIN 0→0; that group also overlaps upstream changes.

Shared family SQL per warmed turn Executing requests per warmed turn
Exact entry, all 17→16.2 12→11.2
Exact-entry facts 6→5.2 6→5.2
Legacy exact entry 12→12.1 7→7.1
Actor hydration 4.7→4 4.7→4
Entry-cache snapshots 1.4→0 0.7→0
Row facts, all 6.1→6 2.1→2
Watermarks, all 23.6→23 20.6→20
Standalone watermarks 2→3 2→3

The families overlap and are not additive. The candidate has one extra legacy session-entry-read in warmed turn 09 (0.1 per turn). Both runs call recovery shouldSwitchToLiveModel ten times; the extra request exposes only a transport stack, so its caller remains unproven. This is disclosed as a small tradeoff within the lower session-group total, not labeled inherited or timer noise. The extra standalone watermark per turn is upstream: commit 23dee3070 (#169974) added scanSqliteUsageRollup→readGeneration; its three relevant files are unchanged in this PR against 823ba031f. Both observations are recorded in the actor follow-ups.

Selected complete operation deltas expose the affected read paths: session-entry 2.5→0 SQL/0.5→0 requests, session-entry-list 0.8→0/0.2→0, session-exact-entries 9.3→9.1/3.4→3.1, session.entry.read 16.6→16/4.6→4, and session.entry.patch.commit 37→31/6→5. session-row-facts remains 5 SQL/1 request per turn. These operation groups likewise describe the integrated comparison rather than exclusive lane attribution.

Evidence

Final candidate: 8f4a601a015c6a2dc23ddb2310434f8402f54014, integrating main 81ad3bf71935d80c60a8b4a34492e51630d883c3. Completed affected CI at preceding head fad6192d21ded59a7c46b2b5ba4fe837284f8f12: https://github.com/openclaw/openclaw/actions/runs/38317384965. Prior affected-head CI (36b37d472): https://github.com/openclaw/openclaw/actions/runs/38315731739. Preceding-head 82dd6305a PR CI: https://github.com/openclaw/openclaw/actions/runs/38313840692. Reused main-tier CI at that head: https://github.com/openclaw/openclaw/actions/runs/38313866450. At fad6192d2, production and aggregate test types, all five core test-type stripes, aggregate/core/three extension lint, source contracts, architecture and baseline ratchets pass. Security also passes. The SDK report, package boundary and runtime API evidence are reused as scoped below. The preceding main integration resolved three fixture-only conflicts: shared Codex setup/cleanup, sharing-profile schema/foreground leases, and provider config restoration. Upstream and lane assertions are preserved. Knip completed with only the two documented inherited missing-root files; the SDK diff and package boundary also pass; wire behavior passes at that head. The integration preserves upstream session initialization options and this lane's committed creation publications. The latest fixture-only repairs provide the actual Memory store config, prepare the profile catalog before sticky-model scenarios, and register redacted wire-test failure diagnostics before setup awaits, using native stderr to preserve output with Vitest silent mode. Main integration preserves the upstream media config, queue config, board catalog setup and captured progress tracker. Assertions and production effect checks are preserved.

The final fad6192d2→8f4a601a0 push resolves five conflicts only. The MCP scenario keeps main’s private log/sanitizer; the creation-race test keeps main’s comment; the registry fixture keeps main’s onTestFinished cleanup and removes duplicate cleanup. The input actor preserves main’s captured execution and cold-only preparation while passing the lane’s registration callback as the existing fourth argument. GitHub session lookup preserves main’s parallel identity/personal/pending/latest reads and the lane’s authorization disposal, deleting the duplicate old identity-read block. Against final main, those production resolutions retain three actor callback lines and the GitHub lifetime disposal. Basic oxfmt, oxlint, shell syntax and whitespace checks pass. Completed fad6192d2 static evidence below is reused for this reviewed conflict-only integration; it is not represented as exact-final-head CI, and no new full CI cycle or SQL measurement was requested.

The final two-file implementation repair (1b3515f88) reuses the captured corpus reference when Memory forget classifies session-backed sources, and returns through the existing non-session push policy path when no session scope exists. It changes no SDK declaration, exported signature, inventory or wire flow. The eight Memory-forget recovery variants pass at 36b37d472 (115034120872), and all five push-authority-router variants pass there (115034121339, 4–8 ms). All affected type/lint checks pass at fad6192d2; preceding-head SDK/package evidence is reused on those unchanged inputs.

Two independent Codex autoreview rounds completed. Accepted P1 findings were fixed; no third review. The P2 voice-request authorization-release leak remains a follow-up under the two-round limit. Changed-file oxfmt, oxlint, and git diff --check pass. SQL measurement remains the valid earlier pair above; no final-head runtime measurement is claimed.

Required static family Current evidence
Production and test types fad6192d2 passes production, aggregate tests, and all five core test stripes
Type-aware and release lint fad6192d2 passes aggregate lint, both selected core stripes, and all three selected extension stripes; unchanged other core stripes passed at 82dd6305a
Source contracts fad6192d2 passes export collisions, session accessor, transaction, transcript-reader, and schema-baseline contracts (115039312290)
Knip and Madge Exact fad6192d2 architecture passes (115039312145). Knip at 82dd6305a (115026060266) passes production/full checks and all export scans; only the two inherited missing-root files below fail
T1, dialect, worker ratchets Exact fad6192d2 passes (115039311632): T1 live 463→463, deprecated-only 9→9, and unchanged dialect groups 0/5/0
SDK surface and runtime API guardrails Exact 82dd6305a passes all seven runtime guards (115026059065). Reused executed surface check at cbc23a949: 154 entrypoints, 3,736 exports, 2,189 callables, 207 deprecated, with no unauthorized stable-v2026.10.2 removals.
SDK API comparison Exact 1d62b2c0a→82dd6305a passed (115026059408), artifact 11776573599: no added/removed entrypoints, no removed exports; 24 added exports, 17 signature changes, 196 reachable export changes. Package boundary passes (115026059332)

The 82dd6305a SDK report includes SessionTranscriptCorpusOptions.config?: OpenClawConfig. Its 237 affected exports include 196 reachable-export changes; the separate declaration-detail section has 156 entries. Report digest: 7f5b3ed94d59e0ad4e16b621855a5fddf2894466c4c0e6fe5031cf0200ca3d1d. The corpus option adds no entrypoint, exported symbol, callable, or deprecation, but does change a reachable declaration. SDK script ceilings are limits, not measured surface counts. SDK barrels, Memory host SDK and Gateway client are unchanged from 82dd6305a to 36b37d472; the two final fixes alter private implementation only. Main integration is shared by base and candidate. The report is reused with this scope, not represented as a final-head declaration build.

Behavior evidence on 1cc34b0d8: orphaned recovery passed (115019295606, 11.383 seconds); Feishu rich-post transport twins and retained legacy replay passed (115019295841, 2.530 seconds); all 14 corpus cases passed, including discovery of the caller's configured store without a global runtime snapshot (115017394943, 6.774 seconds). The prior wire test timed out at 240 seconds (115019300014) without emitting its catch-path diagnostics. Exact 82dd6305a now passes node-worker-launch-wire.e2e.test.ts (115027770269): the device-runner transfer/reconcile case took 161.313 seconds, with the complete shard taking 230.66 seconds. The accompanying workspace-isolation, tool-policy-gates and workspace-mutation E2Es also pass. Failure hooks are registered before setup awaits and use redacted native-stderr diagnostics; timeouts and assertions were not relaxed. Earlier paired live proof covers all 13 turns, 40 RPCs, child execution, cron, compaction, and clean shutdown, as detailed above.

Prior Knip findings are inherited: the three production exports in delivery-queue-storage.ts and openclaw-state-feature-schema.ts match scheduled main 93087c17 (38305224828/job114997826780). Three UI team-scale exports match scheduled main 11a12460482f (38311154418/job115017223014). The cold-load benchmark/probe unused-file findings are source-proven inherited missing roots: candidate and main had identical file blobs, incoming-reference sets, scan implementation, all-exports config, and package commands. Main stopped at the earlier export failure, so no executed main unused-file result is claimed. Current 82dd6305a independently reports only those two unused files; production unused files and production/full/script export scans all pass. Inherited failures are recorded in the campaign redmain inbox.

The unchanged cron current-session completion test matches scheduled main 93087c17 (38305224828/job114997828380): cancellation prevents the transcript write, but leaves one attachment with cleanupPending while the assertion expects no records. The non-isolated-runner failures match that main run (114997828832): native run-termination.js resolution and a removed synchronous schema-version initializer. These are inherited failures, not passing tests. Other unrelated historical timeouts are omitted; exact-candidate failures will be classified from their logs.

Preceding-head 82dd6305a non-blocking findings: ordinary PR Control UI i18n passes (115027763633), while the main-tier job passes verification then reports catalog fallback baseline drift in its second command (115026058950). The UI, catalogs, schemas and i18n scripts are unchanged against integrated main; no matching failed recent-main job is claimed. Current non-isolated runner failure (115026061782) repeats the native-module and removed-initializer classes already seen on scheduled main above. The config-readiness mutation/roster case times out at 120 seconds (115026062156); it passed in this lane at 56fc in 60.082 seconds and on main 97a2785 in 38.712 seconds. Source diagnosis found the only later lane runtime change normalizes reset creation keys, while this case performs no reset; startup/reload changes come from main. This timeout is disclosed as an untouched-flow follow-up, not as a reproduced main timeout. These findings are assigned through the campaign redmain inbox.

The 82dd6305a cron fallback-transcript case finds two stopped assistant messages instead of one (115026062297). Main commit 4944a6df7 (#169773) added persistModelFallbackTranscriptNotice from run-entry.onFallbackStep; that notice uses deliveryMirror kind model-fallback and matches the old broad assistant/stop assertion. The test and notice-producing owners are byte-identical to integrated main. Prior lane candidates 1cc and 56fc passed this case in 12.981 and 24.759 seconds, before that main change was integrated. This is a source-proven inherited stale assertion assigned to that owner/redmain; no executed main failure is claimed.

The worker-deadline fallback case reports zero dispatches before its fake-timer assertion (115026061995). Its test, WorkerTaskPool and model-fallback sources are unchanged against integrated main and exercise an independent pool deadline. This is assigned as an unrelated timing follow-up based on source diagnosis; no executed main failure or exact timing cause is claimed.

The Bun personal-file cases fail because the unchanged test mock returns a profile without aliases, while main 655d57552 (#170228) now consumes those resident aliases (115027766429). The test and owner are byte-identical to integrated main. This is an inherited stale mock assigned to that owner/redmain; no executed main failure is claimed.

The native Talk action test aborts during detached-work closure at 36b37d472 (115034125334) and repeats unchanged at fad6192d2 (115039314940). Its test, control and publication owners, event/row preparation, Gateway admission and AsyncWorkScope sources match integrated main. Main e1462be71 (#170231) already moves lifecycle publication outside the producer scope, while the transcript queue still inherits the scope that detached execution drains. This is a source-attributed timing defect assigned to #170231/redmain. Cached main runs pass; no executed main failure is claimed.

The 36b37d472 artifact-API composition case times out on its final agents.delete RPC (30 seconds), after prior artifact, environment, restart and download checks pass (115034121202). The test and delete/reload owners match main 395ea60; the lane change only forwards the existing session entry, and this case has no artifact-agent session or run. Prior lane candidates passed, and recent main passed in 105.861 seconds. This is assigned as an untouched delete-flow timing follow-up; no stalled internal await or reproduced main failure is claimed.

Published-driver update passed at pre-integration 64b798a, run 38290268672/job114957477892. That result is reused for the lane's unchanged installed-updater and service-control contracts; it is not represented as an exact-current-head update run. The updater notification change awaits destination lookup. Later main integration brings upstream changes equally into base and candidate. No remote lease is held.

Size

Against integrated main 81ad3bf71935 at 8f4a601a0: 1,140 files, +30,166/−18,491 (net +11,675). Test classification is path beginning test/, or filename containing .test./.test-/.e2e./.e2e-: 567 test files, +9,074/−4,979; docs: 4 files, +81/−5; remaining production, tooling, and metadata: 569 files, +21,011/−13,507. Growth comes from the complete bundled caller/API cutover. Stable deprecated compatibility, the four named effect-boundary readers, and native-incognito contracts remain as described above.

@clawsweeper

clawsweeper Bot commented Oct 12, 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 app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core scripts Repository scripts commands Command implementations agents Agent runtime and tooling channel: x size: XL labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR moves bundled session reads into existing database workers and carries committed facts through runtime authorization.

Example: The Gateway reads session metadata for agent:main:main.

  • Before: Bundled callers can query SQLite synchronously on the Gateway thread.
  • After: Callers await worker reads and consume retained facts updated by committed writes.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful architectural work remains unready because the deferred disclosure guard and voice cleanup are incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Synchronous session database reads can block Gateway work across routing, execution, plugins, and status rendering.
Reason: The maintainer-authored direction implements the documented worker ownership model and preserves released synchronous SDK adapters.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep open: this maintainer-directed worker cutover has clear value, but both previously reported defects remain in the reviewed head.

Priority: P2
Reviewed head: fad6192d21ded59a7c46b2b5ba4fe837284f8f12

Before merge

  • Add real behavior proof - Authority-chain proof required: provide redacted terminal output or logs showing successful same-account CLI argv recovery and rejection before private argument transfer when history authority changes during broker or relay transport preparation. The earlier isolated Gateway workload supports ordinary worker behavior, while the inspected mocked relay regression covers stdin only. Redact credentials, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Validate history at the deferred argv disclosure boundary (P1) - For a CLI backend carrying recovered history in argv, prepareSpawn validates history before createChildAdapter constructs the transport. The relay then awaits transportReady before sending the start frame containing those arguments. If history ownership or coverage changes during that wait, the later assertCurrent checks only run liveness because executePreparedCliRun now installs cliHistoryWriter.assertCurrent instead of assertReadable. The private prompt can therefore cross the process boundary after its history authority has been revoked. Perform history validation after deferred transport preparation and preserve its authority through the actual argument transfer. This previously reported blocker remains unchanged.
  • Release voice-request authorization when the request settles (P2) - When talk.voice.get or talk.voice.set requires session facts, resolveSessionMutationAuthorizationAsync allocates retained sharing reads and session-change subscriptions. resolveVoiceCaller returns only closures using authorization.assertCurrent, so neither successful requests nor subsequent handler failures release this newly allocated authorization. Repeated voice requests accumulate retained readers and listeners, increasing memory and publication work. Return the release operation with the caller and invoke it from the handlers' finally blocks, including resolution failures after acquisition. The body records this as a follow-up, but the defect remains in this head.
  • Resolve security concern: Run liveness does not establish history ownership - The original history contract independently binds transcript coverage and the selected account; keeping the run active cannot substitute for that authorization.
  • Explain or restore the original intent of CLI history disclosure - e20b56c: Recover saved CLI context without crossing authentication-account boundaries, including during deferred execution.

Findings

  • [P1] Validate history at the deferred argv disclosure boundary — src/agents/cli-runner/execute-process.ts:354-356
  • [P2] Release voice-request authorization when the request settles — src/gateway/talk/handlers/voice.ts:41-47
  • [high] Run liveness does not establish history ownership — src/agents/cli-runner/execute.ts:131

Provenance

  • CLI history disclosure changes intended behavior without addressing why it exists (e20b56c: Recover saved CLI context without crossing authentication-account boundaries, including during deferred execution.)

Tests

  • Missing end-to-end proof: The supplied evidence does not show allowed same-account argv recovery and rejection before argument transfer when history authority changes during broker or relay preparation; base-failing regression execution for that scenario is also unshown.
Agent review details

How this fits together

Gateway routing, agent execution, plugins, and status rendering consume session metadata; database workers return prepared facts, while runtime owners authorize subsequent effects.

flowchart LR
  A[Gateway and bundled callers] --> B[Session read preparation]
  B --> C[Database workers]
  C --> D[Prepared session facts]
  E[Committed write receipts] --> D
  D --> F[Live authority checks]
  F --> G[Execution and disclosure]
Loading

Technical review

Best possible solution:

Complete the worker cutover while preserving history authorization at argument disclosure and releasing request-owned voice facts.

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

Source tracing establishes both remaining paths; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Using existing workers and committed receipts fits the repository architecture, provided final-effect authorization and ownership cleanup remain intact.

Full review comments:

  • [P1] Validate history at the deferred argv disclosure boundary — src/agents/cli-runner/execute-process.ts:354-356
    For a CLI backend carrying recovered history in argv, prepareSpawn validates history before createChildAdapter constructs the transport. The relay then awaits transportReady before sending the start frame containing those arguments. If history ownership or coverage changes during that wait, the later assertCurrent checks only run liveness because executePreparedCliRun now installs cliHistoryWriter.assertCurrent instead of assertReadable. The private prompt can therefore cross the process boundary after its history authority has been revoked. Perform history validation after deferred transport preparation and preserve its authority through the actual argument transfer. This previously reported blocker remains unchanged.
    Confidence: 0.98
  • [P2] Release voice-request authorization when the request settles — src/gateway/talk/handlers/voice.ts:41-47
    When talk.voice.get or talk.voice.set requires session facts, resolveSessionMutationAuthorizationAsync allocates retained sharing reads and session-change subscriptions. resolveVoiceCaller returns only closures using authorization.assertCurrent, so neither successful requests nor subsequent handler failures release this newly allocated authorization. Repeated voice requests accumulate retained readers and listeners, increasing memory and publication work. Return the release operation with the caller and invoke it from the handlers' finally blocks, including resolution failures after acquisition. The body records this as a follow-up, but the defect remains in this head.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Session worker routing and committed facts keeps the original intent (2c7cc82: Move catalog SQLite work off the Gateway thread and reuse facts under the existing writer-receipt owner.)

Testing

Proof path: shipped entry point.

Security

Needs attention: Private CLI history needs current disclosure authority through deferred argument transfer.

Evidence

Security concerns:

  • [high] Run liveness does not establish history ownership — src/agents/cli-runner/execute.ts:131
    The original history contract independently binds transcript coverage and the selected account; keeping the run active cannot substitute for that authorization.
    Confidence: 0.98

What I checked:

  • Pinned introduction: Reviewed introduced hunks against the pinned base, including the CLI history, process supervisor, voice authorization, SDK compatibility, and receipt-publication owners. (fad6192d21de)
  • Deferred argv disclosure: CLI argv history uses prepareSpawn, which runs before adapter construction; relay construction subsequently awaits transportReady before sending the start frame containing arguments. Later assertions check run authority without rereading history authority. (src/agents/cli-runner/execute-process.ts:355, fad6192d21de)
  • Unreleased voice authorization: Voice callers retain the async authorization assertion but discard its release operation; the preparation owner registers session-change subscriptions and retained sharing reads that require explicit release. (src/gateway/talk/handlers/voice.ts:42, fad6192d21de)
  • Prior findings remain: The CLI disclosure and voice authorization owners are unchanged from the previous reviewed head; both findings were already reported. (fad6192d21de)
  • Original history-isolation contract: The merged recovery implementation explicitly preserves account-isolated history authorization through deferred execution: fix: restore context when CLI recovery starts a fresh session #140294. (src/agents/cli-runner/history-boundary.ts, e20b56c0b26e)
  • Supplied behavior evidence: The complete PR body reports an isolated Gateway workload at a7e54cd, with scoped reuse limits and a published-driver update result. All three prepared images were inspected; they show fallback and recovery history, not CLI argv authorization. (fad6192d21de)

Likely related people:

  • Peter Steinberger: Raw commit af0c38c adds src/config/sessions/session-entry-read-runtime.ts:398 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: af0c38c557c9; files: src/config/sessions/session-entry-read-runtime.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a normal-priority runtime performance refactor with concrete merge blockers, rather than an established deployed incident.
  • merge-risk: 🚨 compatibility: Public SDK session, approval-routing, and harness APIs gain async replacements and deprecation behavior; the maintainer-directed compatibility path retains existing synchronous contracts.
  • merge-risk: 🚨 security-boundary: The deferred argv path can disclose prepared private history after its durable read authority changes.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

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

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (23 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-12T17:37:14.931Z sha fab9d25 :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv launch boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T18:02:52.698Z sha a7e54cd :: needs real behavior proof before merge. :: [P1] Validate history after relay readiness before transferring arguments | [P2] Release voice-request authorization when the request settles | [P2] Prepare describe rows before invoking projection-based authorization
  • reviewed 2026-10-12T19:36:01.054Z sha 25e3e1d :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T19:54:59.901Z sha 5e20d90 :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T20:45:40.511Z sha ddbcd13 :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T21:08:00.458Z sha 3f3de6c :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T22:07:45.987Z sha 82dd630 :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles
  • reviewed 2026-10-12T22:31:09.321Z sha 36b37d4 :: needs real behavior proof before merge. :: [P1] Validate history at the deferred argv disclosure boundary | [P2] Release voice-request authorization when the request settles

Reviewed October 12, 2026, 6:47 PM ET / 22:47 UTC (Revision 24).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web channel: x commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: codex extensions: copilot extensions: memory-core Extension: memory-core extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant