Skip to content

refactor: simplify state and process worker lifecycles - #169648

Merged
steipete merged 3 commits into
mainfrom
deslop/w09-state-infra-process-p2-20261011
Oct 12, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/w09-state-infra-process-p2-20261011

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Reduces duplicated private worker infrastructure and speculative lifecycle machinery in state, infra, and process execution.

User Impact

Normal storage, command execution, and streaming behavior stays intact. No config, CLI, Gateway protocol, plugin SDK, schema, durability, retention, or permission change is intended. Already-running wake callbacks finish under their captured handler; unstarted work selects the current handler.

Why This Change Was Made

GitHub authority receipts now share the existing state-domain publication owner rather than maintaining parallel transaction capture, rollback, supersession, and settlement code. GitHub-specific row/key restrictions, presentation-field scrubbing, byte limits, and live publication authority remain at the adapter. The state worker's operation types derive from its actual lazy-loader table instead of a second manually maintained inventory. Execa's own result types replace a parallel conditional-type implementation.

Private error/admission/bootstrap schema mirrors, impossible return-path reordering, historical receipt replay, and handler-replacement generations are removed. Process control framing and stdout use existing owners. Native child cleanup, current execution authority, original input FIFO/reordering, output limits, and write-capable work settlement remain.

Net production reduction after conflict-only rebase and CI correction: 1,029 LOC (+464 / -1,493), excluding tests, fixtures, test support, generated files, and declarations. This is PR 2 of the w09 campaign; the first cleanup is already on main. Ancillary edits outside the three lane directories remove three private declarations orphaned by this cutover and narrow one directly coupled error-payload type annotation. The coordinator explicitly authorized these deletion-only follow-through edits; tests outside the lane prove retained consumers.

Best-effort tradeoffs accepted

  • Malformed private error frames and impossible graph references no longer receive a second field/reachability validation pass. #146172 introduced the typed worker graph with synthetic qualification, not a human malformed-frame report. A broken bundled peer now fails at consumption or keeps the ordinary carrier error; producer scrubbing and actual error identities/causes remain.
  • Malformed private admission maps, schema catalogs, or atomic-buffer shapes no longer receive duplicate transport schemas. #167739 introduced typed admission sharing for performance, not malformed-peer handling. Consumers still check physical/agent identity, atomic validity, revocation, and schema authority; a broken internal producer fails where used.
  • Replacing a live wake handler no longer aborts and replays an already-running callback. #138451 added that synthetic replacement lifecycle. The admitted callback finishes once; queued/unstarted work uses the new handler. Explicit shutdown still aborts and joins actual work.
  • Listener additions or run-ID mutation inside an event callback no longer rebuild the current event's listener cohort. #129174 measured the retained per-run index; its extra re-selection cases were synthetic. New subscriptions begin on the next event; original ordering, unsubscribe behavior, indexing, and live delivery authority remain.
  • A future non-FIFO return producer no longer gets a second reorder queue, and duplicate owner input no longer solicits historical rejection replay. #160946 added this synthetic recovery machinery; both current return transports publish every message FIFO and do not reconnect. Original receipts or an explicit transport failure settle callers. The genuinely needed input reorder queue remains.
  • A future reservation callback that publishes concurrently or returns before awaiting publication is no longer covered by an extra handoff protocol. #150564 introduced the broker; its sole typed caller awaits publications sequentially. Queue bounds and final launch authority remain.
  • Malformed bundled broker or Windows-anchor bootstrap messages no longer get private schema mirrors. #150564 and #127652 added the private routes, with no human malformed-bootstrap incident identified. Socket authentication, sequence/generation checks, launch authority, and Windows Job membership remain.
  • A numeric exit code assigned after a Windows child has already closed is no longer polled for 250ms. The originating cfba0ab68f7 case uses a synthetic delayed field assignment; #106495 carried the helper forward. Normal emitted exit codes stay exact; ambiguous shims retain their existing fallback result.
  • Unexpected option keys and impossible string-stdio values from an internal caller no longer receive a second whitelist. The sole producer now has the actual CommandSpawnOptions type and already normalizes invocation/environment and forces shell:false. Native descriptors, streams, inherited output, and unsupported shells retain their explicit handling; invalid internal options fail in the operation/serializer.

The relay's nonce-matched retirement response is replaced by natural exit after the same anchor reaping and parent-lineage release. This is consolidation, not permission to lose cleanup: force delivery failures remain recorded until actual extinction or the hard deadline, and a late exit cannot turn failed cleanup into success.

Evidence

All tests/builds use task-owned HOME, OpenClaw state/config, and XDG directories. No live Gateway or real operator state is used. Local proof uses node scripts/run-vitest.mjs ... --maxWorkers=1 through that isolated environment.

  • Initial focused owner tests: 81 passed across four configurations (365.10s wrapper wall).
  • Expanded owner/transport tests cover native worker lifetime, wake settlement, publication receipts, admission, event routing, execution parity, and process cleanup. The corrected process/MCP batch passed all 90 tests (292.08s wrapper wall), including six real fault-injected MCP cleanup cases. Existing process suites also passed 246 cases in the earlier expanded run; its four regressions were repaired and re-proved, not suppressed.
  • Schema-inspection and read-only lifecycle: 14 passed. Original-order state ownership: all 28 passed (82.45s suite / 143.81s wrapper). The initial expanded run timed out in the unchanged broad Doctor preflight at 120s; the still-running preflight then caused 15 cleanup failures. An isolated reproduction passed at approximately 105s test time, and the full original-order rerun passed without leaks. This remains an investigated intermittent timing failure, not a claimed fix.
  • Final child lifecycle/events/secret-input and lint-suppression proof passed (141.15s wrapper). The lint test includes the exact already-landed repair from 81a4679dec8b7fc0fb137df0a5b085a93d4977c7 for an unchanged JSON control-character regex; this PR adds no production lint suppression.
  • Production types and 26 core test type graphs passed. check-changed stopped on four inherited UI type errors, precisely the errors fixed by #169439 in 319ec991d02a343014c40b1e623897502ab41d5b. The UI files are untouched. All preceding changed checks passed (format, safety/line-cap/SQLite/mock/timeout ratchets, plugin boundaries, wrapper guard, configuration baseline). Remaining applicable lint/structural checks were run separately; exact-head hosted CI remains the landing gate.
  • Final independent review completed through P2: scoped-clean, no accepted/actionable findings. An earlier stdout-buffer finding was rejected with source evidence: the limit applies only to streamless pushed output, while direct-child stdout supplies a stream, pauses at the high-water mark, and retains native error reporting.
  • Final lint-change owner proof: 101 tests passed (165.89s wrapper). Targeted changed-source and lint-test lint passed. Runtime and Madge cycles are both zero; the remaining database-first, schema-version, media, runtime-sidecar, webhook-body, pairing, deprecated-API, and coercion guards passed.
  • Removed all five private predicates/operation declarations orphaned by the cutover. The repeat dead-export scan no longer reports any of them; remaining findings are in untouched UI/agent modules. No new allowlist or artificial consumer was added. Main added a real consumer of the Goal error-code list during the conflict-only rebase, so that list is retained unchanged.
  • Final orphan-cleanup proof: 72 tests passed across three configurations (147.15s wrapper), with production types and targeted lint passing. Final publication-failure repair proof: 34 tests passed across five configurations (190.23s wrapper). The new synchronous regression failed before the repair and passes after it; its file completes in under 5 seconds of test execution, with wrapper/module setup reported separately.

The real-process lifecycle tests exceed the five-second target because they prove native process-group extinction, inherited pipe closure, and failed signal delivery. They retain existing deadlines, transport parameterization, and assertions; no cheaper mocked layer proves these OS contracts. Exact-head hosted CI remains the cross-platform gate.

The retained tests caught and drove fixes for suspended-handler selection, bounded control-frame search, decoder disposal, and forced-retirement error recording. After the second conflict rebase, the MCP fault fixture is unchanged from main's corrected disconnect-boundary fixture; its six real-process fault cases pass against this cleanup. No timeout, retry, skip, or lint suppression was added to make proof pass.

Review also retained the existing synchronous task-port liveness check: a retire-on-error worker can close its task channel while another native handle keeps it alive, so synchronous task servicing must reject without waiting for a JavaScript close callback. Both native task-port files are unchanged. The shared publication lifecycle retains invalidation when the GitHub-specific publisher throws, now covered by the synchronous regression. Final independent review after both repairs is scoped-clean through P2.

Conflict-only rebase onto acba98bf6231aee87f8ee86444fb74672dd9bcd8: preserved main's new physical database identity fields and simpler local error hydration. The affected error/admission/wake/Goal/session-storage and lint-suppression suites passed across four configurations (749.67s wrapper wall on the loaded local host). Production types plus state/infra test types, targeted lint, runtime cycles, and Madge cycles passed. A missing Goal enum export detected during integration was repaired before pushing. The final restoration also received a clean independent review. No CI rerun or green-chasing push was used.

First exact-head CI and correction

Run 38212881368 tested b7529339d0ceac83359f55aff13c4de63bca35a1 and completed with five failing test jobs plus the downstream CI gate. All five are attributable to this PR; none is claimed inherited. All 224 exact-head check runs were enumerated, with no cancelled or unfinished checks.

  • Job 114691167692 (checks-node-changed-compact-large-8-1): stale replacement/replay expectations plus a real stopped-before-execution wake being consumed as disabled. The scheduler now returns the existing retryable preempted result after stop/abort during lazy loading; global disable remains disabled.
  • Job 114691167708 (checks-node-changed-compact-small-15): the bridge test expected callback mutation of runId to reroute the current event. Removed only that synthetic case under the documented fixed-cohort policy.
  • Job 114691167825 (checks-node-changed-compact-large-8-2): the cleanup fault fixture mocked the retired timers/promises route. It now injects the same rejection at the actual sleep owner; error identity, cleanup settlement and no-unhandled-rejection assertions remain.
  • Job 114691168021 (checks-node-changed-compact-large-21): the heartbeat replacement fixture awaited replay before releasing the original lazy load, creating a circular wait under finish-once semantics. It now releases the original callback and proves fresh work uses the replacement. The health cases passed in the original job.
  • Job 114691168042 (checks-node-changed-compact-small-20-1): obsolete abort/replay expectations left synthetic callbacks unfinished and contaminated later fake-clock cases. Updated those expectations and guaranteed fixture release while retaining the four-slot bound, same-target ordering, explicit abort and actual settlement.
  • Job 114693708607 (openclaw/ci-gate) failed downstream of those five jobs.

The corrected selection passed all five Vitest configurations, including the complete three-file Gateway selection, heartbeat and event siblings, process cleanup, bridge, and lint-suppressions (519.52s wrapper wall). Core production, infra-test and Gateway-test types, targeted lint, runtime cycles (0) and Madge cycles (0) passed. A fresh independent review of the eight-file correction is scoped-clean through P2. No timeout, retry, skip, suppression, dependency or schema change was added. Hosted CI on the new exact head remains the landing gate; the failed run was not rerun.

The restarted local changed-check attempts passed conflict markers, line-cap, suppression/env-count and assertion ratchets, then were intentionally stopped during the repository-wide SQLite worker scan. Selecting the correction base still traverses the whole repository. These incomplete attempts are not claimed passing; the original changed-check evidence above, the first run's successful policy checks, and the correction's focused proof are retained. The final formatter pass changed whitespace only in two tests.

Second conflict-only rebase

GitHub reported the pushed correction head fb9b578b2400532e56159041df82c6194b92e5c9 CONFLICTING. Rebased onto 2b4c2a10bb4, producing e66f82f97fbf51d24a50312b3591983bc62f262f. The one manual conflict keeps main's complete MCP fixture, including 6f990462290's retained-POSIX selection and actual disconnect-boundary fault injection. Main's newer validation-cache logic also remains intact. Range-diff shows no production patch change; net production remains -1,027 LOC. The correction commit replayed unchanged; its P2 review and formatter-only follow-through remain recorded above.

Rebase-focused runtime proof passed 94 tests across three configurations (591.19s wrapper wall): 53 validation-cache cases (239.92s suite), 35 relay/cleanup cases (26.89s), and all six real-process MCP fault cases (79.90s). Core production types, agent-root and state test graphs, targeted lint, formatting and diff checks passed. Runtime and Madge cycles are both zero. Main added a pinned renderer dependency; syncing the unchanged frozen lockfile resolved the local missing-dependency prerequisite without changing manifests or lockfiles.

The mandatory lint-suppression test fails identically on this branch and a clean checkout of main fdbe95f5d1d68c160d8d281560b7ea43894bf00d: unexpected src/gateway/control-ui-public-session-card-render.ts|no-control-regex|1, introduced by #169527. Renderer and allowlist test blobs are identical in both trees and neither is changed by this PR. The clean-main run completed 2 passing/1 failing cases (38.25s suite); its earlier missing UI-workspace dependency link was repaired before that reproduction. No allowlist expansion or suppression was added. Hosted CI on the final exact head remains required; any inherited-failure exception will enumerate and attribute every failed job after completion.

Third conflict-only rebase

GitHub reported e66f82f97fbf51d24a50312b3591983bc62f262f CONFLICTING. Rebased onto 96681719c825ed836326ce7c2726162be3254733, producing 555ccfc1b5e3244773bec2c893111fc3cc51e1bb. Main's encoding change added two fields to the removed duplicate schema decoder. The reviewed typed-receipt path carries the complete schema facts directly, including textEncoding; the owner, admission and payload implementation from main remain intact. The resolved module is byte-identical to the prior reviewed module; range-diff changes only those two additional deleted mirror lines, with the correction commits replayed unchanged. Net production reduction is now 1,029 LOC.

Affected proof: 139 tests passed across validation-cache, worker-admission, schema-facts and transcript-payload files (129 infra cases / 663.97s suite; 10 payload cases / 14.69s suite). The worker-admission case explicitly verifies transferred UTF-8 encoding. Worker precompilation took 404.175s under heavy shared-host load. Core production types, state test types, targeted lint, formatting and diff checks passed; runtime and Madge cycles are both zero. Mandatory lint-suppressions again reports only the same untouched renderer entry (2 passing/1 failing, 122.60s suite). Main's newer renderer/Knip export-accounting fix does not repair that suppression inventory; no baseline was expanded here. No CI rerun or push solely for green was requested.

Final exact-head CI: inherited-main-red exception

CI 38230162973 completed on 555ccfc1b5e3244773bec2c893111fc3cc51e1bb. All 142 check runs were enumerated: 94 success, 44 skipped, 1 neutral, 3 failure, no cancelled/incomplete checks. security-fast and all seven Security High checks passed. Every failing job is attributed individually:

  • 114749919813, changed compact-large-9: two canonical user-admission cases in worker-turn-detached-context.test.ts, exactly matching protected-main job 114736777003.
  • 114749919784, changed compact-large-11: committed transcript preview undefined versus Fresh committed preview in sessions-read-cache.test.ts, exactly matching protected-main job 114736776831.
  • 114754786412, CI gate: downstream aggregate of those two Node test roots, not another product failure.

That independent main run tested 292a9887dbbf0cd1e1439b07a1c6a608abadc690 before this head was pushed. The nine traced test/direct-subject files are byte-identical on that main, current-main snapshot 2500d81145d9754c9e3a0957d7c9c925f1811a4d, and this PR. The CI classifier's unknown result was only a compact-job-name mismatch. No failing test or directly implicated authority, transcript-notification, preview/backfill or launcher owner is changed here. The admission owner issue was reported to the coordinator; retained security and feature tests were not removed or relaxed.

An additional full-selection local main reproduction first encountered a missing newer-main dependency, repaired by a private frozen install, then an unrelated cold-start timeout in github-publication-boundaries.test.ts. After the independent main CI matches and unchanged source were established, the redundant replay was stopped and its owned processes joined. It is incomplete, not passing proof. No timeout, retry, skip or suppression was changed. Landing uses the coordinator-authorized inherited-red exception pinned to the exact head, not a claim of green CI. Phase E standalone session memory and its factory/registry/expiry/federation/tests remain untouched.

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR consolidates private state publication, worker transport, wake scheduling, event dispatch, and child-process lifecycle code under existing owners.

Example: A heartbeat callback for agent main is running when its handler is replaced.

  • Before: Replacement aborts the callback and transfers its wake to the replacement handler.
  • After: The admitted callback finishes once; queued and subsequent work selects the current handler.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-approved consolidation with meaningful production-owner coverage and no established introduced defect; supplied proof is primarily test and harness evidence.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor-proof gate does not apply to this maintainer-authored PR; supplied validation exercises production owners and real child processes, without establishing a separate shipped-entry-point demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Duplicated private lifecycle implementations increase the maintenance cost of reliable storage, background work, and command execution.
Reason: The maintainer has approved the direction through authorship and explicit tradeoff documentation; the patch removes parallel mechanics while retaining concrete authority and cleanup contracts.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it contains useful maintainer-directed consolidation with explicitly accepted lifecycle tradeoffs. No definite introduced defect was established, and the earlier merge conflict is resolved.

Priority: P3
Reviewed head: 555ccfc1b5e3244773bec2c893111fc3cc51e1bb

Before merge

  • Complete next step - Classify the worker-turn-detached-context and sessions-read-cache failures against the pinned base, repairing only failures shown to be caused by this diff.

Findings

None.

Agent review details

How this fits together

Gateway runtime owners submit database operations, queued wakes, and process requests; these subsystems return installed state facts, wake results, command output, and cleanup outcomes.

flowchart TD
  A[Gateway runtime] --> B[State workers]
  A --> C[Wake queue]
  A --> D[Process supervisor]
  B --> E[Shared publication owner]
  C --> F[Admitted callbacks]
  D --> G[Spawn broker and native children]
Loading

Technical review

Best possible solution:

Retain the consolidation and accepted tradeoffs while satisfying the existing landing gates.

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

This is a refactor; inspection established its changed lifecycle contracts, without running target code or claiming a reproduced product defect.

Is this the best way to solve the issue?

Reusing the existing publication, framing, output, and type owners is a reasonable simplification, and the maintainer explicitly records the behavior changes it accepts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the merge-base-to-head changes separately from base movement; the checkout remained clean. (555ccfc1b5e3)
  • Current merge state and accepted direction: GitHub reports the reviewed head as mergeable, with mergeable_state blocked rather than dirty. The complete maintainer-authored body explicitly accepts the removed private validation, handler-replacement replay, listener reselection, and speculative transport machinery. (555ccfc1b5e3)
  • Publication authority remains owner-held: The GitHub adapter retains deletion-specific key restrictions, presentation-field scrubbing, message bounds, and current publication authority; the shared owner retains supersession, invalidation, rollback capture, and settlement. (src/state/github-publication-receipts.ts:130, 555ccfc1b5e3)
  • Retained failure and revocation contracts: The added synchronous publication regression checks invalidation after publisher failure. Existing production-owner tests cover late receipts after closure or supersession and source revocation following committed deletion. (src/state/state-domain-publication.test.ts:162, 555ccfc1b5e3)
  • Ordered transport and native custody: Both return transports use serialized senders; the resource server retains authenticated attachment, original input reordering, and native close ownership after transport loss. The sole reservation caller awaits publications and checks launch authority before spawning. (src/process/spawn-broker/resource-server.ts:165, 555ccfc1b5e3)
  • Current-head CI failures need attribution: The worker-context job fails canonical-user-admission assertions, and the sessions-read-cache job returns undefined instead of Fresh committed preview. Neither failure was causally attributed to this diff or independently reproduced on the base. Full job logs redirect to a proxy-blocked Azure host; annotations remain readable. (555ccfc1b5e3)

Likely related people:

  • Peter Steinberger: Raw commit 7303989 adds src/state/state-domain-publication.ts:51 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 73039895153a; files: src/state/state-domain-publication.ts)
  • Tran Quang: Raw commit 70c44ce adds src/infra/agent-events.ts:111 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 70c44ce84dae; files: src/infra/agent-events.ts)

PR surface

Source -1029, Tests -277. Total -1306 across 59 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 40 464 1493 -1029
Tests 19 258 535 -277
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 59 722 2028 -1306

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal simplification with no established urgent user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

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

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-12T05:53:34.036Z sha 37b279cc53d63b2700a858d7efc1639edef45073 :: needs changes before merge. :: none
  • reviewed 2026-10-12T06:38:30.653Z sha b752933 :: needs changes before merge. :: [P2] Retarget the cleanup fault injection to the shared sleep owner | [P2] Complete the listener-cohort cutover in the bridge tests
  • reviewed 2026-10-12T08:58:51.716Z sha fb9b578b2400532e56159041df82c6194b92e5c9 :: needs changes before merge. :: none
  • reviewed 2026-10-12T09:12:48.112Z sha e66f82f :: needs changes before merge. :: none

Reviewed October 12, 2026, 5:48 AM ET / 09:48 UTC (Revision 5).

@steipete
steipete force-pushed the deslop/w09-state-infra-process-p2-20261011 branch from 37b279c to b752933 Compare October 12, 2026 06:26
@steipete
steipete marked this pull request as ready for review October 12, 2026 06:30
@github-actions

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

These security sensitive changes were made:

  • src/agents/auth-profiles/store.worker-contract.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/store/secret-store-validation-error.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P2 Normal backlog priority with limited blast radius. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 12, 2026
@steipete
steipete force-pushed the deslop/w09-state-infra-process-p2-20261011 branch from fb9b578 to e66f82f Compare October 12, 2026 09:04
@steipete
steipete force-pushed the deslop/w09-state-infra-process-p2-20261011 branch from e66f82f to 555ccfc Compare October 12, 2026 09:28
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI attribution and inherited-red landing

Reviewed/pushed head: 555ccfc1b5e3244773bec2c893111fc3cc51e1bb.
Completed PR CI: 38230162973.
All 142 exact-head check runs were enumerated: 94 success, 44 skipped, 1 neutral, 3 failure; none cancelled or incomplete. All 97 jobs in the CI run are terminal. security-fast and all seven Security High checks passed.

Every failed check is individually attributed:

  • 114749919813 / checks-node-changed-compact-large-9: worker-turn-detached-context.test.ts, canonical user admission after-snapshot and model-resolution. Exact same cases and assertions fail on protected main in 114736777003 / checks-node-compact-large-20: credential calls 2 versus 0, and the removal/assertion error replacing the expected runner error. The admission/validator/launcher implementations and test are unchanged by this PR.
  • 114749919784 / checks-node-changed-compact-large-11: sessions-read-cache.test.ts, refreshes row previews after a committed transcript update, undefined versus Fresh committed preview. The exact same case and assertion fail on protected main in 114736776831 / checks-node-compact-large-14. The test, transcript publication/subscription, preview/backfill owners and their timing behavior are unchanged by this PR. The changed agent-event bus is separate from transcript events; the changed GitHub publication helper is not the transcript authority owner.
  • 114754786412 / openclaw/ci-gate: downstream aggregate of those two failed Node test jobs. Its classification report says unknown because scheduled main uses different compact job names; comparing the actual failed tests establishes the matches above.

The independent scheduled-main run tested 292a9887dbbf0cd1e1439b07a1c6a608abadc690 before this head was pushed. These nine test/direct-subject files are byte-identical between that main, current-main snapshot 2500d81145d9754c9e3a0957d7c9c925f1811a4d, and this PR:

  • src/gateway/server-methods/sessions-read-cache.test.ts
  • src/gateway/session-row-projection-transcript.ts
  • src/gateway/session-row-projection-backfill.ts
  • src/config/sessions/session-accessor.transcript-turn.ts
  • src/sessions/transcript-events.ts
  • src/gateway/worker-environments/worker-turn-detached-context.test.ts
  • src/config/sessions/session-transcript-read-fence.ts
  • src/config/sessions/session-accessor.sqlite-model-context.ts
  • src/gateway/worker-environments/worker-turn-launcher.ts

No failing test or directly implicated subject is changed by this PR. Source inspection separately identifies existing admission validation and notification/coalescing behavior; retained security and preview tests are not removed or relaxed. The out-of-scope admission owner issue has been reported to the coordinator.

Additional local clean-main replay was attempted in the original 4/6-file selections. Its first setup lacked newer main's quickjs-wasi; a private frozen install repaired that prerequisite without changing source or PR dependencies. The subsequent run hit an unrelated 120-second cold-start timeout in github-publication-boundaries.test.ts, then continued through later passing cases. Once the exact independent main CI matches and unchanged subjects were established, that redundant replay was stopped and its owned processes joined. It is incomplete, not passing proof; no deadline, retry, skip or suppression was changed.

PR-owned proof remains: 139 affected tests passed after the conflict-only rebase; core production/state test types, targeted lint, formatting, runtime cycles 0 and Madge cycles 0. Independent review is scoped-clean through P2. The known local renderer suppression inventory failure also reproduces on clean main and is untouched. No CI rerun or green-chasing push was used.

Net production reduction: 1,029 LOC (+464 / -1,493). No config, protocol, SDK, schema, durability, retention, permission or dependency change. Phase E standalone session memory and its factory/registry/expiry/federation/tests are untouched.

Landing under the coordinator-authorized inherited-main-red exception, pinned to the exact reviewed head above. This does not describe the failed CI as green.

@steipete
steipete merged commit 1248e1e into main Oct 12, 2026
150 of 154 checks passed
@steipete
steipete deleted the deslop/w09-state-infra-process-p2-20261011 branch October 12, 2026 10:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
* refactor: consolidate state and process worker infrastructure

* fix: preserve goal error decoding after main integration

* fix(infra): preserve unstarted wakes and align lifecycle coverage
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
First-parent upstream e099f44..285369b (88 commits). Stops before
openclaw#169648 (fp#649) and openclaw#169414 (fp#650), which each add conflicts and are
steps 64 and 65.

Conflicts:
- session-entry-patch-source.ts: upstream removed the native-source commit
  guard arm (every main-thread patch now goes through the worker); kept our
  afterPersistInTransaction arm on the native writer (its closure cannot
  cross into the worker).
- subagent-spawn-request.ts: import union (our recipient-authority binding,
  upstream's SessionEntry type).
- openclaw-agent-participants-migration.test.ts: upstream removed the
  "missing aggregate count" case and the "absent" scenario; removed the
  case from our copy, kept our fresh-install schema-27 shape case.
- status-text.ts: upstream's async fallback-model read beside our
  continuation status line import.
- SDK budgets, config baseline and worker inventory regenerated.

Auto-merged files carrying continuation overlay (40) keep it byte-for-byte.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
…absorb: step 64

openclaw#169648 "simplify state and process worker lifecycles",
isolated as its own step. The session-event wake queue drops handler
generations: replacing the handler no longer aborts admitted work (it
owns its settlement); a stopped runner hands an unstarted wake to its
successor as "preempted" instead of "disabled".

Conflicts:
- session-event-wake.ts: took upstream's handler-snapshot dispatch and
  kept our trusted-continuation routing mark on the request before it;
  ActiveWake's `generation` removal ported into our split
  session-event-wake.types.ts.
- heartbeat-runner-scheduler.ts: upstream's preempted/disabled split, with
  our runHeartbeatOnceCore default (the fork's continuation-aware wrapper
  supplies runOnce).

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant