Skip to content

fix: preserve approval and workspace state after lost worker replies - #168094

Merged
steipete merged 4 commits into
mainfrom
dbasync/sw4a
Oct 10, 2026
Merged

steipete merged 4 commits into
mainfrom
dbasync/sw4a

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Managed approval, placement, and workspace writers do not consistently publish their committed facts before completion. Some wait for an ordinary worker reply, and local workspace recovery reconstructs a row from the caller's stale snapshot after that reply is lost.

User Impact

Committed local workspace state now survives reply loss without adopting stale caller fields. Approval, environment, placement, and workspace owners receive exact committed facts through their existing publication boundaries. Final authority guards remain in place; this does not make incomplete writer families eligible for guard removal.

Schemas, stored bytes, permissions, retention, and released synchronous SDK completion contracts are unchanged. The published-driver × candidate update cell passed on the final head before merge.

Why This Change Was Made

This is the approval/exec and placement/environment/workspace portion of S4, using the merged receipt contract from #167570. Native kernels capture postimages or tombstones in their existing mutation statements. Workers install those facts from native COMMIT evidence, independently of reply delivery; settlement-dependent signals still wait for transport recovery. Compound publications install all facts before public observers, and proven rollbacks preserve prior facts.

The Gateway is the runtime database writer. No foreign-commit freshness probes are added. Other processes must use the Gateway or hold offline custody while it is stopped. This PR does not change SDK versions or remove final guards.

Coverage and retained boundaries

Family Managed coverage
Operator approvals Insert, resolution, denial, consumption, expiry, orphan cancellation, corrupt-row terminalization, and retention deletion publish row postimages or tombstones. Mutations during lookup/list are included. Existing resolution and cron receipts are preserved.
Exec policy Native and worker configuration updates, initialization, restoration, authorization accounting, MCP grant changes, and retirement carry policy facts. Usage-only writes are distinguished from policy edits; socket credentials are excluded.
Environments Exact affected-ID tuples replace environment, credential, and attachment facts, including absence and complete attached-session arrays. Attachment moves cover both environments. Existing native overlays and bootstrap hydration remain with the same owner.
Placements Existing claim/tool receipts are preserved; pending-result mutations publish postimages/tombstones and journal mutations publish presence. Facts install at COMMIT; teardown and other settlement signals wait for accepted work.
Workspace state Setup, aliases, complete attestation hash sets, expiry, and deletion publish exact facts. Repointed alias custody is preserved.
Local/repository workspaces Worker recovery uses native postimages, and native repository writes update the existing prepared-row owner. Captured absence cannot revive after create/delete; missing-ID lookups do not accumulate permanent slots.
Node prepared workspaces Registration, binding, mutation reservation/completion, and retirement publish committed lifecycle rows.

Explicitly incomplete: arbitrary raw/trigger/cascade writers; standing-grant generation companions, cascade child identities, and cron-specific worker transport of grant revocation facts; invalidation-only placement move error/cancellation paths; offline Doctor relocation/import. Retirement adapters without definite native settlement remain conservatively unknown. Existing exec, node dispatch, placement, workspace, and grant guards remain mandatory. These receipts confer neither permission nor cross-store exclusion.

Evidence

Final pushed head: 9c7a3b10f35038e57ed00418bcb33a92ebf84313.

  • 356 distinct focused cases passed across the exercised owner/sibling suites, reusing unchanged passing coverage across repairs. New coverage exercises nested rollback, all-facts-before-observers, delayed receipt supersession, exact postimages/tombstones, lost replies, closure during accepted settlement, and absence ABA.
  • The local-workspace regression fails on baseline 31c35d5f5b093b7f84e7fbd1a6107f8b17454b67: reply-loss recovery returns stale base_commit bytes from the caller. The candidate returns the native committed row and performs one mutation.
  • Initial failures were repaired: a node test needed canonical host-broker routing; approval fixtures needed the receipt transport and a valid terminal tuple; placement teardown was signaled before its transport settled; closure evidence now asserts the S1 wrapper and exact underlying closed-admission cause while verifying the committed row.
  • Three independent review rounds; the accepted rollback-classification finding is fixed. The second and final integrated reviews are clean at P0–P2.
  • Changed-file guards, core and all core-test typecheck shards, scripts lint, all 64 changed source files’ lint, SDK export registration, native schema parity, database inventory/ratchet, legacy-store, runtime-sidecar, import-cycle, webhook, and pairing guards pass. The full check records inherited failures in untouched main-base files: deprecated agents.ts config mutation (already fixed upstream by 959197ba0923), Knip’s isTelegramReadOnlyControlLaneText / resolveContextTokens exports, and 13 existing max-lines violations. Failing source blobs match main base 427f926e7c2d; remaining planned checks were executed separately rather than skipped. No T1 call-count growth.
  • SDK source-root comparison: no entrypoints added/removed and no direct export declarations changed. It reports 148 reachable-closure changes from nine internal declaration deltas (private receipt/worker types), digest 5856d58f; SDK export registration check passes. This comparison pins the measured pre-integration head, not a moving main.
  • Node 26.10.0 exercised the owner tests and local operation probes. Bun 1.4.2 with native SQLite 3.53.4 passed all 27 affected-operation semantic phases in 2.8 seconds. No native failure was replayed.

The final head integrates main 427f926e7c2d once to resolve a workspace-test import conflict. Thirty-one integrated workspace/receipt cases pass. Of the 46 changed production files, 44 are byte-identical to measured head 2f3f87f0df07; the remaining two only rename locals without changing SQL, receipts, or control flow. Upstream test cleanup is preserved.

Statement measurements

Measured baseline 31c35d5f5b093b7f84e7fbd1a6107f8b17454b67 against reviewed candidate 2f3f87f0df077cb868863975485574c0daccd349 on one isolated Blacksmith Testbox (Linux, Node 24.19.0, 4 observed CPUs). Wrapper source-capsule verification pinned the candidate tree df808ede8fc47fdeb761a00a4fed2a59e398e956; source hashes cover all 64 changed src paths. This is pre-integration evidence; later integration resolved a test-only overlap and local-variable renames, without changing the measured SQL/receipt logic.

Testbox run, lease tbx_01m4hnq9gerts46syn4y4vkdpv: four alternating baseline/candidate pairs; every run completed 13 turns, child, control RPCs, cron, compaction and shutdown. Exact phase/thread/SQL census conservation passed. All gated median wall ratios are 0.930–1.083; these are instrumented observation windows, not latency claims.

Phase All-thread statements B→C MAIN B→C Requests B→C Envelopes B→C Wall ratio C/B
01.boot 3320.5→3320 1984→1984 67→67 67→67 1.001
01.connect 486.5→439 80→75.5 69→60 75→65 0.981
02.first-turn 1809→1852.5 46.5→58 263.5→274.5 286.5→298.5 1.035
03.warmed-mean 1062.35→1065 9.7→9.1 198.2→198.5 207.2→207.5 1.014
04.second-session 4098→4195.5 123→125.5 690→702 718→730 1.083
05.control-plane 33.5→33.5 0→0 5→5 5→5 0.984
06.cron 1204→1205 44→44 173→173 182→182 0.998
07.compaction 408→405 25→25 85→84 96→95 1.079
08.shutdown 195→195 129→129 14→14 14→14 0.930

The first-turn median rises 1809→1852.5 (+2.40%); warmed statements rise 1062.35→1065 (+0.25%). These are not claimed as per-phase savings. The required additional fourth alternating pair under the campaign RAW TURN INCREASE rule gives complete startup→shutdown statements 22383→22372 (−11) and requests 3375→3370 (−5), qualifying the raw turn increase as redistribution. MAIN increases 2535→2545 (+10) in that pair.

Full workload run Baseline statements / requests Candidate statements / requests
1 22001 / 3344 22028 / 3346
2 22053 / 3338 22706 / 3424
3 22471 / 3374 22514 / 3381
4 22383 / 3375 22372 / 3370
Four-run medians 22218 / 3359 22443 / 3375.5

The complete four-run medians increase; the gate qualification is specifically the prescribed additional fourth-pair check, not a claim that the series aggregate or every phase decreased. Fourth-pair family totals (request-associated SQL includes admission/envelope statements):

Family SQL B→C Requests B→C
database.domain.bind 450→445 81→81
database.domain.execute 769→777 109→108
database.domain.close 53→52 81→80
database.prepareWrite 705→711 18→18
session-corpus-inventory 127→144 13→13
session-tombstones 99→99 11→11
session.maintenance.read 112→113 20→20

Three local alternating affected-operation pairs cover 27 semantic phases (26 emit SQL; phase 16 is a zero-SQL environment-read assertion). Every phase has identical statement counts, 2077 total per run including setup/cleanup. Each run also has 33 SQLite-broker requests, 2 task-worker requests and 1 resource-close. The raw source-run census additionally captured 3836→3871 tsx/esbuild/ESM transformation messages; retained stacks identify every one as loader traffic, so they are excluded from database-request totals. The built shared workload has no corresponding loader traffic in the retained request-group samples. Focused millisecond-scale wall ratios are not a performance gate or latency claim. Bun 1.4.2 with native SQLite 3.53.4 passed all 27 semantic phases.

Remote failed native BEGIN executions remain reported separately (successful executions alone are counted): baseline [1,0,1,1], candidate [1,2,1,2]. All nine failures occur during connect in the unchanged plugin-lifecycle lease-release path (releaseOpenClawStateLeaseBestEffort under runGatewayPostReadyStartupMaintenance); successful BEGIN elapsed-time diagnostics are retained; elapsed BEGIN time is an acquisition upper bound, not isolated lock wait. Earlier seven local shared pairs were duration-invalid and are not gate evidence. Their native lock-failure counts were baseline [0,0,0,0,0,0,1] and candidate [2,1,0,0,0,3,0], from post-ready plugin-lease release except one candidate agent-lease shutdown close.

Both source-mapped qaRuntime builds passed. No evidence archive was created; raw traces/fixture databases were removed after aggregation. The compact evidence download passed SHA-256 verification for 54 files. The owned Testbox was stopped successfully; published-driver × candidate update proof passed on the final head (details below).

Test cost and change size

Focused owner commands used pnpm test <owner-files> --maxWorkers=1. The broad first pass took 613.7 seconds including compilation and imports; the repair/unrun-owner pass took 434.6 seconds. The final shutdown-only proof took 52.2 seconds including worker artifact preparation (1.3 seconds in the test). These are grouped command wall times, not a claim that every file costs that wall time. Final-head CI passed in run 38018138302; the authorization worker shard completed in 358 seconds.

Measured test-body time in the materially changed test files (shared compilation/import time is included only in the grouped wall times above):

Test file Cases Test seconds
src/node-host/node-worker-prepared-workspace-publication.test.ts 1 2.44
src/state/state-domain-publication.test.ts 4 0.24
src/gateway/worker-environments/store-projection.test.ts 17 0.56
src/gateway/worker-environments/placement-turn-claims.worker.test.ts 31 55.26
src/gateway/worker-environments/placement-turn-authority.test.ts 27 89.42
src/gateway/worker-environments/store-worker.test.ts 16 27.62
src/gateway/operator-approval-store.test.ts 17 8.49
src/gateway/worker-environments/placement-workspace-journal.test.ts 9 24.00
src/gateway/worker-environments/transcript-commit-store.test.ts 18 12.93
src/gateway/worker-environments/store-recovery.worker.test.ts 2 7.92
src/gateway/operator-approval-store.worker.test.ts 8 8.43
src/gateway/worker-environments/placement-session-tool-operations.worker.test.ts 5 2.69
src/gateway/worker-environments/local-workspace-store.test.ts 7 4.14
src/gateway/worker-environments/store-revocation-notify.test.ts 2 2.66
src/agents/workspace-state-store.test.ts 43 55.74
src/infra/exec-approvals-store.test.ts 23 16.82
src/state/session-repository-workspaces.test.ts 10 16.39
src/agents/workspace-state-read.worker.test.ts 21 27.64

The longer existing suites exercise real worker admission, native locks, lease/lifecycle closure, and committed-versus-unknown outcomes. New regressions extend those existing fixtures; the new generic receipt suite costs 0.25 seconds and the node prepared-workspace receipt case 2.44 seconds.

Production: +1,810 / −443 lines across 46 files. Tests/support: +672 / −81 across 19 files. Docs/generated inventory: +93 / −58 across two files. The shared staging adapter avoids separate transaction/receipt lifecycles in each family; domain policy and projections remain with their existing owners.

Final landing validation

Head f9f3b04682ad3bde80f4ada516ad4bf911bd5dab passed CI run 38018138302. Conflict-only integration retained main’s publication adapter. The small CI repair added the receipt module to the native wrapper inventory, removed two type-import cycles, and retained admission in the authorization reducer fixture without changing its policy or deletion assertions. Scoped P0/P1 autoreview was clean.

Focused proof: authorization worker 3/3 (27.50 seconds wall, 0.407 seconds test execution); wrapper closure 17/17 (30.69 seconds wall); post-commit publications 9/9 (26.18 seconds wall). The final authorization CI shard took 358 seconds.

Testbox verified the final source head and tree d4c815502da2752ce38a2d7c0031ce3c9d94d5ed. The remote import-cycle check reported zero cycles. Published driver 2026.9.8 upgraded to candidate 2026.9.9; readiness returned 200, the running version matched, and durable and incognito after-state checks passed. The command completed successfully in 708.7 seconds (update phase: 184.0 seconds). The owned Testbox lease was stopped.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 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: f9f3b04682ad3bde80f4ada516ad4bf911bd5dab
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/worker-environments/placement-turn-authority.receipt.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/worker-environments/placement-turn-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/worker-environments/placement-turn-authority.types.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/exec-approvals-authorization.worker.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-mutation.worker.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-publication.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-retirement.worker.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-sqlite.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-store.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR publishes committed approval and workspace state before worker replies arrive and recovers lost replies from the actual committed rows.

Example: A local workspace update commits pending_ref="refs/openclaw/results/accepted", but its worker reply is lost.

  • Before: Recovery can adopt the caller's stale base_commit of forty f characters.
  • After: Recovery preserves the database's base_commit of forty a characters without repeating the mutation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-level repair with meaningful native-worker coverage and the previous finding resolved; authority-boundary and upgrade validation remain incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A committed workspace update can recover stale caller state when its worker reply is lost.
Reason: Exact native commit facts address an evidenced reliability defect through existing storage owners, and the feature-history owner authored the direction.

Merge readiness

⛔ Blocked before merge - 4 items remain

This PR addresses a concrete state-recovery defect still present on current main; the earlier wrapper-inventory finding is fixed, and no additional discrete code defect was identified.

Priority: P2
Reviewed head: f9f3b04682ad3bde80f4ada516ad4bf911bd5dab

Before merge

  • Add real behavior proof - Authority-chain proof required: supplied native-worker cases cover committed postimages, rollback, supersession, and lost replies, but do not show current-worker success and revoked or reassigned-worker rejection before dispatch or transfer I/O after early publication; provide redacted terminal output or logs, excluding credentials, IPs, phone numbers, and non-public endpoints. The complete body also leaves published-driver × candidate upgrade acceptance pending. 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.
  • Resolve security concern: Validate authority consumers during unsettled transport - Environment credential facts become available from native commit evidence before reply settlement; supplied evidence does not establish that revoked or reassigned worker identities are rejected before dispatch or workspace-transfer I/O under this ordering.
  • Resolve merge risk - Before merge, verify that making committed environment and placement authority available during unsettled worker transport cannot authorize a revoked or reassigned worker's final I/O.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [medium] Validate authority consumers during unsettled transport — src/gateway/worker-environments/store.ts:245

Tests

  • Missing end-to-end proof: Supply a production-path trace covering early publication with allowed and revoked or reassigned workers, plus the pending published-driver upgrade run.
Agent review details

How this fits together

Gateway storage owners send mutations to SQLite workers and receive commit receipts that update local projections consumed by approval, dispatch, and workspace operations.

flowchart LR
  A[Gateway storage owners] --> B[SQLite worker admission]
  B --> C[Native transaction]
  C --> D[Commit receipt]
  D --> E[Owner projections]
  E --> F[Authority checks and observers]
Loading

Technical review

Best possible solution:

Retain native committed postimages and existing final authority guards, with the authority-boundary and upgrade checks completed before landing.

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

Current main reconstructs lost-reply recovery state from caller fields, and the changed regression supplies stale fields that differ from the committed row; this review ran no target code.

Is this the best way to solve the issue?

Capturing exact postimages at the existing mutation owner fixes the stale-state producer while preserving the no-replay contract and existing authority guards.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Hold for authority-boundary validation (recommended)
    Keep this PR open until the production path demonstrates allowed-worker success and revoked or reassigned-worker rejection before dispatch or transfer I/O.

Provenance checked

  • Local workspace lost-reply recovery changes intended behavior with a stated reason (cd326f9: Move projection persistence into workers while retaining custody, acknowledged recovery, and settlement without mutation replay.)
  • Environment projection publication keeps the original intent (c768bd1: One committed projection serves environment reads while transaction-local checks retain authority.)
  • Approval authority across storage waits keeps the original intent (d9c0dd6: Preserve request authority, settlement, original deadlines, and provenance across awaited storage and lost replies.)
  • Exec policy worker mutations keeps the original intent (9324ed6: Move policy writes to the shared writer while preserving current revocation checks and synchronous SDK contracts.)
  • Workspace state worker operations keeps the original intent (6c1e166: Move workspace SQL off the Gateway thread without weakening recovery holds, alias safety, or filesystem guards.)
  • Shared postcommit receipt contract keeps the original intent (da67a08: Install committed facts before observers and preserve commit evidence independently of ordinary result delivery.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete authorization bypass was found, but the changed publication timing still needs final-effect authority validation.

Evidence

Security concerns:

  • [medium] Validate authority consumers during unsettled transport — src/gateway/worker-environments/store.ts:245
    Environment credential facts become available from native commit evidence before reply settlement; supplied evidence does not establish that revoked or reassigned worker identities are rejected before dispatch or workspace-transfer I/O under this ordering.
    Confidence: 0.9

What I checked:

  • Current main retains the reported recovery defect: The lost-reply branch installs a postimage constructed from caller input rather than the native committed row. (src/gateway/worker-environments/local-workspace-store.ts:185, 430f975aacee)
  • Focused regression covers stale caller fields: The changed lost-reply case supplies a stale base_commit, checks the native committed value, and retains the assertion that only one mutation ran; tests were inspected, not executed during this review. (src/gateway/worker-environments/local-workspace-store.test.ts:205, f9f3b04682ad)
  • Earlier finding resolved: The exact head adds the placement receipt module to the trusted wrapper inventory. (scripts/pr-lib/wrapper-components.txt:749, f9f3b04682ad)
  • Authority publication timing changes: Native commit observation now installs environment and credential facts and releases their projection fence before ordinary reply settlement; worker RPC authorization consumes those projections. (src/gateway/worker-environments/store.ts:245, f9f3b04682ad)
  • Complete proof context inspected: The full body reports native-worker fault cases and a shared Gateway workload, but explicitly leaves published-driver acceptance pending and supplies no final-effect trace for revoked or reassigned workers after early publication. (f9f3b04682ad)
  • Exact-head checks and mergeability: Both check-run pages contain no failed or pending checks; the live PR read reports mergeable=true and mergeable_state=clean. (f9f3b04682ad)

Likely related people:

  • Peter Steinberger: Raw commit c768bd1 adds src/gateway/worker-environments/store.ts:138 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c768bd125a14; files: src/gateway/worker-environments/store.ts)

PR surface

Source +1378, Tests +601, Docs +36, Other +1. Total +2016 across 69 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 46 1813 435 +1378
Tests 20 688 87 +601
Docs 2 89 53 +36
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 69 2591 575 +2016

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 security-boundary.

Label justifications:

  • P2: This fixes a bounded but meaningful lost-reply state-recovery defect without evidence of an ongoing widespread outage.
  • merge-risk: 🚨 security-boundary: The diff advances publication of credential and placement authority before transport settlement, requiring validation at the final execution and transfer boundaries.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Add final-effect proof that current workers succeed and revoked or reassigned workers cannot perform dispatch or transfer I/O after early publication.
  • Complete the published-driver × candidate update cell with existing settings and workspace data intact.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T02:22:52.225Z sha 9c7a3b1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T02:39:28.891Z sha c1a9794 :: needs real behavior proof before merge. :: [P2] Include the receipt module in the trusted wrapper inventory

Reviewed October 9, 2026, 11:01 PM ET / October 10, 2026, 03:01 UTC (Revision 3).

Resolve publication-helper overlap by retaining batch installation and main's shared state adapter. Regenerate the database worker inventory. Validation: SQLite post-commit owner tests pass.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 10, 2026
Include the placement receipt module in the native wrapper closure, resolve publication row types from the generated database contract, and retain admission in the authorization reducer fixture. Policy and deletion assertions are unchanged.

Validation: authorization worker 3/3 (27.50s wall), wrapper closure 17/17 (30.69s wall), scoped P0/P1 autoreview clean. Remote architecture and published-driver update proof follow on this head.
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 10, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Oct 10, 2026
@steipete
steipete merged commit 7303989 into main Oct 10, 2026
158 checks passed
@steipete
steipete deleted the dbasync/sw4a branch October 10, 2026 03:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…penclaw#168094)

* fix(sqlite): publish approval and workspace commit facts

* fix: close approval receipt cutover validation gaps

Include the placement receipt module in the native wrapper closure, resolve publication row types from the generated database contract, and retain admission in the authorization reducer fixture. Policy and deletion assertions are unchanged.

Validation: authorization worker 3/3 (27.50s wall), wrapper closure 17/17 (30.69s wall), scoped P0/P1 autoreview clean. Remote architecture and published-driver update proof follow on this head.
steipete added a commit that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (#162177/#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (#39857).
- Registration-time question answers (#110372/#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (#146732/#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: #162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (openclaw#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (openclaw#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (openclaw#39857).
- Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (openclaw#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
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: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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