Skip to content

refactor: await initial requester yield and cohort handoff - #160778

Merged
steipete merged 3 commits into
mainfrom
codex/requester-initial-transfer
Sep 29, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/requester-initial-transfer

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Durable initial requester yield, spawned-child handoff, and cold registry restoration still perform SQLite work on the Gateway thread.

User Impact

These flows await the existing database worker while retaining the original caller and session authority. An unfinished handoff cannot report success or repeat a committed write. Existing stores need no migration or operator action; configuration, defaults, schema, retention, and public APIs are unchanged.

Why This Change Was Made

The initial handoff uses the existing registry writer and pending publication episode. Cohort preparation retains the requester-turn marker through host promotion, then releases it in a second acknowledged write before scheduling the wake. This extra write preserves recovery across interruption without treating a durable marker as permission to act. Cold restoration reads fresh complete rows through the existing state worker; session authority is captured before restoration and retained through completion or cleanup.

This composes with merged #160203 and #160472, including unreadable-acknowledgement recovery and surviving-sibling retry handoff. It also preserves #160858’s maintenance projection and descendant-snapshot contracts in the same state read/cache owner; full restoration rejects compact maintenance replies. Process-held incognito authority acquisition remains with its existing native owner pending the separate namespace migration.

Evidence

Canonical receiving proof on Node 24.19.0/Linux passes 21 registered initial-transfer/restart cases, 318 registry/lifecycle cases, 60 receipt/retry cases, 23 persistence-resume cases, and 77 authority/caller cases. Controls cover replaced sources and runtime owners, uncertain acknowledgements, opposite settlement claims, prepared-cohort restart, child completion during promotion, and concurrent authority preparation. The newly canonical unreadable-receipt test failed before its missing restore join was added, then passed with the original assertions and cleanup.

An isolated WebSocket Gateway proof publicly creates an explicit non-main requester and linked child, verifies the child's returned key/session ID/parent, invokes the real registered initial-yield and cohort writers, checks durable intent before the yield callback and acknowledged marker release, then reads the original requester identity through public sessions.describe. This proof-only capsule passed again on the combined source in 50.166 seconds after a fresh 385.888-second build; it does not claim an OS-process restart or external provider delivery.

The durable initial-flow windows assert zero calls across all eight observed host SQLite APIs; the retained predecessor window made 26 calls. Setup, later wake work, and cleanup are excluded. This is not a whole-Gateway or wall-time performance claim. The latest separate one-worker file invocations took 51.872 seconds for eight send/yield cases and 51.190 seconds for thirteen custody cases, including transforms and worker preparation. Real workers protect acknowledgement, physical-source and recovery boundaries that the separate mocked policy fixtures cannot prove; no timeout or retry budget increased.

CI run 36543522334 exposed a type-import cycle and cancelled the remaining coverage. The correction places the existing followup authority signature in its type leaf, preserving the runtime factory unchanged. Original Madge RED, corrected full architecture check, owning types/lint and fresh P2 review pass; type-erased JavaScript is identical, so the completed build/public/runtime evidence remains applicable. Cancelled jobs are not counted as passing CI or per-file CI timing. The next run, 36549290827, failed the CI planner’s two Gateway-recipient timing cases; its failure and cancelled coverage are retained separately. The timing owner independently reproduced that defect and canonical 0c8e56c fixes it. This PR does not duplicate that repair; the next exact-head CI is accounted for below.

Core and affected test types, typed lint for all affected source files, full script lint, formatting and selected repository guards pass. The fresh build and eight selected built-runtime receipt/recovery cases pass; seventeen unrelated E2E cases were intentionally unselected. The advisory temp-directory report covers the actual staged scope with no findings.

The material #160858 integration was reviewed and requalified on exact 26dffe7 plus this PR: all 24 selected phases passed with unchanged source, including the 21 initial-flow cases, 85 shared read/cache/maintenance/descendant cases, affected types/lint, both cycle checks, fresh build and public handoff. Earlier unchanged caller/receipt/recovery evidence remains applicable. Fresh independent review found no actionable P0–P2 issue.

Current-head CI 36557432686 completed with 58 successful, 79 cancelled, 19 skipped and two failed jobs (one root plus the aggregate). The root has four session-cleanup fixture failures, independently reproduced on an unchanged main baseline in the exact 24-file/two-worker group. Source comparison binds that baseline to the tested merge. The fixtures use a host-only temporary trigger, mutate canonical rows with raw SQL, and terminate shared workers before their lifecycle owner; their separate repair remains with its owner. Failed and cancelled coverage stays nonpassing. Landing uses the explicitly authorized native pre-existing-failure route with current security, review, source and admin-authority checks.

@clawsweeper

clawsweeper Bot commented Sep 28, 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 Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 29, 2026, 6:56 AM ET / 10:56 UTC (Revision 5).

ClawSweeper review

What this changes

Moves initial requester yield, child handoff, and cold subagent restoration to awaited SQLite workers while preserving requester identity and recovery.

Merge readiness

⛔ Blocked before merge - 3 items remain

Current main still performs synchronous SQLite work during initial requester yield and registry restoration. This PR addresses that distinct path, and the reviewed changes show no verified blocking code defect.

Priority: P2
Reviewed head: 36f8febace0cc255227179f7f1392eb9124a790a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has strong boundary and recovery coverage, with one material resource measurement still missing.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR reports an after-change WebSocket Gateway run that creates a non-main requester and child, exercises registered yield and cohort writers, observes durable intent and marker release, and reads the original requester through sessions.describe. Inspected registered tests inject worker failures and recover unprepared and prepared rows; the row codec and schema are unchanged, supporting existing-state compatibility. The reported run does not establish an OS-process restart or resource benchmark.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR reports an after-change WebSocket Gateway run that creates a non-main requester and child, exercises registered yield and cohort writers, observes durable intent and marker release, and reads the original requester through sessions.describe. Inspected registered tests inject worker failures and recover unprepared and prepared rows; the row codec and schema are unchanged, supporting existing-state compatibility. The reported run does not establish an OS-process restart or resource benchmark.
Evidence reviewed 8 items Current main still uses synchronous persistence: The initial-yield path calls persistOrThrow directly, and cohort settlement retains the same synchronous persistence interface.
Current main still restores synchronously: Cold restoration calls loadSubagentRegistryFromSqlite directly; the checked current-main files have no change from the PR base.
Awaited handoff owner: The introduced registry episode checks current authority, publishes the first write, promotes the cohort, then acknowledges marker release before scheduling the wake.
Findings None None.
Security None None.

How this fits together

The subagent registry stores child-run state and wakes the requester when children settle. Gateway turns feed it; persisted rows support recovery, and settled results flow back to the requester.

flowchart LR
A[Requester turn] --> B[Yield or child completion]
B --> C[Subagent registry]
C --> D{Caller and rows current?}
D -->|Yes| E[SQLite worker handoff]
D -->|No| F[Refuse stale work]
E --> G[Recovery and requester wake]
Loading

Before merge

  • Resolve merge risk (P1) - The new full-registry worker read and second acknowledged cohort write have no before/after seconds and RSS measurement on a populated registry; the reported zero Gateway-thread SQL calls do not establish their memory or handoff-time cost.
  • Complete next step (P2) - Record before/after seconds and peak RSS for initial yield and cold restoration with a representative populated registry.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production and test LOC production +1326/-414 (net +912); tests +2396/-683 (net +1713) The added production code implements the awaited handoff and recovery owner; the larger test addition exercises worker and restart boundaries.
Yielded cohort writes 2 acknowledged writes, previously 1 The intermediate durable marker supports recovery, while the extra write makes handoff cost worth measuring.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Measure the handoff cost (recommended)
    Record before/after seconds and peak RSS for initial yield and cold restoration with a representative populated registry.

Technical review

Best possible solution:

Keep one registry worker responsible for durable handoff and restoration, with current requester authority at each effect and measured resource bounds for populated registries.

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

Yes at the source level: current main calls synchronous persistence during initial yield and a synchronous full-registry load during restoration. The reviewer did not execute a fresh timing reproduction.

Is this the best way to solve the issue?

Yes: the branch reuses the registry writer and state-read worker while retaining the original requester checks. The remaining validation is the resource cost of the changed path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 92a7977173fb.

Labels

Label changes:

  • add merge-risk: 🚨 availability: Cold restoration now transfers complete registry rows through a worker without before/after memory and time measurements.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR reports an after-change WebSocket Gateway run that creates a non-main requester and child, exercises registered yield and cohort writers, observes durable intent and marker release, and reads the original requester through sessions.describe. Inspected registered tests inject worker failures and recover unprepared and prepared rows; the row codec and schema are unchanged, supporting existing-state compatibility. The reported run does not establish an OS-process restart or resource benchmark.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded internal responsiveness and recovery improvement without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 session-state: The two-stage durable cohort handoff can affect requester recovery or wake delivery if its state transitions regress.
  • merge-risk: 🚨 availability: Cold restoration now transfers complete registry rows through a worker without before/after memory and time measurements.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR reports an after-change WebSocket Gateway run that creates a non-main requester and child, exercises registered yield and cohort writers, observes durable intent and marker release, and reads the original requester through sessions.describe. Inspected registered tests inject worker failures and recover unprepared and prepared rows; the row codec and schema are unchanged, supporting existing-state compatibility. The reported run does not establish an OS-process restart or resource benchmark.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports an after-change WebSocket Gateway run that creates a non-main requester and child, exercises registered yield and cohort writers, observes durable intent and marker release, and reads the original requester through sessions.describe. Inspected registered tests inject worker failures and recover unprepared and prepared rows; the row codec and schema are unchanged, supporting existing-state compatibility. The reported run does not establish an OS-process restart or resource benchmark.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vito Cappello: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add before/after seconds and peak RSS for a populated registry.

Rating scale

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

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

Workflow

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

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-28T23:06:01.237Z sha 60b235c :: blocked before merge. :: none
  • reviewed 2026-09-29T07:13:43.066Z sha 60b235c :: blocked before merge. :: none
  • reviewed 2026-09-29T08:41:51.345Z sha ae6a4e8 :: blocked before merge. :: none
  • reviewed 2026-09-29T09:37:55.413Z sha 8494ccc :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/requester-wake-worker-main-20260928 branch from 958e43f to 068615f Compare September 29, 2026 03:52
Base automatically changed from codex/requester-wake-worker-main-20260928 to main September 29, 2026 07:05
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 29, 2026
@steipete
steipete force-pushed the codex/requester-initial-transfer branch from 60b235c to ae6a4e8 Compare September 29, 2026 08:32
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Sep 29, 2026
@steipete
steipete marked this pull request as ready for review September 29, 2026 08:33
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 36f8febace0cc255227179f7f1392eb9124a790a
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/subagents/requester-cron-authority.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.

@steipete
steipete merged commit 437572e into main Sep 29, 2026
148 of 230 checks passed
@steipete
steipete deleted the codex/requester-initial-transfer branch September 29, 2026 11:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Sep 29, 2026
Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after #160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
steipete added a commit that referenced this pull request Sep 29, 2026
Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after #160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
chuanleiguo pushed a commit to chuanleiguo/openclaw that referenced this pull request Sep 29, 2026
Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after openclaw#160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
steipete added a commit that referenced this pull request Sep 29, 2026
* fix: retain shared-state snapshots through worker failures

Keep preparation, query, and cleanup under the existing read owner.
Retain native child custody across disposable Worker loss, preserve admitted
source identities, and join cleanup before releasing the original directory.

Preserve existing schema, retention, SDK, and exact-native backup contracts.

* fix: preserve native wrapper imports and callback type contracts

* fix(tooling): retain dynamic snapshot cleanup dependencies

* fix(test): prepare package contract workers before tests

Prepare the Memory Core facade’s compiled worker dependencies through the existing runner owner before Vitest starts. Keep the runtime export assertion and its deadline unchanged.

Extend the actual pre-spawn lifecycle cases to cover direct and project-selected contract tests, including exclusions.

Validation: causal preparation-order failure, 35 artifact-owner cases, 19 unchanged package-contract cases, changed-file checks, and independent review.

* fix(sqlite): retain original snapshot cleanup across reloads

Carry the original complete-removal operation into re-imported callers instead of treating it as token retirement followed by another pathname deletion. Preserve both original and current reader fences, native join, and retry against the original cleanup owner. Remove the retired async registration path.

Exercise real replacement bytes and target loss, and inject Cron copy/removal failures in the actual workers. Both original regressions fail; the correction passes 35 Node cases, the canonical Bun lifecycle case, types, lint, export checks, and independent reviews.

* test(agents): share queued-registration context captures

Expose the read-context capture through the same synthetic source owner as the existing writer capture. This lets the uncertain-kill case finish canonical restoration instead of leaving its failed cleanup to contaminate subsequent registration cases.

* test(agents): run entry settlement with host broker

Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after #160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
steipete added a commit that referenced this pull request Sep 29, 2026
Observe gated operation rejections before advancing acknowledgement gates,
then directly await every rejects matcher. An earlier setup failure no
longer leaves a detached matcher promise. Require the unknown-write outcome
in both restoration refusals so an unrelated fixture error cannot satisfy
the custody assertion.

This completes the changed-lane repair after #160778 alongside main's
run-entry broker routing (7e1de91), shared read-context fixture
(9e4f201), and logical requester yield authority repair (81547a2).
The existing production fixes and all protected test expectations remain.

All three reported files fail on 2291fe8 and pass at 437572e~1 on
Blacksmith Testbox, Node 24.19.0/Linux.

Canonical main a34353a plus this patch passes all 96 tests three times
(145.80s, 68.82s, 68.10s), and 1,220 owning-suite cases in 211.49s. The
existing opt-in 5,000-session benchmark remains skipped. The 62-case queued
registration file takes 23.25s cold, then 10.94s and 9.26s in Vitest.
Full check:changed for the final three-file diff passes in 281.28s.

Proof: https://github.com/openclaw/openclaw/actions/runs/36587966134
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…160778)

* fix(agents): await initial requester handoffs through registry worker

* fix(agents): keep followup authority in its type contract
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after openclaw#160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…160946)

* fix: retain shared-state snapshots through worker failures

Keep preparation, query, and cleanup under the existing read owner.
Retain native child custody across disposable Worker loss, preserve admitted
source identities, and join cleanup before releasing the original directory.

Preserve existing schema, retention, SDK, and exact-native backup contracts.

* fix: preserve native wrapper imports and callback type contracts

* fix(tooling): retain dynamic snapshot cleanup dependencies

* fix(test): prepare package contract workers before tests

Prepare the Memory Core facade’s compiled worker dependencies through the existing runner owner before Vitest starts. Keep the runtime export assertion and its deadline unchanged.

Extend the actual pre-spawn lifecycle cases to cover direct and project-selected contract tests, including exclusions.

Validation: causal preparation-order failure, 35 artifact-owner cases, 19 unchanged package-contract cases, changed-file checks, and independent review.

* fix(sqlite): retain original snapshot cleanup across reloads

Carry the original complete-removal operation into re-imported callers instead of treating it as token retirement followed by another pathname deletion. Preserve both original and current reader fences, native join, and retry against the original cleanup owner. Remove the retired async registration path.

Exercise real replacement bytes and target loss, and inject Cron copy/removal failures in the actual workers. Both original regressions fail; the correction passes 35 Node cases, the canonical Bun lifecycle case, types, lint, export checks, and independent reviews.

* test(agents): share queued-registration context captures

Expose the read-context capture through the same synthetic source owner as the existing writer capture. This lets the uncertain-kill case finish canonical restoration instead of leaving its failed cleanup to contaminate subsequent registration cases.

* test(agents): run entry settlement with host broker

Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after openclaw#160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
Observe gated operation rejections before advancing acknowledgement gates,
then directly await every rejects matcher. An earlier setup failure no
longer leaves a detached matcher promise. Require the unknown-write outcome
in both restoration refusals so an unrelated fixture error cannot satisfy
the custody assertion.

This completes the changed-lane repair after openclaw#160778 alongside main's
run-entry broker routing (bc7a63e), shared read-context fixture
(4501bde), and logical requester yield authority repair (aaa5b05).
The existing production fixes and all protected test expectations remain.

All three reported files fail on 4adeaef and pass at 742df3d~1 on
Blacksmith Testbox, Node 24.19.0/Linux.

Canonical main e81e2b7 plus this patch passes all 96 tests three times
(145.80s, 68.82s, 68.10s), and 1,220 owning-suite cases in 211.49s. The
existing opt-in 5,000-session benchmark remains skipped. The 62-case queued
registration file takes 23.25s cold, then 10.94s and 9.26s in Vitest.
Full check:changed for the final three-file diff passes in 281.28s.

Proof: https://github.com/openclaw/openclaw/actions/runs/36587966134
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Sep 30, 2026
…hermetic

- subagent-registry.ts: restore upstream's plain public restoreOnce wrapper.
  2273ef6 had wrapped it with purgeExpiredDelegateArtifacts(), which
  opened state, quarantine and schema-contract stores on every public
  registry call, including the requester-yield path. Upstream's
  sessions.initial-transfer-custody test (437572e, openclaw#160778) requires that
  path to construct no SQLite; it failed 3/13.
  - The purge only garbage-collects expired rows, and every read already
    enforces retention_deadline <= now.
  - It still runs at gateway maintenance (startup and interval), in
    initSubagentRegistry, on bootstrap-pending and on the sweeper tick.
  - Flagged for review.
- artifacts.delegate-claims.test.ts (ours):
  - It mocked only visitSessionMessagesAsync, but upstream moved artifact
    reads onto the transcript worker, so the fixture never reached the
    handler. The test instead opened the shared /tmp/openclaw-agent.sqlite
    through a fixed /tmp store path.
  - It now uses withArtifactFixtureReader, as sibling artifact tests do, with
    a private mkdtemp dir.
  - It asserts the fixture reader is actually used.

Both found by a mechanical sweep of 106 continuation test files that were
never in the designation sweep (1166 passed; these were the only real
failures).

Refs #1408

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fq5EX9ESA3CG9cuZxVoKAK
yozakura-ava pushed a commit to yozakura-ava/openclaw that referenced this pull request Oct 2, 2026
…160946)

* fix: retain shared-state snapshots through worker failures

Keep preparation, query, and cleanup under the existing read owner.
Retain native child custody across disposable Worker loss, preserve admitted
source identities, and join cleanup before releasing the original directory.

Preserve existing schema, retention, SDK, and exact-native backup contracts.

* fix: preserve native wrapper imports and callback type contracts

* fix(tooling): retain dynamic snapshot cleanup dependencies

* fix(test): prepare package contract workers before tests

Prepare the Memory Core facade’s compiled worker dependencies through the existing runner owner before Vitest starts. Keep the runtime export assertion and its deadline unchanged.

Extend the actual pre-spawn lifecycle cases to cover direct and project-selected contract tests, including exclusions.

Validation: causal preparation-order failure, 35 artifact-owner cases, 19 unchanged package-contract cases, changed-file checks, and independent review.

* fix(sqlite): retain original snapshot cleanup across reloads

Carry the original complete-removal operation into re-imported callers instead of treating it as token retirement followed by another pathname deletion. Preserve both original and current reader fences, native join, and retry against the original cleanup owner. Remove the retired async registration path.

Exercise real replacement bytes and target loss, and inject Cron copy/removal failures in the actual workers. Both original regressions fail; the correction passes 35 Node cases, the canonical Bun lifecycle case, types, lint, export checks, and independent reviews.

* test(agents): share queued-registration context captures

Expose the read-context capture through the same synthetic source owner as the existing writer capture. This lets the uncertain-kill case finish canonical restoration instead of leaving its failed cleanup to contaminate subsequent registration cases.

* test(agents): run entry settlement with host broker

Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after openclaw#160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
yozakura-ava pushed a commit to yozakura-ava/openclaw that referenced this pull request Oct 2, 2026
…160946)

* fix: retain shared-state snapshots through worker failures

Keep preparation, query, and cleanup under the existing read owner.
Retain native child custody across disposable Worker loss, preserve admitted
source identities, and join cleanup before releasing the original directory.

Preserve existing schema, retention, SDK, and exact-native backup contracts.

* fix: preserve native wrapper imports and callback type contracts

* fix(tooling): retain dynamic snapshot cleanup dependencies

* fix(test): prepare package contract workers before tests

Prepare the Memory Core facade’s compiled worker dependencies through the existing runner owner before Vitest starts. Keep the runtime export assertion and its deadline unchanged.

Extend the actual pre-spawn lifecycle cases to cover direct and project-selected contract tests, including exclusions.

Validation: causal preparation-order failure, 35 artifact-owner cases, 19 unchanged package-contract cases, changed-file checks, and independent review.

* fix(sqlite): retain original snapshot cleanup across reloads

Carry the original complete-removal operation into re-imported callers instead of treating it as token retirement followed by another pathname deletion. Preserve both original and current reader fences, native join, and retry against the original cleanup owner. Remove the retired async registration path.

Exercise real replacement bytes and target loss, and inject Cron copy/removal failures in the actual workers. Both original regressions fail; the correction passes 35 Node cases, the canonical Bun lifecycle case, types, lint, export checks, and independent reviews.

* test(agents): share queued-registration context captures

Expose the read-context capture through the same synthetic source owner as the existing writer capture. This lets the uncertain-kill case finish canonical restoration instead of leaving its failed cleanup to contaminate subsequent registration cases.

* test(agents): run entry settlement with host broker

Route the existing run-entry suite through the database worker inventory
so asynchronous requester settlement can use the host broker.

The embedded thread lane failed five cases after openclaw#160778. All 32 cases
pass through normal infra fork routing. Scoped formatting, lint and
independent P2 review pass.
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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant