Skip to content

perf(gateway): prepare sharing and custody authority through session workers - #165600

Merged
steipete merged 9 commits into
mainfrom
dbasync/sharecustody
Oct 5, 2026
Merged

steipete merged 9 commits into
mainfrom
dbasync/sharecustody

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The #156941 adoption in #164682 moved the first sharing lookup to workers but left repeated custody assertions issuing 55 main-thread SQLite statements per warmed chat turn. Accepted input must still detect sharing or custody changes between admission and dispatch.

Why This Change Was Made

Prepare exact session rows and membership through the existing session readers, then carry transaction-local facts through pending-input, transcript-turn, and SessionManager writer grants. Each synchronous consumer retains its captured physical source and writer FIFO, fences intervening synchronous SDK writes with the native mutation witness, and validates the original caller immediately before dispatch or commit. Collected input validates every source against the same final row/membership snapshot.

Bundled dispatch, retries, followups, ACP initiation, steering persistence, and dedupe preparation consume these facts. Accepted persistence remains joined through cleanup, including unknown outcomes. Pre-ACK steering settlement joins the backing owner and does not start new source-workspace preparation after acceptance.

User Impact

The moved sharing/custody reads leave the Gateway thread while preserving live authority. No new service, cache, schema, permission, retention, durability, configuration, or environment variable is introduced. No update migration is needed. Incognito continues through its existing process-held owner.

Three retained synchronous paths bound the zero-SQL claim:

  • The released opaque question-dispatch source guard remains at src/auto-reply/reply/dispatch-acp.ts:309 → src/sessions/user-turn-transcript-runtime-context.ts:36. It is reachable through the v2026.9.8 agent-harness SDK (QuestionInputAuthority/AgentQuestionDispatcher). Its replacement needs a versioned awaited question contract and bundled-caller cutover; removal belongs to the next SDK major.
  • The existing qualified-source ambiguity guard at src/config/sessions/session-accessor.entry.ts:460 retains indexed absence queries at src/config/sessions/session-accessor.sqlite-exact-read.ts:286. Non-selected physical sources are other-owner reads; alternate keys on the selected source can be same-owner legacy reads. Ordinary unambiguous targets skip these probes. This is follow-up debt, separate from the moved sharing/custody operations.
  • Foreign-store metadata rewrites retain the original source's live host assertion at transaction and commit in src/agents/sessions/session-manager-message-admission.ts:34–37. This is pre-existing indexed OTHER-owner SQL: destination facts cannot authorize disclosure of source content. The same-store path consumes transaction-local worker facts.

Evidence

Original measured candidate: 5c4b624a15f4fe455ae1e8cc2db3b117f4d11061; original pinned base: 689bda012dae1fd39862098df4e3393590be89c5.

Current candidate: 2eb044b52310b9cbaed56a9ecbb718f15c0606d8, including main 4f83b608af8b4b3a8f6a2685eb788baf45dbc69f through merge commit 490558b8eeccb72a709e3ced5fe078fb308fa860. Conflict resolution retained main's native-mutation fence and typed transcript-conflict error alongside the custody cutover.

490558b8 validation passed 158 tests across 14 files (1,080.78 s), then 224 tests with one existing skip across 11 files (917.92 s), each using pnpm test <files> --maxWorkers=1. Coverage includes live sharing revocation after acceptance and before dispatch, profile binding, steering, withdrawal, ordered readers, foreign rewrite, recovered input, dispatch, shutdown, indirect callers, and worker/wrapper import closures. Core production and all 27 core/test type graphs passed; madge and runtime import checks found zero cycles. The worker ratchet passed and no new OPENCLAW_* names were added. The native routing audit found the affected real-custody tests already in host-owned projects.

CI on 490558b8 exposed two PR-caused regressions, repaired in 2eb044b5: ordinary compaction handoff was incorrectly checked as restart-dedupe input before eligibility; asynchronous custody rejection was incorrectly marked as dispatched, skipping pending-input cleanup. The repairs retain lifetime checks during preparation and full authority at claim, and transfer cleanup ownership only after actual dispatch handoff. No assertions or test deadlines were weakened. Clean-main comparison runs pass both affected flows. Fresh full-diff Codex P2 review, core types, and scoped lint pass. The repaired head passed 80 tests across six files with --maxWorkers=1 in 955.67 s, including the full compaction and resumed-session suites. Compaction attribution used five Node 24 runs on each side: the pre-fix PR failed the same three cases every time, while main passed all seven cases every time. Resumed-session attribution also reproduced five PR failures against five passing main controls; the first run preserved the full original order, followed by four selections of the primary failing case. All reproduction processes are closed. CI run 37329881341 completed successfully on exact head 2eb044b52310b9cbaed56a9ecbb718f15c0606d8; its 28 Node test steps used 5,394 aggregate CI seconds across parallel jobs. No CI failure exception is needed.

Fresh SDK report for the integrated tree: 179 reachable exports, 17 reachable declaration differences, zero direct export declaration/signature changes, and zero added/removed entrypoints, digest 8a559fd9. Inspection against released v2026.9.8 confirms existing synchronous receipt, recorder, and question contracts remain unchanged; additions are optional. The three-file CI repair changes only function bodies and leaves those declarations unchanged.

The prior three Knip findings below belong to the original base. On clean main 4f83b608, the production Knip command instead reports BranchSummaryResult (src/agents/runtime/index.ts), renderRootHelpText (src/cli/program/root-help.ts), stripEnvelopeFromMessage (src/gateway/chat-sanitize.ts), and resolvePolicyPluginActivationState (src/plugins/config-policy.ts); the integrated candidate reports the same four findings. All four files are untouched by this PR. Baseline reproduction took 206.03 s. Every remaining check after that inherited failure passed separately.

Published-driver update cell passed on Blacksmith Testbox tbx_01m469pqg7fh5jmvf2njbsea7g (workflow). The canonical packer built exact commit 2eb044b52310b9cbaed56a9ecbb718f15c0606d8 / tree 795f1e2c8160c42e96e30ae7e01183c7cc3f0e2d; package integrity passed, SHA-256 d3b8a0fd0321fc53c466843f0a008e5290b3bf7ee93174c278f6374bce036f90. The native published-driver-update-docker.sh cell ran published 2026.9.8 against that candidate and finished with readyz=200, verified running build/version, and passing durable/incognito state assertions. The update took 215.355 s; the full remote build/package/cell command exited 0 in 19m3s. Fixture service shutdown passed. The earlier integration-candidate lease was stopped while queued before any build or cell started.

ClawSweeper completed its trusted review of 2eb044b5 at 2026-10-05T15:14:48Z with no actionable code or security findings. Its only remaining qualification requests are satisfied by the completed repair controls and published-driver proof above.

Current candidate surface: production +776 / -150 / net +626 across 33 files; tests/support +652 / -92 across ten files; docs +11 in one file. Total 44 files. No new tests or weaker assertions were added for the landing repairs.

The performance measurements below retain their original candidate identity.

Matched sqlmeasure4 runs on pinned base → final head, three repetitions each, Node 24.21.0 / SQLite 3.53.4, unchanged six-file harness with native-call calibration and source-map attribution:

  • T1 / warmed MAIN per turn: 140.4 → 88.0 (−37.32%). Before repetitions: 139.9, 141.6, 140.4; after: 87.4, 88.7, 88.0.
  • Sharing/custody MAIN per turn: 55.0 → 0.0. Before: 55.0, 54.8, 55.0; every after repetition: 0.0.
Targeted caller attribution, statements per ten warmed turns Before median After
Freshness envelope, openclaw-agent-db-readonly.ts:116 210 0
Exact row, session-accessor.sqlite-entry-read.ts:101 170 0
Participant projection, session-accessor.sqlite-participant-projection.ts:56 170 0

These sites retain SQL for unrelated callers; the table classifies the sharing/custody stack. The exact median-run MAIN delta reconciles as −55.0 sharing +2.0 existing verbose schema/user probes −0.3 sandbox +0.9 scheduled GitHub OAuth maintenance = −52.4/turn. All remaining owner cohorts are unchanged; no unattributed remainder.

SQL execution counts, independent medians Before After
Warmed ten turns: Gateway main 1,404 880
Warmed ten turns: worker threads 21,292 23,013
Warmed ten turns: child processes 658 662
Warmed ten turns: all 23,349 24,547 (+5.13%)
Whole workload: Gateway main 6,307 5,546
Whole workload: worker threads 40,040 41,851
Whole workload: child processes 1,123 1,131
Whole workload: all 47,492 48,529 (+2.18%)

Independent medians need not sum. The tradeoff is more worker SQL while removing synchronous custody reads from the Gateway thread. These are execution counts, not latency claims. Testbox queued without a runner for about 15 minutes and was stopped; remote admission then reached its shared fleet limit, so the final pair ran in an isolated local checkout with synthetic state. No budget bypass or active cloud lease remains.

Every run completed all 13 turns, native child work, cron (finished/ok), compaction and clean shutdown. Audit-prune lock retries occurred before [2,0,1] and after [1,1,4], with matching stacks and successful same-worker DELETE/COMMIT settlement. After run 3 also had two boot operator-approval lock retries that settled through the same owner. All database paths stayed inside the fixtures. Baseline run walls: 276.1/267.8/305.1 s; final: 160.3/237.3/151.5 s. Fresh final runtime build: 542.6 s.

All focused commands use pnpm test <files> --maxWorkers=1. Wall times include worker preparation on the loaded local host; they are not CI runtime claims.

Coverage Passing cases Wall time
Sharing, custody, withdrawal, profile binding and steering 96 / 7 files 1,865.67 s
Shared-registry import closures and runtime-process build graph 16 / 5 files 298.86 s
Indirect transcript, identity and consumed-input callers 70 / 3 files 949.03 s
Ordered admission, worker reads and pending custody 50 / 4 files 665.59 s
Browser custody, ACL, lifecycle and workspace 4 selected cases 305.51 s
Foreign rewrite, persistence, compound worker and synchronous SDK controls 111 / 6 files 1,324.10 s
Foreign rewrite on final test bytes 2 355.21 s
Qualified session lookup 2 selected cases 570.22 s
Real chat.send first-assistant timing 1 selected case 486.59 s
Dispatch, ACP, followups, restart recovery and real server close 170 / 8 files 866.68 s
Chat admission, injection, identity and pending-input storage 129 / 6 files 962.10 s

Core/test types, scoped lint, line-cap and assertion-safety ratchets passed. Database-worker ratchet passed against the pinned base (34.66 s); final madge reported 0 cycles (141.26 s). No environment names were added (464 before and after). Indirect caller tests were audited for worker routing; they already belong to host-owned projects, so no routing exception was needed.

node scripts/check-changed.mjs --staged --base 689bda012dae1fd39862098df4e3393590be89c5 --timed ran for 1,888.07 s and failed at inherited Knip findings: GoogleMeetJoinResult (extensions/google-meet/src/transports/types.ts), resolveGatewayWorkboardWorkspaceAccess (extensions/workboard/src/gateway-helpers.ts) and MeetingRuntimeOwner (src/meeting-bot/runtime-facade-types.ts). The exact production Knip command reproduced all three on clean base 689bda in 389.59 s. All preceding guards and core plus 27 test type graphs passed; every remaining native check after Knip was run and passed. Subsequent corrections passed affected types, lint and ratchets. The inherited findings are left visible and untouched.

Plugin SDK diff against the pinned base: 179 exports affected transitively (reachable), 17 unique reachable declaration diffs, zero direct export declaration/signature changes and zero entrypoints added or removed. The changes add optional async/lifetime/authority fields; released synchronous receipt, recorder and question contracts remain intact. Reviewed digest: f1d50ae1. The command and native temporary-worktree cleanup completed successfully in 985.9 s.

The real transcript boundary failed before the cutover with 264 caller-thread SQL observations, then passed with zero after it. These observations include preparation and execution and are separate from the statement-count benchmark. The workspace steering regression also failed on the earlier candidate with an erroneous source terminal result and passed after the settlement repair. Existing browser ACL/lifecycle expectations remain intact; restoring access cannot revive refused input.

Codex P2 review is clean for the full change and the final corrections, including final test bytes. Madge initially found a cycle through a state-database facade; importing the existing leaf contract corrected it. Review and regression work also repaired ordered-read reentry and foreign-store metadata authorization: negative controls fail on the preceding implementation, while current-source tests pass. The final committed tree matches the reviewed and tested tree.

Original measured candidate production: +791 / −145 / net +646, 936 changed lines across 33 files. Tests/support: +652 / −92 across ten files; documentation: +11 in one file. Total: 44 files. No changelog edit (release-owned).

Related overlapping work: #165028 (shared source seam), #165205, #165193 (incorporated through the pinned main base), and #162433. This branch uses the existing owners and does not alter another PR branch. Concurrent session, channel, and incognito cutovers may require focused reconciliation by the later lander.

@clawsweeper

clawsweeper Bot commented Oct 5, 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.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 2eb044b52310b9cbaed56a9ecbb718f15c0606d8
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/session-mutation-authorization-error.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 5, 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. 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 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 11:14 AM ET / 15:14 UTC (Revision 3).

ClawSweeper review

What this changes

The PR moves repeated session-sharing and accepted-input authority reads into existing workers while retaining live authorization before dispatch and transcript writes.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains useful follow-on work beyond the merged admission repair. No actionable introduced defect was found, but the declared latest-repair and update qualification is not yet complete.

Priority: P2
Reviewed head: 2eb044b52310b9cbaed56a9ecbb718f15c0606d8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent worker migration with substantial real behavior evidence and no actionable finding, subject to its remaining declared qualification.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Recorded real-runtime turns exercise worker-backed custody, transcript persistence, and shutdown; integrated authority cases cover revocation and steering, and the latest repair reports real-Gateway cancellation and child-resume success. Historical benchmark identities remain explicit. Remaining repair/update qualification is separate; 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 (terminal): Recorded real-runtime turns exercise worker-backed custody, transcript persistence, and shutdown; integrated authority cases cover revocation and steering, and the latest repair reports real-Gateway cancellation and child-resume success. Historical benchmark identities remain explicit. Remaining repair/update qualification is separate; no stored-data contract changes.
Evidence reviewed 9 items Pinned change identity: The clean checkout matches the verified original PR head. Review used the merge-base-to-head introduced delta; the supplied stale test merge was not used to claim what merging removes.
Authority remains closure-bound: Prepared facts are consumed under the original authorization's target, policy, profile, and physical-source checks. Collected input revalidates each source against one final snapshot; worker transaction and commit grants return to retained host custody.
Final repair inspected: The latest commit leaves full authority validation at restart-dedupe claim and marks agent dispatch ownership only after the guarded callback enters. This addresses the two regressions described in the body without weakening authority checks.
Findings None None.
Security None None.

How this fits together

Gateway chat admission accepts user input and binds it to a session and caller. Session workers prepare current storage and membership facts, which the Gateway checks before dispatching agents or committing transcripts.

flowchart TD
  A[User chat input] --> B[Gateway admission]
  B --> C[Session read workers]
  C --> D[Current session and membership facts]
  D --> E[Live caller and custody checks]
  E --> F[Agent dispatch]
  E --> G[Transcript writer]
  G --> H[Committed input and settlement]
Loading

Before merge

  • Resolve merge risk (P1) - The published-v2026.9.8-driver update cell and remaining qualification of the latest dedupe/undispatched-cleanup repair have no completed result in the captured evidence.
  • Complete next step (P2) - Record completed remaining repair proof and pre-fix controls, plus the published-v2026.9.8-driver update result for this candidate.
Agent review details

Security

None.

PR surface

Source +626, Tests +560, Docs +11. Total +1197 across 44 files.

View PR surface stats
Area Files Added Removed Net
Source 33 776 150 +626
Tests 10 652 92 +560
Docs 1 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 44 1439 242 +1197

Review metrics

Metric Value Why it matters
Production and test growth production net +626; tests/support net +560 The introduced delta adds worker-fact transport and live custody guards; the body explains why this production growth is needed.

Merge-risk options

Maintainer options:

  1. Complete candidate qualification (recommended)
    Record the remaining repair controls and successful published-driver update result while preserving the completed SDK and authority evidence.

Technical review

Best possible solution:

Preserve the existing worker and custody owners, released synchronous callbacks, and current authorization semantics while qualifying the candidate through the published updater.

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

Not applicable to this performance refactor; the body provides repeated real-runtime SQL measurements, and no new failing path was established during this read-only review.

Is this the best way to solve the issue?

Yes: carrying fresh facts through existing readers and writer grants preserves one authority owner and avoids a competing cache or scheduler.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded Gateway responsiveness improvement with no demonstrated current emergency.
  • merge-risk: 🚨 compatibility: Released synchronous contracts remain intact, but the explicitly planned published-driver qualification is still incomplete.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Recorded real-runtime turns exercise worker-backed custody, transcript persistence, and shutdown; integrated authority cases cover revocation and steering, and the latest repair reports real-Gateway cancellation and child-resume success. Historical benchmark identities remain explicit. Remaining repair/update qualification is separate; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded real-runtime turns exercise worker-backed custody, transcript persistence, and shutdown; integrated authority cases cover revocation and steering, and the latest repair reports real-Gateway cancellation and child-resume success. Historical benchmark identities remain explicit. Remaining repair/update qualification is separate; no stored-data contract changes.

Evidence

What I checked:

  • Pinned change identity: The clean checkout matches the verified original PR head. Review used the merge-base-to-head introduced delta; the supplied stale test merge was not used to claim what merging removes. (2eb044b52310)
  • Authority remains closure-bound: Prepared facts are consumed under the original authorization's target, policy, profile, and physical-source checks. Collected input revalidates each source against one final snapshot; worker transaction and commit grants return to retained host custody. (src/config/sessions/session-pending-input-authority.ts:28, 2eb044b52310)
  • Final repair inspected: The latest commit leaves full authority validation at restart-dedupe claim and marks agent dispatch ownership only after the guarded callback enters. This addresses the two regressions described in the body without weakening authority checks. (src/gateway/agent-turn/agent-run-execution-phase.ts:174, 2eb044b52310)
  • Complete captured body inspected: The retrieved body matches captured SHA-256 235454cd59140ba4879650921447770a47f4a4d18c8e24e062ec9c039e5076ca, including the omitted tail. It records real thirteen-turn runtime measurements on 5c4b624, integrated-head revocation/steering qualification on 490558b, and passing repaired real-Gateway cancellation and visible-child resume cases. Historical measurements remain attributed to their original candidate. (2eb044b52310)
  • Remaining declared qualification: The captured body explicitly says remaining focused repair proof, repeated pre-fix controls, and the published-driver update cell are still running. The previous review's SDK concern is addressed by the fresh integrated-tree report; the pending update result is not presented as completed. (2eb044b52310)
  • Released synchronous contracts retained: Direct release-source inspection confirms v2026.9.8 exposes synchronous withPendingInput and completeProcessing. The branch retains those signatures and adds optional awaited/lifetime members. The body reports 179 reachable exports, 17 reachable declaration differences, zero direct export signature changes, and zero entrypoint additions/removals. No stored schema or serialized format change was found. (src/sessions/user-turn-transcript.types.ts:225, fc23bc864e45)

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)
  • galiniliev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record completed latest-repair controls and the published-v2026.9.8-driver update cell for the reviewed candidate.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-05T13:59:47.237Z sha 5c4b624 :: blocked before merge. :: none
  • reviewed 2026-10-05T14:23:53.130Z sha 490558b :: blocked before merge. :: none

@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Keep restart-dedupe eligibility with its existing owner and revalidate full authority at the claim. Mark Gateway dispatch ownership only after its guarded callback enters, so asynchronous custody refusal still settles queued input and releases admission.
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 38d1253 into main Oct 5, 2026
149 checks passed
@steipete
steipete deleted the dbasync/sharecustody branch October 5, 2026 15:33
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 5, 2026
Incognito pending-input staging used file-backed custody facts that cannot
represent its process-local database identity. Keep this route under its
existing native source and permission guards through staging, dispatch,
transcript persistence, and accepted settlement. Durable worker custody is
unchanged. This fixes the valid chat.send rejection introduced by #165600.

Strengthen the existing native custody test with real Gateway authorization:
metadata and transcript writes succeed, caller revocation prevents the next
effect, and accepted transcript data and cleanup survive that revocation.
The regression fails on current main with SESSION_MUTATION_AUTHORIZATION_CHANGED.

Validation: 26 focused custody/sharing/freshness tests passed in 257.53s wall
(2.974s for the native Incognito case); isolated pre-fix regression failed in
103.43s wall. Codex review is clean through P2. No schema, permission, retention,
or update migration changes are required.
The full changed-file gate passed in 982.08s, including core production and
all 27 core-test type graphs, typed lint, storage ratchets, and import checks.

Linux end-to-end replay did not execute: Testbox allocation timed out, AWS
refused capacity, and the Hetzner source-witness check refused the textual
diff before tests despite matching base and candidate file hashes. The
unrelated Doctor 60-second failure remains unresolved; no deadline or retry
policy was changed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…workers (openclaw#165600)

* perf(gateway): prepare sharing and custody authority through session workers

Carry fresh row and sharing facts through existing session readers and writer grants while retaining live source custody before dispatch and commit. Fence synchronous SDK mutations, retain physical owners through cleanup, and join accepted persistence without replaying unknown outcomes.

* chore(sessions): document worker fact assertion invariants

* test(gateway): retain profile source in authorization fixtures

* fix(gateway): keep custody errors on leaf state contracts

* test(gateway): clean up custody settlement checks

* fix(sessions): preserve custody across nested reads and foreign rewrites

* fix(sessions): preserve custody preparation and undispatched cleanup

Keep restart-dedupe eligibility with its existing owner and revalidate full authority at the claim. Mark Gateway dispatch ownership only after its guarded callback enters, so asynchronous custody refusal still settles queued input and releases admission.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
Incognito pending-input staging used file-backed custody facts that cannot
represent its process-local database identity. Keep this route under its
existing native source and permission guards through staging, dispatch,
transcript persistence, and accepted settlement. Durable worker custody is
unchanged. This fixes the valid chat.send rejection introduced by openclaw#165600.

Strengthen the existing native custody test with real Gateway authorization:
metadata and transcript writes succeed, caller revocation prevents the next
effect, and accepted transcript data and cleanup survive that revocation.
The regression fails on current main with SESSION_MUTATION_AUTHORIZATION_CHANGED.

Validation: 26 focused custody/sharing/freshness tests passed in 257.53s wall
(2.974s for the native Incognito case); isolated pre-fix regression failed in
103.43s wall. Codex review is clean through P2. No schema, permission, retention,
or update migration changes are required.
The full changed-file gate passed in 982.08s, including core production and
all 27 core-test type graphs, typed lint, storage ratchets, and import checks.

Linux end-to-end replay did not execute: Testbox allocation timed out, AWS
refused capacity, and the Hetzner source-witness check refused the textual
diff before tests despite matching base and candidate file hashes. The
unrelated Doctor 60-second failure remains unresolved; no deadline or retry
policy was changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. security-sensitive-changed 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