Skip to content

refactor(workers): simplify environment lifecycle bookkeeping - #168747

Merged
steipete merged 9 commits into
mainfrom
deslop/p04-worker-envs-20261010
Oct 11, 2026
Merged

steipete merged 9 commits into
mainfrom
deslop/p04-worker-envs-20261010

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Simplify worker-environment bookkeeping without removing worker features,
credential/approval checks, workspace durability, or ordinary shutdown settlement.
This is the p04 pragmatic-simplification lane, re-evaluated under the maintainer's
explicit best-effort policy for synthetic timing and mid-operation config changes.

The core change is ownership simplification: one check at an actual effect,
idempotent operations, and existing write settlement instead of repeated snapshot
comparisons, recovery loans, compensating cleanup chains, and reentrant guards.

User Impact

Normal worker setup, inference, workspace recovery, credentials and shutdown stay
supported. Rare mid-operation config/reload or artificial interleaving cases may
now return an error or need a later request/restart instead of being coordinated
through additional state machines. The accepted cases are listed below.

Why This Change Was Made

The removed machinery was justified by synthetic regressions rather than human
actual-use incidents. Retain the minimal effect and settlement boundaries instead
of paying their complexity cost on every normal operation.

What changed

  • Placement setup/recovery drops loan queues, permanent supersession history,
    self-validated receipts, and retry-until-stable reads. Per-session FIFO, final
    node/run/tool authorization and workspace-result ownership remain.
  • Provider preparation takes one config/target snapshot. Mid-operation expiry,
    policy and cosmetic metadata changes no longer trigger extra cancellation and
    teardown. Paid allocation IDs, timeout settlement and normal expiry cleanup remain.
  • Store projections drop reconciliation retry registries, revision tombstones,
    repeated read-time shape checks and reentrant cache fences. A failed readback
    closes the projection; a new store or Gateway restart reloads durable SQLite.
  • Worker writes use the final live admission check without a redundant initial
    handshake. The narrow shared lease-owner adjustment preserves first-write
    preparation, live member/expiry checks, pre-commit authority and settlement.
  • Synthetic-only tests are removed with their machinery. Ordinary expiry cases
    are moved unchanged to preserve the heartbeat PR's test inventory.

Best-effort tradeoffs accepted

No PR or synthetic reproduction is being presented as evidence of a human incident.
Retained protections are justified by the explicit security, data-durability,
ordinary shutdown, public-contract, resource-bound, or measured-cache rules.
The warm placement read cache retains the measured 11.8 SQL-statement / 3.9 worker
request saving reported in #167194; its reentrant invalidation fence is removed.

Original KEEP ledger re-evaluation

Six of nine original KEEP rows are now partial removals; the previously deferred
profile-drift row is also implemented.

Original row Decision under the sharpened bar
Artifact shared producer KEEP one shared builder and join it at shutdown before deleting files: ordinary write-capable shutdown settlement. Borrower retirement pins were already removed.
Artifact builder revalidation PARTIAL REMOVE duplicate build/package/umask/source-byte rechecks; KEEP initial build/import/path/archive checks for public bootstrap and file/transfer integrity.
Provider owner lifecycle PARTIAL REMOVE full-row comparison and repeated internal checks; KEEP exact credential/destroy effect checks and paid allocation settlement.
Runtime refresh PARTIAL REMOVE duplicate guards and map-identity fences; KEEP user workspace handoff, worker stop, install and credential effect owners.
Node retention PARTIAL REMOVE repeated transport/status fences; KEEP one destructive pruning guard, pending manifests and bounded requests for user-data durability.
Workspace operation queue KEEP real per-workspace write ordering and join entered mutation before cancellation returns: data durability and write-capable settlement.
Worker session topology KEEP live source turn, incarnation and authorized session tree at messaging/child effects: security boundary.
Prepared intent owner PARTIAL REMOVE mutation snapshots and runtime metadata checks; KEEP only private-source authority association and setup admission at effect.
Machine metadata PARTIAL REMOVE reload identity, stale completion and old-worker cosmetic comparison; KEEP the public machine-summary projection and normal refresh.

No remaining row relies solely on a PR narrative, harness failure or synthetic
test as a claimed real incident. Additional store/cache, presence and coordinator
mechanisms are listed with their individual tradeoffs above.

Scope and measurement

Aggregate production reduction: 741 lines (+338 / -1079), including the first
p04 commit. Tests: 1663 lines removed net (+554 / -2217), counted separately.
This uses the campaign's 500–999-line honest-pass exception; the whole-scope
KEEP re-evaluation above is the coverage log.
No schema, persisted data shape, config, dependency, or public Gateway
protocol change. No new lint suppressions, timeouts, retries or skips.

Heartbeat PR #167796's changed files are excluded. Three shared state-lease owner
files are a required caller cutover and are explicitly called out for p15–p17.

Evidence

  • Final independent review: scoped-clean through P2 after retaining one live
    enrollment-owner check and one combined forced-destroy reservation for durable,
    attached and in-flight owners. No multi-phase handoff restored.
  • Testbox (Blacksmith) tbx_01m4ksbxde2y7qmmjc3d72heyh, workflow
    https://github.com/openclaw/openclaw/actions/runs/38085395330:
    earlier candidate tree 39c606689e2dfd558ebfc9df753fdf818e80b41f verified before
    and after a frozen-lockfile install; 138 focused tests in five files passed,
    then all 11 lease-owner tests passed. The full scope run reached approximately
    3,000 passing cases but was cut off by the 60-minute Testbox workflow limit;
    this is partial proof, not a passing suite. Its eight observed failures led to
    removing stale cache/call-order expectations and retaining the small checks
    described below. The focused runtime-tested tree is
    4b174954fcf63824a4290b1b49e643a2e2190e74;
    the replacement lease timed out unallocated after 15 minutes and was stopped.
    Per the coordinator's capacity fallback, exact-head hosted CI is the remaining
    full Linux gate. Signed head:
    original head 2fc286fbe6cdd2a77ad4b545071f34e1249e0fe8 (the follow-up only removes an unused
    test import and renames a local variable; separately reviewed, linted and
    typechecked; final tree 3f98af3ff44ed7fcd3e8fe12185a89c358edfcef).
  • Both cycle checks passed: 0 runtime value cycles, 0 Madge cycles. Suppression
    suite: all 3 passed, with no baseline changes.
  • Changed-file gate passed formatting, guard/ratchet, plugin boundary and wrapper
    checks, then stopped at the pre-existing UI graph budget (722 roots / limit 720).
    The UI graph and its budget are untouched. Upstream fixed this with a real graph
    split in 471035c7b7c8ea066ed302006ab3780994d27324; no budget bypass or baseline
    weakening is part of this PR. Direct production, Gateway-test and state-test
    type graphs passed. All remaining targeted guards and lint passed. The script
    Knip scan also found the inherited tools/solid-lint/index.mjs: default export;
    upstream ad598152583 models its real config consumer. Production/full-tree
    Knip scans each report zero unused exports. No affected file is named by either
    inherited failure.
  • All 144 cases in the eight revised/affected suites passed sequentially on the
    signed candidate: placement claims, paired devices, recovery admission, human
    presence, node retention, allocation cleanup, pool lifecycle and pool expiry.
  • Conflict-only rebase onto main preserves perf(gateway): reduce placement SQL on local turns #168639's bounded local-turn cache
    and its measured 18-SQL/7-request saving. The single-read replacement follows
    the upstream extraction into placement-read-authority.ts; no cache was discarded. Rebased head
    fe91d4453ff5257109a7b9e6ae3b854be6c98552 passed fresh P2 review, production
    and Gateway test types, all 73 cases in the four cache/authority suites,
    targeted lint, both zero-cycle checks, and all three suppression tests.
    Current heartbeat head 02b567f7446d48a928ab61a1f8ac746d3fa72637 has 1,468
    changed paths and zero overlap with this PR.
  • The new forced-destroy regression failed against the intermediate over-simplified
    implementation and passed after the minimal fix. One-worker command:
    node scripts/run-vitest.mjs src/gateway/worker-environments/placement-dispatch-coordinator-destroy.test.ts --maxWorkers=1:
    four tests pass, 30.09 seconds wrapper / 12.72 seconds suite / 0.77 seconds tests
    on the loaded shared Mac. It protects ordinary dispatch settlement before
    destructive teardown; no sleeps, retries or new timeouts.
  • Kept one environment-ownership check at destructive node pruning. Restored
    persisted reserve expiry at the start of maintenance, without restoring the
    mid-operation retirement state machine. The held-presence regression failed
    before this fix and passed unchanged afterward (12.34 seconds test time on the
    loaded shared Mac; compiled-worker setup is additional).
  • Initial exact-head CI (run 38100418923, head fe91d44) failed two shards:
    checks-node-changed-compact-small-11-2 pinned permanent setup supersession
    from unimplemented/rejected fixture Stop/Move calls; checks-node-changed-compact-large-2
    pinned mid-flight config-disable rejection while Git credentials and live human
    presence remained valid. Four sibling shards were cancelled and are not counted
    as passing proof. No jobs were rerun.
  • Test-only follow-up head e666948a88acaed8ed6e90b5e332a9e0e26c8412 removes those
    obsolete variants while retaining actual cancellation/authority denial and the
    authorized private-Git transport, content and credential-hygiene case. Fresh P2
    review, targeted lint and Gateway test types passed. The two affected files pass
    all 18 cases with node scripts/run-vitest.mjs src/gateway/worker-environments/worker-turn-launcher-initial-setup.test.ts src/gateway/worker-environments/prepared-pool-presence-effects.test.ts --maxWorkers=1
    (1185.46 seconds wrapper / 1158.65 seconds suite on the loaded shared host).
    No runtime, timeout, retry or skip changed in this follow-up. Hosted CI on this
    new head remains the final Linux gate; no reruns or proof-only pushes.
  • Subsequent CI run 38103234265 exposed three caller expectations of removed
    mechanisms and a duplicate provider-destroy defect. The latter is repaired by
    one state check inside the queued destructive effect; the regression keeps
    exactly one provider call and the destroyed durable row. Coordinator-approved
    test-only alignment keeps automatic fallback, stored-session safety, grants
    and shutdown settlement. All 22 device-dispatch tests pass (599.17 seconds
    wrapper / 502.78 seconds Vitest on the loaded host; existing integration suite).
  • Conflict-only rebase round 2 preserves main's lease stage/source simplification
    and node-retention async-context fix. The only manual conflict keeps once-only
    first-write preparation, including commit-first calls, while preserving live
    member/expiry/authority checks and settlement. Fresh full-branch P2 review is
    scoped-clean. Reviewed rebase head: 5bce2ca567b028908596199d8b37947269cbaa63.
  • Post-rebase focused proof: 74 tests passed across maintenance, bootstrap,
    provider teardown, placement projection, and both lease-owner suites
    (node scripts/run-vitest.mjs <six affected files> --maxWorkers=1, 572.64
    seconds wrapper). The existing integration suites exercise real SQLite,
    compiled workers and startup/shutdown; test deadlines were unchanged. All three
    suppression tests pass (20.99 seconds wrapper); Madge reports zero cycles.
  • Current changed-file check passes production types, all 28 selected test graphs,
    formatting, API guards, wrapper ownership and early ratchets. It stops on
    unrelated unused exports in CLI history, approval handlers and UI files; none
    is changed by this PR. Current main c2d584acd704363bee65131fd8ea439e38ac1bbf
    no longer exports any of the reported symbols. This is recorded as a failed
    old-base local gate, not a claim of current-head hosted success. Direct changed
    lint and both cycle checks pass (zero runtime/Madge cycles). Remaining guards
    are being run directly after that fail-fast stop.
  • Exact-head run 38111177634 passed the worker tests and exposed one stale Goal
    retry assertion: a successful simultaneous duplicate can acknowledge
    in_flight, not only started. The test-only follow-up preserves at least one
    started response, validates the duplicate's exact run identity, and retains
    Goal identity, one durable user turn, replay and one model dispatch. All 24 Goal
    cases passed (601.23 seconds wrapper); after moving unchanged assertions into
    the existing test-support file to stay below the line cap, the affected case
    passed again (281.00 seconds wrapper, 23 cases filtered). Fresh P2 review,
    focused types and lint pass. No skip annotation or timeout changes were added.
    Signed follow-up head: 257d9c8711374ac97ce57c8d663cbc39aba7099b.
    All five cancelled type stripes from that run are individually attributed in
    the PR comment; all 28 graphs already passed locally. No CI job was rerun.
  • Run 38113251109 hit the upstream Solid-plugin test-environment regression:
    the database-worker project defaulted to jsdom, breaking native URLs and
    cross-realm byte checks. Main fix 3367a12c6d08 restores an explicit Node
    default while keeping the UI integration's jsdom override. A named-gate rebase
    incorporates that repair. Post-repair proof passes 109 tests across Visitor
    publication, local workspace projection, repository checkpoint recovery and
    worker media. The two existing non-runs are Podman-only and a filesystem that
    refuses invalid UTF-8 filenames; no skips/timeouts were added (2903.27 seconds
    wrapper on the heavily loaded shared Mac). Fresh P2 review, targeted lint,
    Gateway/state type graphs and both zero-cycle checks pass. The production
    graph reports the unrelated run-loop-startup.test-support.ts:380 fixture
    supplying a retired runtime option. The suppression check also identifies
    main's unlisted session-actor-replica.ts suppression; neither file is changed
    by this PR, and no new suppression was added here. All eleven failed jobs are
    individually listed in the attribution comment. New local head:
    421b8e1ca44808f878bf679a87f348a18b9763b3.
  • A subsequent actual conflict was confined to the already-removed artifact
    borrower block and a service test name/deletion. The third conflict repair
    preserves main's new disconnected-worker shutdown test and this lane's removed
    borrower mechanism. Signed head b093938c9b3abc88103e98ca7412d0fcfb0959cf
    passes all 55 bootstrap/service tests (106.79 seconds wrapper), production and
    Gateway test types, targeted lint, all three suppression tests, both zero-cycle
    checks, and fresh P2 review. Main also fixed the earlier unrelated CLI type and
    suppression failures. The 109-case workspace/media proof remains valid.
  • Run 38121563089 finished with one failed Bun shard: a retained-artifact test
    still intercepted cat-file blob after main refactor(workers): unify staged workspace blob reads #168921 moved payload reads to
    cat-file --batch. The test-only fix updates its hooks/counter and requires a
    positive payload read, preserving tamper rejection and live-owner revocation.
    All 12 file cases pass on Node (103.64 seconds wrapper) and local Bun 1.4.2
    (155.00 seconds wrapper); the hosted pinned Linux Bun remains the exact-head
    gate. Fresh P2 review, types, lint and three suppression tests pass. No
    production code, timeout, retry or skip changed. Signed follow-up:
    e8d2821c217ee50e31cfca03cd6554e953b8e408.
  • Coordinator-approved projection conflict repair keeps main's typed closed
    inventory error while retaining the removed read-time shape checks. Current
    signed head 0b077c37c27721532fec3592fff83c841d87ab93 passes all 13 affected
    projection/recovery cases, production/Gateway types, lint, all three suppression
    cases, both zero-cycle checks, and fresh P2 review. Prior unchanged proof is
    retained. No ClawSweeper hold is treated as a campaign landing gate.
  • Main independently fixed the batch-read fixture. The next conflict repair
    preserves its stronger payload-byte corruption test and our positive-read
    assertion. Both Node and Bun pass all 12 repository-file cases; three
    suppression cases, conflicted-graph types and both zero-cycle checks pass.
    The typecheck also caught two stale captured-provider references introduced
    by automatic merging. They now resolve by provider ID, without reload fences.
    All 8 catalog cases and 25 service-lifetime cases pass, with fresh P2 review,
    types, lint and suppression proof. Current signed head:
    d8749b0d6859ab21e4c5c60cb8c3faadeb81476c.
  • Exact-head CI run 38128402802 completed successfully: 81 jobs, no failed CI
    job. The separate cancelled ClawSweeper Dispatch is not a campaign landing
    gate. Squash b690de6fbb4288c425acc8ac4738be4345c82faa is verified on main.

@clawsweeper

clawsweeper Bot commented Oct 11, 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 gateway Gateway runtime size: XL labels Oct 11, 2026
@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: 🧂 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 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR removes redundant worker lifecycle guards and recovery bookkeeping while retaining effect-time authorization and durable settlement.

Example: A placement read for session next-turn overlaps release of its preceding turn claim.

  • Before: The reader waits for publication and transparently refreshes its snapshot.
  • After: The read can report placement authority changed, allowing a later request to retry.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The accepted refactor has no identified discrete defect, but supplied evidence does not establish the required final-commit authorization behavior.
Proof confidence 🧂 unranked krab (1/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: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Worker setup and recovery carry substantial coordination machinery for edge cases the maintainer has chosen to handle best effort.
Reason: The maintainer-authored direction explicitly accepts the affected edge cases, and the patch removes substantial machinery without adding configuration or a competing owner.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this maintainer-directed simplification open: its tradeoffs are explicitly accepted, and source review found no discrete introduced bug.

Priority: P2
Reviewed head: d8749b0d6859ab21e4c5c60cb8c3faadeb81476c

Before merge

  • Add real behavior proof - Authority-chain proof required: exercise localWorkspace.mutate through the production workspace and lease owners, showing an authorized commit and rejection after caller authority is revoked or workspace.local-reconciliation custody expires or is reassigned before COMMIT, with unchanged durable rows after denial. The full body and discussion report integration tests, and the inspected images show historical setup/sync custody and replies rather than this scenario. Provide redacted terminal output or logs excluding 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.
  • Resolve security review attention item - No concrete authorization bypass was found, but the changed commit-admission sequence still requires final-effect evidence.

Findings

None.

Tests

  • Missing end-to-end proof: Missing production-owner proof of an authorized localWorkspace.mutate commit and rejection of revoked caller authority or expired or reassigned reconciliation custody before COMMIT, with durable rows unchanged after denial.
Agent review details

How this fits together

The Gateway coordinates session placement, provider allocation, node enrollment, and workspace recovery, using SQLite workers for durable writes and committed projections for reads.

flowchart TD
  A[Session requests] --> B[Placement coordinator]
  B --> C[Environment lifecycle]
  C --> D[Provider and node effects]
  C --> E[SQLite worker]
  E --> F[Committed projections]
  F --> B
Loading

Technical review

Best possible solution:

Retain the smaller lifecycle owners and accepted best-effort behavior while preserving live authorization, FIFO ordering, and durable settlement.

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

This PR proposes an intentional refactor rather than reporting a new reproducible defect; its retained boundaries were inspected without executing target code.

Is this the best way to solve the issue?

The simplification follows the existing owners and the maintainer's explicit tradeoffs, avoiding replacement state machines or new public options.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete authorization bypass was found, but the changed commit-admission sequence still requires final-effect evidence.

Evidence

What I checked:

  • Maintainer direction and accepted tradeoffs: The fully fetched body explicitly accepts later-request recovery, mid-operation configuration snapshots, and removal of redundant admission machinery; the current security guard identifies steipete as a repository admin. The captured body identity is 4c6f5ea180185a4c4ddc531f40419fda3bb524beb0e5712d839c055686cbd436. (d8749b0d6859)
  • Retained commit boundary: localWorkspace.mutate performs its mutation within rollback protection, then checks reconciliation lease ownership and registry predicates before completing the transaction. (src/gateway/worker-environments/local-workspace-store.worker.ts:37, d8749b0d6859)
  • Live host admission: The retained lease owner checks caller authority, exact lease identities, and expiry on each grant; commit-first writes still run first-write preparation before granting commit admission. (src/state/openclaw-state-lease-worker-owner.ts:125, d8749b0d6859)
  • Current main still differs: Fetched main retains the initial workspace lease and registry checks that this PR removes, so this part of the simplification is not already implemented upstream. (src/gateway/worker-environments/local-workspace-store.worker.ts:34, e7e3b949ae13)
  • Supplied media inspected: All four prepared images show setup or workspace-sync custody followed by replies, including historical evidence associated with fix: worker input waits safely during setup and workspace sync #137576; none shows revoked caller authority or lost reconciliation custody being rejected before COMMIT. (/home/runner/work/clawsweeper/clawsweeper/artifacts/event/codex/proof-scratch/168747/media-proof-manifest.json)
  • Verified no-migration case: The schema change alters when successful initialization is remembered; companion-table DDL, serialized workspace fields, and schema versions remain unchanged. (src/gateway/worker-environments/store-schema.ts:36, d8749b0d6859)

Likely related people:

  • Peter Steinberger: Raw commit cd326f9 adds src/gateway/worker-environments/local-workspace-store.worker.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cd326f915580; files: src/gateway/worker-environments/local-workspace-store.worker.ts)
  • Josh Lehman: Raw commit 0278bf2 adds src/gateway/worker-environments/worker-turn-admission.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 0278bf26e990; files: src/gateway/worker-environments/worker-turn-admission.ts)
  • Galin Iliev: Raw commit db01f6d adds src/gateway/worker-environments/prepared-pool-presence.ts:240 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: db01f6d520b8; files: src/gateway/worker-environments/prepared-pool-presence.ts)

PR surface

Source -741, Tests -1663. Total -2404 across 75 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 34 338 1079 -741
Tests 41 550 2213 -1663
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 75 888 3292 -2404

Review metrics

Metric Value Why it matters
Production versus test LOC Production +338/-1079; tests and test support +550/-2213. The introduced delta substantially reduces lifecycle machinery and retires or relocates its corresponding coverage.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Label justifications:

  • P2: This is a useful internal lifecycle simplification without an established urgent user-facing regression.
  • merge-risk: 🚨 security-boundary: Removing the initial workspace admission changes the authorization sequence before durable writes; the required allowed and revoked-custody commit evidence remains outstanding.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

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

  • Add final-effect proof for revoked caller authority and expired or reassigned reconciliation custody, including unchanged durable rows after rejection.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-11T01:09:26.723Z sha fe91d44 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T02:01:49.489Z sha e666948 :: needs real behavior proof before merge. :: [P2] Update the redispatch fixture for the retained eligibility boundary
  • reviewed 2026-10-11T04:26:20.796Z sha 5bce2ca :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T05:07:28.354Z sha 257d9c8711374ac97ce57c8d663cbc39aba7099b :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T07:07:26.992Z sha 421b8e1ca44808f878bf679a87f348a18b9763b3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T07:40:07.198Z sha b093938 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T08:21:48.759Z sha e8d2821 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T08:56:04.869Z sha 0b077c37c27721532fec3592fff83c841d87ab93 :: needs real behavior proof before merge. :: none

Reviewed October 11, 2026, 5:36 AM ET / 09:36 UTC (Revision 10).

@steipete
steipete force-pushed the deslop/p04-worker-envs-20261010 branch from 2fc286f to fe91d44 Compare October 11, 2026 00:58
@steipete
steipete marked this pull request as ready for review October 11, 2026 01:01
@github-actions

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

These security sensitive changes were made:

  • src/gateway/worker-environments/placement-read-authority.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.

Carefully review these changes before merging.

@steipete

steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

FINAL: Exact-head CI 38128402802
for d8749b0d6859ab21e4c5c60cb8c3faadeb81476c completed successfully: 81 jobs,
no failed CI jobs. Separate ClawSweeper Dispatch 38128512407 was cancelled;
the coordinator explicitly excludes that workflow's holds from this campaign's
landing gates. No job was rerun. PR #168747 merged as
b690de6fbb4288c425acc8ac4738be4345c82faa, verified as an ancestor of fetched main.
The following earlier failures retain their original attribution and are not
being relabeled as successful runs.

Earlier completed run: 38113251109, exact head 257d9c8711374ac97ce57c8d663cbc39aba7099b.

Current candidate d8749b0d6859ab21e4c5c60cb8c3faadeb81476c retains main's
stronger payload-byte tamper hook plus a positive batch-read assertion. Node
and Bun pass all 12 repository-file tests. A local typecheck caught stale
captured-provider references from automatic merging; the two catalog queries
now resolve the provider ID. All 8 catalog and 25 service-lifetime tests pass,
with types, lint, fresh P2 review, all three suppression tests and zero cycles.

Coordinator-approved conflict repair 0b077c37c27721532fec3592fff83c841d87ab93
keeps main's typed inventory-closed error and this lane's removed redundant
read-time shape checks. All 13 projection/recovery tests, production and owning
test types, lint, all three suppression tests, both zero-cycle checks, and fresh
P2 review pass. The prior batch-hook correction and its Node/Bun proof remain.
The coordinator authorizes continued actual-conflict repairs until landing.
No CI rerun was requested; exact-head CI will be watched after publication.

Newer completed run 38121563089,
head b093938c9b3abc88103e98ca7412d0fcfb0959cf, has exactly two failed checks:
checks-node-changed-compact-large-1 (114417422481) and its derived
openclaw/ci-gate (114418570214). Every other job succeeded or was skipped;
there are no cancelled jobs. The Bun leg found that the retained-artifact test
still intercepts cat-file blob, while main #168921 uses cat-file --batch.
Signed follow-up e8d2821c217ee50e31cfca03cd6554e953b8e408 fixes only the test
hooks/counter and adds a positive interception check. All 12 file tests pass on
Node and local Bun; tamper rejection and live-owner revocation are retained.
P2 review, types, lint and all three suppression tests pass. No job was rerun.

Current reviewed head: b093938c9b3abc88103e98ca7412d0fcfb0959cf, after the
actual bootstrap/service conflict repair. The 55 affected tests pass, alongside
production/Gateway types, lint, suppression proof, both cycle checks and fresh
P2 review. Main's Node-environment fix and its later unrelated type/suppression
repairs are incorporated. The 109 passing workspace/media tests remain valid.
No job was rerun; the next exact-head result will be recorded separately.

This run used merge 018786c7e26fb191360d19bb81a355005c265f35 over main
93928afb57a87a361d909cae4a9aa46fbff14608. The main change 74e8844382e
installed the Solid plugin in the database-worker project without an explicit
environment. The plugin defaults such projects to jsdom. This caused native
file-URL failures and cross-realm bytes to fail their native checks. Main's
3367a12c6d08 fixes that configuration; its commit records reproductions from
main CI 38112256403 and 50 passing focused cases after the fix.

Failed job Observed failure families
checks-node-changed-compact-large-6-1 (114393196919) Node transfer failure; transcript-frame decoding; inference native-start observation; queued collector/attachment transfer.
checks-node-changed-compact-large-11-1 (114393196920) Local workspace/recovery errors and result-finalization errors; node skill execution failures. These include lane-owned paths and are being verified after the environment repair, not declared inherited solely from path names.
checks-node-changed-compact-small-18 (114393196986) Media transcript-frame decoding and consequent mismatched expected errors.
checks-node-changed-compact-large-27-1 (114393196999) Spawn transcript-frame decoding, native file-URL failure and attachment transfer.
checks-node-changed-compact-large-16-1 (114393197000) Worker build recovery rejected by transcript-frame decoding.
checks-node-changed-compact-small-1-2 (114393197007) Native worker file-URL errors, follow-on missing fixture database, capacity errors and shutdown timeout.
checks-node-changed-compact-small-1-1 (114393197035) Assistant media policy/claim admission blocked by transcript-frame decoding.
checks-node-changed-compact-large-11-2 (114393197041) Recovery-transcript and pre-launch claim recovery blocked by transcript-frame decoding.
checks-node-changed-compact-large-8 (114393197042) Transcript decoding plus equal-byte typed arrays failing cross-realm equality in repository recovery.
checks-node-changed-compact-large-2 (114393197093) Visitor publication fixture rejected a non-file import URL.
checks-node-changed-compact-large-13-2 (114393197109) Historical schema fixture rejected a non-file import URL; failure recovery then hit transcript-frame decoding.
openclaw/ci-gate (114394521847) Derived aggregate from the eleven failed Node jobs.

All jobs are terminal. No jobs were rerun. A named-failing-gate rebase incorporates
the actual main environment repair. Post-repair focused proof at
421b8e1ca44808f878bf679a87f348a18b9763b3 passes 109 tests across Visitor
publication, local workspace projection, repository recovery and media. Two
unchanged cases do not run on this host (Podman and unsupported filename bytes).
The prior native URL, local-workspace, exact-byte and transcript failures pass.
Fresh P2 review, targeted lint, Gateway/state type graphs and both zero-cycle
checks pass. Local production types still name an untouched CLI fixture's
retired runtime option; suppression proof names main's unlisted actor-replica
suppression from 3bbc221d1c8. Neither is hidden or changed by this lane. An
attempted independent main reproduction stopped in its asset build before
Vitest and is not claimed as baseline proof. The prior Goal ACK fix is retained.

Previous run: 38111177634, exact head 5bce2ca567b028908596199d8b37947269cbaa63.

Job Observed result and attribution
checks-node-changed-compact-large-16-1 (114387100814) One failed case: server.chat-goal.test.ts, simultaneous identical Goal retries. The duplicate returned the supported in_flight acknowledgement but the test assumed every success was started. Fixing the stale caller expectation; not claiming inherited-red admission.
check-test-types-core-1 (114387334386) Cancelled by fail-fast after all 6 graphs emitted successful results; no type errors. All graphs also passed locally.
check-test-types-core-2 (114387334442) Cancelled by fail-fast after 4 of 6 graphs passed; no reported type errors. All 6 graphs passed locally.
check-test-types-core-3 (114387334384) Cancelled by fail-fast after 4 of 6 graphs passed; no reported type errors. All 6 graphs passed locally.
check-test-types-core-4 (114387334488) Cancelled by fail-fast after 4 of 5 graphs passed; no reported type errors. All 5 graphs passed locally.
check-test-types-core-5 (114387334341) Cancelled by fail-fast after all 5 graphs emitted successful results; no type errors. All graphs also passed locally.
openclaw/ci-gate (114388336683) Aggregate failure from the failed test and cancelled type stripes; not an independent defect.

pr-fail-fast (114387100379) records failure-cancelled. Cancelled jobs are not
counted as hosted passes, and none were rerun. CodeQL is neutral, not failed.
Every other terminal check is successful or skipped. All 28 type graphs completed
locally on this exact head before publication. The test correction keeps a
required started response, exact in-flight run identity, durable Goal identity,
one user turn, replay, and exactly one model dispatch. No production change,
retry, timeout increase or skip is involved.

The test-only correction is signed head 257d9c8711374ac97ce57c8d663cbc39aba7099b.
All 24 Goal tests passed before assertion extraction; the extracted version's
affected case passed with all original durability/replay/one-dispatch checks.
Fresh P2 review, focused types/lint and all three suppression tests pass. This
is a code correction, not a rerun or proof-only push. New-head CI will be watched
and attributed separately.

Historical CI attribution for head e666948a88acaed8ed6e90b5e332a9e0e26c8412, run 38103234265:

  • checks-node-changed-compact-small-1 failed sessions.dispatch.device.test.ts: its count-driven disappearance fixture still assumes the removed extra eligibility lookup and pins the old dispatch generation. The automatic-device fallback assertions must remain.
  • checks-node-changed-compact-small-21-1 is cancelled, but its log contains two failed assertions in server-worker-placement-startup-maintenance.test.ts. They require retrying a deliberately interleaved maintenance read; the simplified owner returns the existing inventory-changed error instead. This is not passing coverage.
  • checks-node-changed-compact-large-15-1 is cancelled, but its log contains a failed assertion in provider-destroy-timeout.test.ts. A focused probe revealed an actual duplicate provider call after the row became destroyed. A minimal state check at the destructive effect now passes the regression, retaining rejection, destroyed state and exactly one provider call while accepting the cleanup writer's clear state-conflict error. Lint, production types and independent P2 review pass. This fix is committed locally and not yet pushed; the full-row and intermediate-stage checks remain removed.
  • checks-node-changed-compact-small-11-1 is cancelled, but its log contains a failed assertion in server-worker-environment-startup.bootstrap.test.ts: the preflight signal is no longer aborted by the removed borrower-only controller. Grant and shutdown behavior must remain covered.
  • openclaw/ci-gate is the aggregate failure from these jobs.

These are not being claimed as inherited main failures. No job has been rerun and no proof-only branch update has been made.

Coordinator-authorized follow-up at 5bce2ca567b028908596199d8b37947269cbaa63 addresses all four roots:

  • Device fallback uses the real dispatch-start transition, preserving second-host selection, one provision and the expected durable placement. All 22 file cases passed.
  • Maintenance now expects the one-read inventory error and verifies existing data survives with no partial trigger entry.
  • Provider teardown retains one state check at the queued destructive effect; the full ten-case timeout suite passes, including exactly one provider destruction.
  • Bootstrap drops only the borrower-signal expectation. Registry refresh, fresh download authority and shutdown drain remain and pass.

The three caller files were explicitly approved by the coordinator. Conflict-only rebase round 2 preserves main's state-owner simplification and node-retention fix. All 74 post-rebase cases in six affected suites pass; fresh full-branch P2 review is clean, suppression tests pass, and Madge reports zero cycles. Hosted results on the new exact head will be attributed separately; earlier cancelled jobs are not relabeled as successful.

@steipete
steipete force-pushed the deslop/p04-worker-envs-20261010 branch from e666948 to 5bce2ca Compare October 11, 2026 04:18
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 11, 2026
@steipete
steipete force-pushed the deslop/p04-worker-envs-20261010 branch 3 times, most recently from e8d2821 to 0b077c3 Compare October 11, 2026 08:46
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 11, 2026
@steipete
steipete force-pushed the deslop/p04-worker-envs-20261010 branch from 0b077c3 to d8749b0 Compare October 11, 2026 09:26
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 11, 2026
@steipete
steipete merged commit b690de6 into main Oct 11, 2026
139 of 140 checks passed
@steipete
steipete deleted the deslop/p04-worker-envs-20261010 branch October 11, 2026 09:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…aw#168747)

Simplify worker-environment preparation, placement recovery, store projections,
and bootstrap artifact ownership under the approved best-effort policy.

Remove speculative mid-operation config and plugin revalidation, recovery
admission loans, borrower retirement tracking, redundant read checks, and
same-process receipt machinery. Preserve live security checks at effects,
workspace durability, ordinary shutdown settlement, and measured bounded caches.

Retain one state check at provider destruction to prevent duplicate teardown.
Remove synthetic-only tests with their mechanisms and align caller fixtures
without weakening retained integrity, authorization, or settlement assertions.

Net production reduction: 741 lines. Exact-head CI completed successfully.
steipete added a commit that referenced this pull request Oct 14, 2026
The worker-access reference still said placement read preparation joins an
overlapping publication's settlement and rereads fresh facts. #168747 removed
that loop and accepted the tradeoff that an ordinary placement read racing a
same-session mutation reports authority changed. Describe the current
fail-closed contract and why rereading only the preparation read would not
remove the window.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…law#171205)

The worker-access reference still said placement read preparation joins an
overlapping publication's settlement and rereads fresh facts. openclaw#168747 removed
that loop and accepted the tradeoff that an ordinary placement read racing a
same-session mutation reports authority changed. Describe the current
fail-closed contract and why rereading only the preparation read would not
remove the window.
steipete added a commit that referenced this pull request Oct 18, 2026
The worker test checked its tarball after starting provider.close(),
although b690de6 (#168747) deliberately removed enrollment-held
artifact leases. That read races the provider's own temporary-root removal.

Check readability before close, then await close and require ENOENT without
first aborting the completed preparation's signal. Keep archive hashes,
shared preparation, canceled-peer and off-caller-thread checks intact.
Node installation and update behavior is unchanged: provider close still
owns archive retirement under the accepted plugin-reload policy.

Forced close-before-access reproduced the original ENOENT in 967 ms.
With the frozen install restored, the four affected owner files pass all
69 tests under pinned Bun with --maxWorkers=1 (175.27 s wrapper wall;
127.05 s Vitest; affected worker case 508 ms). Gateway-other test types,
typed and boundary lint, format, and P2 autoreview pass.

The original 71-file Bun shard replay passed this case but hit a separate
workspace-upload worker OOM before local dependency drift was corrected;
it is retained as diagnostic evidence, not a full green shard claim.
The remaining 15 gateway-client shard files pass all 135 tests on the
corrected install (112.60 s wrapper wall). No CI reruns were requested.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 18, 2026
First-parent upstream facdd3c..fd0fc62 (7 commits: openclaw#168789
subagent and runner bookkeeping, e65bd3b cold actor append retry,
openclaw#168747 worker environment lifecycle, openclaw#169037, 7fb80f6, openclaw#168949,
fd0fc62).

openclaw#168789 removes retrySubagentCleanup: accepted-run termination is now a
single attempt that resolves when the stop is confirmed (or the session
provably belongs to a successor) and rejects when it is not. Conflicts:

- subagent-spawn-cleanup.ts: took upstream's single-attempt form. Kept
  our hasFrozenSessionIdentity arms on both deletion paths: the
  abort-miss fallback rejects instead of deleting by key alone, and the
  waited provisional delete is skipped without a frozen identity. Dropped
  our retry option and isSettledAbortResponse (upstream's
  isDefinitiveAbortMiss already covers it in preserve mode); the
  continuation guard call-site contract still pins the identity guard.
- Our boolean consumers adapted to the rejecting contract, keeping their
  pre-merge outcomes: the accepted-spawn sweep and spawn rollback map a
  rejection to "not terminated"; the collector's launch-failure path keeps
  rollback custody for the sweeper and settles once (pinned by
  subagent-registry.rollback-custody-restart.test.ts); its
  registration-changed path releases the acceptance hold in a finally.
- subagent-spawn.test.ts: upstream's new "holds an unconfirmed collector
  slot for shutdown" expects no settlement; ported to the fork's custody
  contract (one abort, no second dispatch, settled once).
- subagent-spawn-cleanup.test.ts: our cases ported to the new contract,
  plus two pins for the identity arms (RED with the arms removed).
- subagent-registry-restore.ts: kept our armed-row skip next to
  upstream's restart-recovery/kill skip.
- subagent-registry.test.ts: our extracted restore test kept; upstream's
  "reconcile on the next explicit restore" change ported into
  subagent-registry.restore-retry.test-support.ts.
- worker-access inventory regenerated.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
The worker test checked its tarball after starting provider.close(),
although 2736e3c (openclaw#168747) deliberately removed enrollment-held
artifact leases. That read races the provider's own temporary-root removal.

Check readability before close, then await close and require ENOENT without
first aborting the completed preparation's signal. Keep archive hashes,
shared preparation, canceled-peer and off-caller-thread checks intact.
Node installation and update behavior is unchanged: provider close still
owns archive retirement under the accepted plugin-reload policy.

Forced close-before-access reproduced the original ENOENT in 967 ms.
With the frozen install restored, the four affected owner files pass all
69 tests under pinned Bun with --maxWorkers=1 (175.27 s wrapper wall;
127.05 s Vitest; affected worker case 508 ms). Gateway-other test types,
typed and boundary lint, format, and P2 autoreview pass.

The original 71-file Bun shard replay passed this case but hit a separate
workspace-upload worker OOM before local dependency drift was corrected;
it is retained as diagnostic evidence, not a full green shard claim.
The remaining 15 gateway-client shard files pass all 135 tests on the
corrected install (112.60 s wrapper wall). No CI reruns were requested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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