Skip to content

fix(test): widen the subagent registry root-work teardown fence - #155960

Merged
steipete merged 3 commits into
mainfrom
fix/session-flip-proof-leftover
Sep 22, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/session-flip-proof-leftover

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Full Release Validation 35775979903 (CI child 35776854264, candidate release/2026.9.6 = main 814a7e752afc + locale refresh + #155892) failed subagent-registry.persistence.test.ts, subagent-spawn.authority.test.ts, chat.abort-errors.test.ts and chat.abort-incarnation.test.ts in settleSubagentRegistryPersistenceWork with residual registry roots: tasks:delivery (2|4|6): expected N to be +0. All were green in the two previous validation runs.

Bisected to #151917 (68b724b355e, move terminal notification writes off the Gateway thread): subagent-registry.persistence.test.ts passes 30/30 at 68b724b355e^ and fails at 68b724b355e with the exact CI signature; on current main it fails 5/5 locally. The tasks:delivery roots are not leaked: with a 20 s fence the same test passes (3.3 s), i.e. uncaptured deliveries settle 1–2 s after the test body, while the shared helper used vi.waitFor's 1 s default. #155910 and #155888 already fixed individual fixtures by capturing deliveries; this widens the shared fence so the remaining callers (persistence, timing, resume, task-replacement, chat.abort-*) stop racing it. Test contract change only; no product change.

The related build-artifacts failure (sqlite-sessions-transcripts-flip-proof rejecting the delete-drain stopReason) was fixed on main in parallel by 8ba18cf19ad; this branch merged that and carries no change of its own for it.

Change

  • src/agents/subagents/registry/subagent-registry.persistence.test-support.ts: vi.waitFor(..., { timeout: 10_000 }) in settleSubagentRegistryPersistenceWork.

Proof

  • The four affected files green in one local vitest run with the change (Tests 26 passed, Tests 36 passed).
  • oxfmt --check / oxlint clean on the changed file; exact-head hosted gates via scripts/pr.

@clawsweeper

clawsweeper Bot commented Sep 22, 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 agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Sep 22, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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 Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 22, 2026, 5:29 PM ET / 21:29 UTC (Revision 2).

ClawSweeper review

What this changes

The remaining branch diff increases the shared subagent test cleanup wait from one second to ten seconds.

Merge readiness

⛔ Blocked before merge - 3 items remain

The prior delivery-error masking finding remains unresolved. Current main already contains targeted repairs for the named failing fixtures, so the remaining global timeout increase has not established a distinct safe fix.

Priority: P2
Reviewed head: 80aebbf92b03fe3d20d87c0c8b9502b694bf2760

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The diagnosis is useful, but the remaining timeout workaround still weakens failure detection.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only change. Reported passing unit runs support cleanup timing but do not demonstrate preservation of late delivery failures; no stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only change. Reported passing unit runs support cleanup timing but do not demonstrate preservation of late delivery failures; no stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head diff changes only the shared root-work poll, adding timeout: 10_000 and an explanatory comment. The SQLite stop-reason change is no longer part of the introduced delta.
Prior finding remains unchanged: Comparison with the previously reviewed head returned no changes to this helper. The earlier request to preserve explicit delivery-result joins remains applicable; integration with main addressed branch reconciliation but did not repair the timeout workaround.
Delivery failure and lifetime are separate: Detached delivery catches and logs background rejections while returning the rejecting promise. Gateway admission releases its root in finally, so a zero-root count does not establish delivery success.
Findings 1 actionable finding [P2] Join delivery results instead of extending the root poll
Security None None.

How this fits together

Subagent tests create asynchronous task notifications that can continue after registry events finish. Their cleanup helper joins captured delivery results and checks that background work has stopped before fixtures release temporary stores.

flowchart TD
  A[Test fixture actions] --> B[Registry events]
  B --> C[Background task delivery]
  C --> D[Captured delivery results]
  B --> E[Cleanup helper]
  D --> E
  E --> F{Background work stopped}
  F --> G[Release fixture stores]
Loading

Before merge

  • Join delivery results instead of extending the root poll (P2) - The prior finding remains unresolved. Callers such as the resume fixture still omit deliveries. If a detached notification rejects after one second but before ten seconds, runTaskDeliveryWithDetachedAdmission logs its rejection and releases its root; this new poll then passes without reporting the failed delivery. Capture work before those fixtures start producers and pass it to the existing settlement helper, whose settle() preserves rejections, instead of making uncaptured failures pass through a longer deadline.
  • Resolve merge risk (P1) - The longer root-count poll can let an uncaptured delivery rejection become a passing teardown, weakening CI's ability to detect failed notification work.
  • Complete next step (P2) - Remove the timeout-only workaround and address any demonstrated remaining fixture gap through captured delivery results; preserve rejection propagation and validate cleanup before merge.

Findings

  • [P2] Join delivery results instead of extending the root poll — src/agents/subagents/registry/subagent-registry.persistence.test-support.ts:98
Agent review details

Security

None.

PR surface

Tests +5. Total +5 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 12 7 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 12 7 +5

Review metrics

Metric Value Why it matters
Shared teardown deadline 1 second → 10 seconds The increase applies to all consumers without adding delivery-result observation.

Merge-risk options

Maintainer options:

  1. Preserve delivery failures (recommended)
    Remove the timeout increase and use the existing delivery collector in any fixture still proven to need a settlement repair.
  2. Retire the remaining workaround
    If the merged fixture repairs eliminate the reported failures, a maintainer can close this branch without landing the global timeout change.

Technical review

Best possible solution:

Keep fixture-owned delivery joins and the existing root guard, repairing only a demonstrated remaining caller that fails to capture its asynchronous work.

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

Yes, from source: an uncaptured delivery rejecting between the old and new deadlines releases its root and can satisfy cleanup without propagating the rejection. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

No. Waiting longer observes lifetime completion but not delivery results; the existing capture-and-settle contract preserves both and is already used by the merged fixture repairs.

Full review comments:

  • [P2] Join delivery results instead of extending the root poll — src/agents/subagents/registry/subagent-registry.persistence.test-support.ts:98
    The prior finding remains unresolved. Callers such as the resume fixture still omit deliveries. If a detached notification rejects after one second but before ten seconds, runTaskDeliveryWithDetachedAdmission logs its rejection and releases its root; this new poll then passes without reporting the failed delivery. Capture work before those fixtures start producers and pass it to the existing settlement helper, whose settle() preserves rejections, instead of making uncaptured failures pass through a longer deadline.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded test-reliability repair with no production behavior change.
  • merge-risk: 🚨 automation: The introduced timeout can convert a late background delivery failure into a passing CI teardown.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test-only change. Reported passing unit runs support cleanup timing but do not demonstrate preservation of late delivery failures; no stored-data contract changes.

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)
  • vincentkoc: 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.

  • Replace the global timeout increase with a fixture-owned delivery join wherever a current failure remains.
  • Validate successful settlement and rejected delivery results, then update the PR body to reflect the remaining scope.

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 (1 earlier review cycle)
  • reviewed 2026-09-22T21:09:21.160Z sha 3fbf653 :: blocked before merge. :: [P2] Join uncaptured delivery results instead of extending the root poll

@steipete steipete self-assigned this Sep 22, 2026
…f-leftover

# Conflicts:
#	test/helpers/sqlite-sessions-transcripts-flip-proof.ts
@steipete steipete changed the title fix(test): accept delete-drain stop reason and widen subagent registry teardown fence fix(test): widen the subagent registry root-work teardown fence Sep 22, 2026
@steipete
steipete merged commit 2299989 into main Sep 22, 2026
234 of 237 checks passed
@steipete
steipete deleted the fix/session-flip-proof-leftover branch September 22, 2026 22:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 23, 2026
)

## Summary

Full Release Validation 35775979903 (CI child 35776854264, candidate `release/2026.9.6` = main `814a7e752afc` + locale refresh + #155892) failed `subagent-registry.persistence.test.ts`, `subagent-spawn.authority.test.ts`, `chat.abort-errors.test.ts` and `chat.abort-incarnation.test.ts` in `settleSubagentRegistryPersistenceWork` with `residual registry roots: tasks:delivery (2|4|6): expected N to be +0`. All were green in the two previous validation runs.

Bisected to #151917 (`68b724b355e`, move terminal notification writes off the Gateway thread): `subagent-registry.persistence.test.ts` passes 30/30 at `68b724b355e^` and fails at `68b724b355e` with the exact CI signature; on current main it fails 5/5 locally. The `tasks:delivery` roots are not leaked: with a 20 s fence the same test passes (3.3 s), i.e. uncaptured deliveries settle 1–2 s after the test body, while the shared helper used `vi.waitFor`'s 1 s default. #155910 and #155888 already fixed individual fixtures by capturing deliveries; this widens the shared fence so the remaining callers (persistence, timing, resume, task-replacement, chat.abort-*) stop racing it. Test contract change only; no product change.

The related `build-artifacts` failure (`sqlite-sessions-transcripts-flip-proof` rejecting the delete-drain `stopReason`) was fixed on main in parallel by `8ba18cf19ad`; this branch merged that and carries no change of its own for it.

## Change

- `src/agents/subagents/registry/subagent-registry.persistence.test-support.ts`: `vi.waitFor(..., { timeout: 10_000 })` in `settleSubagentRegistryPersistenceWork`.

## Proof

- The four affected files green in one local vitest run with the change (`Tests 26 passed`, `Tests 36 passed`).
- `oxfmt --check` / `oxlint` clean on the changed file; exact-head hosted gates via `scripts/pr`.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
…claw#155960)

## Summary

Full Release Validation 35775979903 (CI child 35776854264, candidate `release/2026.9.6` = main `4064209d089c` + locale refresh + openclaw#155892) failed `subagent-registry.persistence.test.ts`, `subagent-spawn.authority.test.ts`, `chat.abort-errors.test.ts` and `chat.abort-incarnation.test.ts` in `settleSubagentRegistryPersistenceWork` with `residual registry roots: tasks:delivery (2|4|6): expected N to be +0`. All were green in the two previous validation runs.

Bisected to openclaw#151917 (`63729428338`, move terminal notification writes off the Gateway thread): `subagent-registry.persistence.test.ts` passes 30/30 at `63729428338^` and fails at `63729428338` with the exact CI signature; on current main it fails 5/5 locally. The `tasks:delivery` roots are not leaked: with a 20 s fence the same test passes (3.3 s), i.e. uncaptured deliveries settle 1–2 s after the test body, while the shared helper used `vi.waitFor`'s 1 s default. openclaw#155910 and openclaw#155888 already fixed individual fixtures by capturing deliveries; this widens the shared fence so the remaining callers (persistence, timing, resume, task-replacement, chat.abort-*) stop racing it. Test contract change only; no product change.

The related `build-artifacts` failure (`sqlite-sessions-transcripts-flip-proof` rejecting the delete-drain `stopReason`) was fixed on main in parallel by `9b877337ffb`; this branch merged that and carries no change of its own for it.

## Change

- `src/agents/subagents/registry/subagent-registry.persistence.test-support.ts`: `vi.waitFor(..., { timeout: 10_000 })` in `settleSubagentRegistryPersistenceWork`.

## Proof

- The four affected files green in one local vitest run with the change (`Tests 26 passed`, `Tests 36 passed`).
- `oxfmt --check` / `oxlint` clean on the changed file; exact-head hosted gates via `scripts/pr`.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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