Skip to content

fix: keep one child completion failure from dropping sibling results - #201563

Merged
steipete merged 3 commits into
mainfrom
steipete/fix-2639-mixed-settle-bindings
Nov 19, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/fix-2639-mixed-settle-bindings

Conversation

@steipete

@steipete steipete commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A yielded requester could lose several finished child results when one member of its completion batch had no live Gateway binding. This can happen after restoration, but also during ordinary visible spawning or binding cleanup. The whole batch failed together, and a later requester turn could prevent the failure notice from appearing before the child rows were retired.

User Impact

Bound children now deliver their results independently of incompatible siblings. Unbound children settle separately, and retired children leave a visible failure that tells the user to inspect their saved results. No configuration or schema changes are required.

Why This Change Was Made

Visible spawning and watched follow-ups now preserve the caller's captured Gateway binding at registration. The registry partitions frozen batches by Gateway owner and retirement state before dispatch or failure settlement. Native settlement commits the admitted partition while leaving other members pending; the existing sibling wake mechanism advances them.

Failure reporting uses the existing required-completion owner for yielded batches, including when the original requester turn has ended. It verifies that the notice was appended and preserves the existing recovery receipt if publication fails. Failure notices preserve the existing chat-addressed contract across transcript replacement; live writer and completion-delivery lifecycle protections remain intact. Missing or stopped chats receive no notice. This removes the duplicate stable-batch notice path and redundant whole-wave validation; production code is net −12 lines.

Talk final attachments now follow admitted partitions while retaining pending siblings, exact full-cohort revocation, and consume-before-append replay protection. A retired row can resume its settle wake to record a visible failure, while ordinary delivery remains blocked.

Related: #195275. This fixes the separate mixed-binding failure before completion dispatch.

Evidence

Five regression cases fail on base 0b18f610 and pass with this change: restored unbound membership, live never-bound membership, live binding retirement, visible-spawn registration, and a failed settle after a newer requester yield. The native registry harness asserts actual bound-result delivery and a visible transcript failure for a retired row. Focused persistence, requester-wake and affected tool suites pass (96 tests). All four real-Gateway turnover controls also pass, including model error, reset and Stop. Final pnpm check:changed, the session-identity ratchet and isolated Codex autoreview through P2 pass. CI exposed a regression in the consolidated failure-notice path: it must follow the current chat after reset or compaction and preserve the original error detail. The unchanged retry-lifetime suite now passes (17 tests), along with five affected requester-wake regressions rerun after that repair.

Hosted Codex and ClawSweeper identified the Talk attachment contract. The repair adds success-first/failure-first replay controls and extends all three native mixed-binding cases to assert the Talk callback. Those cases fail on the earlier PR head and pass after the repair, including restoration processed first. The complete requester-wake suite passes 41 tests, attachment/dispatch/yield/Talk controls pass 92 tests, and restore/resume controls pass 4 tests. The existing serial-delegation Talk regression from #142830 remains green. Persisted row types, codec and schema are unchanged; the restored case writes, removes the in-memory owner, reloads through the native store, and verifies both delivered siblings and a visible retirement failure.

The 30-minute ordinary completion expiry can defer settle wakes while another delivery owner holds the row. This repair isolates the eventual batch failure; it does not change that timeout or claim to establish the cause of every delayed completion.

Final-head synthetic measurement used a 35.2 GiB agent database, 5,000 sessions, 6,000 retained runs and 62,000 workspace files (1.116 GB), with no production data. Five fresh-process A1/A2/B cycles each used six warmups and 30 measured four-child waves through the real settle owner and native SQLite mutations, with scripted delivery.

Per four-child wave Baseline A1 Baseline A2 Fixed
Wall time 6.662 ms 6.532 ms 7.196 ms
Process CPU 31.994 ms 32.205 ms 33.985 ms
Sampled allocation 2.040 MB 2.033 MB 2.037 MB

Values are medians of five process medians. Allocation was measured separately with V8 sampling; CPU includes worker threads. The fixture ran on APFS, not btrfs, and host load varied. The fixed wall median is 0.53–0.66 ms higher than A/A, while allocation falls between the controls. Timing was noisy: baseline A2 process medians ranged from 5.66 to 22.91 ms and fixed medians from 5.84 to 27.81 ms; all runs, including contention during local checks, are retained. This does not support a speedup claim or a precise causal estimate of the small median difference. These are owner measurements, not model/network latency.

@clawsweeper

clawsweeper Bot commented Nov 19, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling labels Nov 19, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T02:42:30.925905Z f40542c 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.

@github-actions

github-actions Bot commented Nov 19, 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: f40542c2d35a3074fc4bc57c901ab2342ba00636
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/subagents/registry/subagent-completion-batch-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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f34d322858

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +33 to +34
retired.has(getSubagentRunRuntimeKey(entry)) === isRetired &&
(resolver && getCanonicalGatewayContextResolver(resolver)) === gateway &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve final attachments when partitioning a yielded cohort

For a Talk consult that yields a multi-child batch, splitting otherwise same-authority children by Gateway binding can drop the spoken completion. promoteRequesterFinalAttachment records the full frozen cohort, but maybeWakeRequesterAfterAllChildrenSettledBound now passes only the selected partition's IDs to transferRequesterFinalAttachment and, subsequently, finalizeRequesterFinalAttachment. Both require an exact batch-ID match, so a bound child's successful continuation cannot append its final to the Talk attachment when another child's binding has been retired. Update the attachment ownership alongside this partitioning so successfully delivered sibling results still reach the waiting Talk caller.

Useful? React with 👍 / 👎.

@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 Nov 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Please review the final head 36e5717e7a6dea596c75fb9193517a8ecf8c3b66; the earlier automatic review started before this correction.

The two CI issues are resolved:

  1. Failure notices again address the current chat after reset or compaction, preserving refactor(sessions): address chats by ChatRef, fence writers by lease, and stop refusing on captured ids #200191 instead of comparing captured transcript IDs: failure owner, lines 99–107.
  2. Consolidation now preserves the original error in the visible event: details.error at line 131.

The unchanged retry-lifetime suite passes all 17 tests, the five affected requester-wake regressions pass, the session-identity ratchet and final pnpm check:changed pass, and Codex review is clean through P2. The PR body includes the completed synthetic A/A/B measurements. The mixed-batch regression cases remain red on the original base.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR separates child completion batches by Gateway ownership so one failed member cannot discard successful siblings.

Example: A yielded requester awaits run-bound and run-unbound, whose Gateway owner was retired.

  • Before: The incompatible member can fail the whole batch and suppress run-bound's result.
  • After: run-bound delivers independently, while the retired member receives separate failure settlement.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and the prior finding is repaired, but supplied changed-path proof stops at mocked transport.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Finished child results can disappear together when one completion-batch member lacks a compatible live Gateway owner.
Reason: Independent sibling delivery restores expected behavior, and maintainer authorship establishes direction without another product approval.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a concrete completion-delivery failure, and the earlier Talk attachment finding is resolved; no new actionable code defect was found.

Priority: P1
Reviewed head: f40542c2d35a3074fc4bc57c901ab2342ba00636

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show a mixed-binding or retired-member batch through an isolated real Gateway delivering the healthy sibling and recording the failed member's notice, including the waiting Talk callback when applicable.
Agent review details

How this fits together

The subagent registry receives child completion facts, selects requester continuation batches, persists their outcomes, and forwards successful finals to the requester conversation and any waiting Talk attachment.

flowchart TD
  A[Child completion] --> B[Subagent registry]
  B --> C[Gateway ownership partition]
  C --> D[Requester continuation]
  C --> E[Failure notice]
  D --> F[SQLite settlement]
  E --> F
  F --> G[Talk final attachment]
Loading

Technical review

Best possible solution:

Keep partition selection, atomic settlement, failure reporting, and Talk consumption in their existing owners while preserving pending siblings.

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

Current-main selection can combine bound and unbound members, whose shared resolver rejects incompatible bindings; the supplied native regressions report red on the base and green on the patch, but no tests were run during this read-only review.

Is this the best way to solve the issue?

The repair addresses the owning invariant by separating incompatible members before dispatch and settling only admitted members, with no replacement manager, schema, or configuration option.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Completion authority selection keeps the original intent (f444d3b: Separate requester invocations so one sibling cannot supply another invocation's authority.)
  • Whole-wave settlement validation changes intended behavior with a stated reason (10e951e: Outcome settlement required the surviving frozen wave to preserve atomic publication and recovery; this PR explicitly changes the admitted unit to an ownership partition while retaining atomicity within it.)
  • Chat-addressed failure reporting keeps the original intent (8d581e9: Failure notices follow the current chat across transcript replacement instead of treating captured transcript IDs as authority.)
  • Talk continuation ownership keeps the original intent (8d7e1e9: Transfer the attachment to the successor turn so another delegation wave can promote its batch without losing the final callback.)
  • Visible-spawn and watched-follow-up registration keeps the original intent (feat(agents): session self-service tools #107471: Visible children retain the existing registry completion contract; passing the captured Gateway binding completes that contract without changing admission or sandbox policy.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8d7e1e9 adds src/agents/subagents/requester-final-attachment.ts:146 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8d7e1e906937; files: src/agents/subagents/requester-final-attachment.ts)
  • Ayaan Zaidi: Raw commit 714129c adds src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts:486 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 714129c06ea1; files: src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts)
  • Josh Lehman: Raw commit 0b18f61 adds src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts:498 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 0b18f610d325; files: src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts)
  • Vincent Koc: Raw commit 0151e02 adds src/agents/subagents/requester-final-attachment.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 0151e020a76b; files: src/agents/subagents/requester-final-attachment.ts)

PR surface

Source -12, Tests +148, Docs +1. Total +137 across 17 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 11 91 103 -12
Tests 5 367 219 +148
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 459 322 +137

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test delta Production −12 lines; tests +148 lines The existing owners absorb the repair; test growth covers mixed bindings, restoration, visible registration, and Talk partition replay.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The underlying failure can suppress finished sibling results and leave a yielded requester without its expected completion.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (1 earlier review cycle)
  • reviewed 2026-11-19T02:24:44.635Z sha 36e5717 :: blocked before merge. :: [P2] Preserve Talk attachment ownership when splitting a yielded cohort

Reviewed November 18, 2026, 9:50 PM ET / November 19, 2026, 02:50 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

Addressing all three open items from the review on 36e5717e7a6d in head f40542c2d35a3074fc4bc57c901ab2342ba00636:

  1. Talk attachment ownership: the existing attachment owner now retains pending cohort members and consumes only the admitted partition before invoking the Talk callback. Replay cannot append a partition twice; a failed sibling cannot consume successful siblings. Full-cohort revocation remains exact. See partition matching, transfer, and consumption. The native mixed-binding cases now assert the Talk callback; all three fail on the prior head and pass after this repair. Separate success-first/failure-first controls verify replay and multiple successful siblings. This also addresses fix: keep one child completion failure from dropping sibling results #201563 (comment).

  2. Persisted-data compatibility: there is no row-format, codec, schema, version, or configuration change. The stored row types/codec and src/state are byte-identical to the base. The restored cohort regression persists the unchanged format, removes the in-memory owner, reloads through restoreSubagentRunsFromDisk, and processes the retired member first. It asserts healthy delivery, Talk output, and a visible failure before the retired row is gone. Native completion persistence tests and the four existing restoration/resume controls pass. The new attachment membership is process-local bookkeeping on the existing attachment, not persisted data. A latest-stable migration exercise would not cover a changed data model here; no migration is introduced. Proof is the requested native registry/Gateway-dispatch harness, with transport scripted, not a claim of a live Talk-provider session.

  3. Original Talk intent: I inspected 8d7e1e9069372734b1d1a5af3b5aff2d13793096 (fix(talk): deliver final answers after repeated delegation #142830). Transfer still assigns the successor turn, and promotion still replaces membership only for that current turn. A successor that delegates again can therefore promote its next batch before the previous batch settles. The existing serial delegation with requester final remains green. Session, lifecycle, generation and exact full-cohort revocation checks remain in place.

Validation: the complete requester-wake suite passes 41 tests; attachment, dispatch, yield and Talk controls pass 92; restoration/resume controls pass 4. Final pnpm check:changed and isolated Codex review through P2 pass. The repair also lets a retired row resume only its pending settle wake, so the failure owner can report it and release siblings while ordinary delivery stays blocked. Production delta is now −12 lines. No schema or config changes.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 19, 2026
@steipete
steipete merged commit 5724f95 into main Nov 19, 2026
146 of 148 checks passed
@steipete
steipete deleted the steipete/fix-2639-mixed-settle-bindings branch November 19, 2026 03:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…penclaw#201563)

* fix(subagents): isolate mixed Gateway completion batches

* fix(subagents): preserve chat-addressed failure diagnostics

* fix(subagents): retain Talk finals across settle partitions
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…201563)

* fix(subagents): isolate mixed Gateway completion batches

* fix(subagents): preserve chat-addressed failure diagnostics

* fix(subagents): retain Talk finals across settle partitions

(cherry picked from commit 5724f95)

Co-authored-by: RomneyDa <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 20, 2026
…licy

subagent-registry-lifecycle-wake.rejection-write is green at the pure
candidate bc7e568 and red from the stage-2 merge ddd0ec7, on Bun and
Node 24: "subagentRuns.selectCompletionAuthorityBatch is not a function"
at subagent-registry-lifecycle-wake.ts:352. Upstream openclaw#201563 (5724f95)
admits the requester wake's batch through that registry method, which
upstream openclaw#200873 (f444d3b) added. The test replaces the process-wide
subagentRuns with { confirmRetirement } only, so the wake threw before it
reached settlement.

The fixture's subagentRuns now delegates selectCompletionAuthorityBatch to
the real policy with no completion custody, which is what this row holds.
That admits the single-member batch, as the real registry does here. The
product behavior the test pins is unchanged: the failed wake still records
its rejection through settlement with outcome { delivered: false,
path: "none" }. A probe that admits an empty batch turns it red
("expected vi.fn() to be called 1 times, but got 0 times").

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…penclaw#201563)

* fix(subagents): isolate mixed Gateway completion batches

* fix(subagents): preserve chat-addressed failure diagnostics

* fix(subagents): retain Talk finals across settle partitions

Release adaptation: Split reviewed partition cluster: retired-owner failure settlement, selected-member attachments and cancellation caller adapters. Review corrections preserved.

(cherry picked from commit 5724f95)

Co-authored-by: RomneyDa <[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 docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: L 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