Skip to content

fix(subagents): settle legacy requester sources across restarts - #175033

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-operator-source-still-recurs-20260919
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-operator-source-still-recurs-20260919

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes recurring “lacks its original operator source” warnings on Gateway restart for legacy requester-settle and yielded subagent records left unsettled by #174850.

User Impact

Missing-source continuations settle once, including legacy wakes with incomplete cohort metadata, yielded runs without a final outcome, and historical records still marked running after delivery and durable cleanup. Retained execution results and delivered receipts remain intact; recovery does not invent operator authority or send a new completion message.

Why This Change Was Made

The restoration owner previously excluded every requester wake and yielded run, while the completion writer required a terminal outcome. Those restrictions stranded records that could never restore their original operator source. Restoration now uses the same completion writer to persist suppression and clear the unavailable wake independently of execution settlement. Queue receipts and ordinary replaced-store notifications retain their existing settlement owners; failed writes remain retryable.

No schema, configuration, retention, or permission changes. Production LOC is +8 net (20 added / 12 removed): this widens the existing settlement transition and removes its individual-only/terminal-only restriction, without introducing another owner, cache, or recovery path. Test/support LOC is +73 net, largely the expanded two-restart inventory moved into the existing store-replacement file.

Evidence

  • Read-only startup metadata: 115 distinct affected IDs on one boot and 87 on the next, with 86 recurring. An exact-ID census in the shared state database found 85 terminal records (33 yielded) and one historical running record with durable cleanup. All 86 lack their saved operator source and satisfy the new settlement guard. No production state was modified.
  • Before/after regression: a 14-record synthetic SQLite inventory produces 10 repeat warnings on boot two before the fix and 0 after it. Covers ordinary and parent-target records, legacy and frozen wakes, dispatching announcements, suspended delivery, yields, absent outcomes, and delivered historical running state. A rejected requester-wake settlement write is retried before the second restart. Execution/result/receipt facts are preserved and no delivery work is queued.
  • Focused proof: 101 tests pass across the completion-authority, store-replacement, and completion-admission files (85 registry tests in 69.96 seconds; 16 completion-writer tests in 29.82 seconds). The initial sibling assertion expected later settlement and was updated after verifying that the main-session caller treats an already-settled cohort as terminal.
  • Changed-file oxlint and oxfmt, plus git diff --check, pass. The restart cases moved into the existing store-recovery test file to stay within the original file’s lint size limit. Initial independent Codex autoreview was clean through P2. Follow-up review found only the already-fixed ordering guard missing from the index; staging the reviewed working tree resolved that finding, with no additional P0–P2 defects found.
  • Initial PR CI caught an execution-ordering regression: settling an unfinished run's delivery before interrupted-run recovery changed its session projection to failed. Restoration now waits for terminal execution or durable cleanup; the unchanged orphan-recovery restart file passes all 35 tests. This still covers all 86 recurring records.
  • CI follow-up proof: all 19 cancellation-retirement tests and all 11 store-replacement tests pass. The cancellation fixture now restores its saved source to exercise authorized wake behavior. The rejected-write regression uses a real targeted SQLite rejection, removing a type-unsafe test probe.
  • The native cancellation E2E released startup activation during registration but inspected binding before activation completed. It now awaits that owner promise while preserving concurrent registration. Its single-file local command started a runtime build and was stopped under the local resource rule; CI owns its final verification. An earlier cancellation-file run passed assertions but was rejected by the harness because source changed mid-run; the subsequent frozen-source run passed cleanly.
  • Final broad validation: CI run 38998922931 passed all 43 executed jobs on bfc4304ec569c9f84d6fe15713df7c65dfb49330, including the native cancellation E2E and all type-check jobs. Required openclaw/ci-gate checks passed; no inherited-failure exception or CI rerun was needed. No Testbox/Crabbox allocation or benchmark was used for this correctness repair. Verification on a deployed Gateway remains pending.

Retire missing-source requester wakes and yielded continuations through the completion writer while preserving execution results and delivery receipts. Keep failed writes retryable and queue/store handoffs with their existing owners.
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 17, 2026 03:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T03:31:24.803557Z bfc4304 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR durably settles legacy subagent continuations that lack their original operator source while preserving execution results and delivery receipts.

Example: The saved legacy-state-0 record has a requester wake, cleanupCompletedAt 300, and deliveredAt and announcedAt 260.

  • Before: Each restart attempts to restore the missing operator source and warns again.
  • After: Recovery clears the unavailable wake and persists suppression while retaining both delivery timestamps.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation with meaningful persisted-state regression coverage and no actionable code findings; upgrade compatibility remains unproven.
Proof confidence 🦐 gold shrimp (3/6) Ordinary contributor proof is exempt for this maintainer-authored PR; supplied SQLite coverage exercises the production restoration and completion owners, but the persisted-state repair still needs a v2026.10.4-to-candidate Gateway upgrade trace showing one-time settlement, preserved results and receipts, and no new completion delivery across two restarts, with private endpoints and credentials redacted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Legacy subagent records repeat missing-operator-source warnings on Gateway restarts because their unavailable continuations never settle durably.
Reason: The maintainer-authored direction addresses observed recurring records without adding configuration, inventing authority, or replacing an existing state owner.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR addresses a distinct legacy restart-recovery defect still present on main; no introduced code defect was identified.

Priority: P2
Reviewed head: bfc4304ec569c9f84d6fe15713df7c65dfb49330

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: No latest-stable-to-candidate upgrade run demonstrates preserved settings, execution results, and delivery receipts through settlement and two Gateway restarts.
Agent review details

How this fits together

Gateway startup loads saved subagent records, restores completion authority, and passes permanently unavailable continuations to the existing worker-backed completion writer.

flowchart TD
  A[Gateway startup] --> B[Saved subagent registry]
  B --> C[Completion source restoration]
  C --> D[Existing completion writer]
  C --> E[Existing queue settlement]
  D --> F[Persisted results and delivery state]
  E --> F
  F --> G[Later restart]
Loading

Technical review

Best possible solution:

Keep permanent missing-source settlement in the existing completion writer while preserving execution recovery, queued delivery ownership, and retained results.

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

Current-main guards leave missing-source requester wakes and yielded records unsettled; the PR reports recurring startup IDs and a baseline SQLite inventory with repeated warnings, but no target code was executed during this review.

Is this the best way to solve the issue?

The change fixes the durable settlement boundary directly, retains transient retries, and preserves the existing execution, queue, and store-retirement owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Individual missing-source settlement and restart suppression changes intended behavior with a stated reason (2b83983: Persist permanent non-delivery for individual completions while preserving receipts, transient retries, queue settlement, and store-retirement ownership.)
  • Terminal-outcome and yielded-run blocking restrictions changes intended behavior with a stated reason (6652f7e: The Tasks removal retained completion settlement under native owners; the original blocking path operated on terminal, non-yielded completions.)
  • Requester recovery settlement keeps the original intent (ce9d859: Settle definitively unrestorable requester cohorts once while preserving child results and retrying temporary startup failures.)
  • Replaced-store delivery isolation keeps the original intent (6abc70a: Keep delayed child notifications with their original physical session store rather than contaminating a replacement conversation.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ce9d859 adds src/agents/subagents/registry/subagent-registry-gateway-owner.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ce9d859d68ab; files: src/agents/subagents/registry/subagent-registry-gateway-owner.ts)

PR surface

Source +8, Tests +73, Docs +2. Total +83 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 20 12 +8
Tests 5 210 137 +73
Docs 1 5 3 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 235 152 +83

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +8 net lines; tests/support +73 net lines The small production extension reuses existing owners; test growth expands persisted-state restart coverage and preserves authorized cancellation fixtures.

Labels

Label changes:

  • add P2: Recurring recovery warnings and stranded legacy continuation bookkeeping have limited scope, with no demonstrated outage or loss of retained results.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Recurring recovery warnings and stranded legacy continuation bookkeeping have limited scope, with no demonstrated outage or loss of retained results.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

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

  • Provide the latest-stable upgrade and two-restart trace described in the compatibility assessment.

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.

Reviewed October 16, 2026, 11:33 PM ET / October 17, 2026, 03:33 UTC.

@steipete
steipete merged commit c614c9b into main Oct 17, 2026
126 checks passed
@steipete
steipete deleted the steipete/perf-micro-operator-source-still-recurs-20260919 branch October 17, 2026 03:39
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…claw#175033)

* fix(subagents): settle legacy requester sources across restarts

Retire missing-source requester wakes and yielded continuations through the completion writer while preserving execution results and delivery receipts. Keep failed writes retryable and queue/store handoffs with their existing owners.

* fix(subagents): preserve execution recovery before settlement
steipete added a commit that referenced this pull request Oct 17, 2026
PR #175033 intentionally makes missing-source requester and yielded
continuations settle once without inventing operator authority. These
restart-fence fixtures instead need an authorized original requester.

Reuse prepareSubagentRecoveryFixture before persisting their rows. Keep
existing parent identity in the yielded integration case and preserve all
wake, stale-batch, delivery, and deadline assertions. Production code and
missing-source settlement coverage remain unchanged.

Attribution: current main a1ef282 reproduces three matching failures;
pre-#175033 cc19e13 passes seven focused cases while already containing
#175044. The ownership-release fix is therefore retained.

Validation: both full affected files pass all 45 tests under Node with
maxWorkers=1 (272.02s Vitest; native SQLite restart/fence coverage).
Targeted types, type-aware lint, formatting, and isolated P2 review pass.
No CI dispatch or rerun.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…aw#175186)

PR openclaw#175033 intentionally makes missing-source requester and yielded
continuations settle once without inventing operator authority. These
restart-fence fixtures instead need an authorized original requester.

Reuse prepareSubagentRecoveryFixture before persisting their rows. Keep
existing parent identity in the yielded integration case and preserve all
wake, stale-batch, delivery, and deadline assertions. Production code and
missing-source settlement coverage remain unchanged.

Attribution: current main a40e1b1 reproduces three matching failures;
pre-openclaw#175033 c8f9ee3 passes seven focused cases while already containing
openclaw#175044. The ownership-release fix is therefore retained.

Validation: both full affected files pass all 45 tests under Node with
maxWorkers=1 (272.02s Vitest; native SQLite restart/fence coverage).
Targeted types, type-aware lint, formatting, and isolated P2 review pass.
No CI dispatch or rerun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant