Skip to content

fix(ci): subagent cancellation test races child registration - #166807

Merged
RomneyDa merged 1 commit into
mainfrom
fix/subagent-control-registration-ci
Oct 7, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/subagent-control-registration-ci

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Related: #166754

What Problem This Solves

Fixes intermittent CI failures in the subagent cancellation regression when child registration loses a race with parent cancellation.

User Impact

No runtime or user-visible behavior changes. CI retains cancellation coverage without relying on incidental worker timing. No configuration, migration, or public API changes.

Why This Change Was Made

The existing “runtime load” case assumed cancellation would pause while a runtime module loaded. Commit 995b5ac506e (#164403) made that import static. The fixture still made the child dispatchable before awaiting its durable registration, so cancellation could release parent capacity before discovery could see the child.

Replace that retired timing assumption with an explicit barrier at the current initial session-preparation boundary. Register the child through the real owner before releasing preparation, then let real discovery, cancellation, and scheduler cleanup run. All existing no-launch, terminal-state, replacement-generation, and unrelated-root assertions remain unchanged.

Evidence

  • Observed CI failure: the late descendant started before the cancellation hold. The unchanged 45-test local replay passed, so it was not treated as a fix.
  • Controlled diagnostic: await the fixture’s existing parent interruption between enqueue and durable registration. It reproduces the exact CI no-start assertion on unchanged production code, without sleeps or timer changes. Diagnostic instrumentation is not included in this PR.
  • Repaired fixture: all 45 tests passed in original file order with node scripts/run-vitest.mjs src/agents/subagents/registry/subagent-control.test.ts --maxWorkers=1 (104.57 s command wall time; 98.25 s Vitest duration). The repaired case took 1.836 s. The original CI file ran for 73.05 s; candidate hosted timing is pending. No new cases, process boots, worker pins, or serial configuration were added.
  • Independent review through P2: no actionable findings. git diff --check, formatting, agents/sessions test types, targeted lint, and the changed-file ratchet/boundary guards passed against an independent frozen dependency install. The production unused-export scan passed. The full-tree and script unused-export scans report the same inherited finding: scripts/publish-model-catalog.mts: readRecommendedModels. That file and its consumers are unchanged in this PR; the symbol is exported but only called internally. It is recorded rather than suppressed or folded into this fixture repair. The overall check:changed result is therefore not green.

Test/support-only: +13/−4 lines; no production changes. This repairs an obsolete fixture ordering assumption, not a proven production cancellation bug.

@clawsweeper

clawsweeper Bot commented Oct 7, 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 labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 7, 2026, 7:34 PM ET / 23:34 UTC (Revision 2).

ClawSweeper review

What this changes

The PR synchronizes the subagent cancellation test at session preparation so child registration finishes before cancellation releases parent capacity.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The fixture repair remains useful and is absent from current main. No introduced correctness defect was found; the previously identified flake-validation requirement remains unmet.

Priority: P2
Reviewed head: ed1423f25db46ddfb4ac170f216f547c5a52e799

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable fixture repair with unchanged behavioral assertions; required flake validation remains to be documented.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR changes only test support, so contributor runtime proof is exempt; its reported fixture run is supplemental validation, with the separate flake-validation requirement still outstanding.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR changes only test support, so contributor runtime proof is exempt; its reported fixture run is supplemental validation, with the separate flake-validation requirement still outstanding.
Evidence reviewed 7 items Pinned introduced change: The introduced patch adds a one-shot preparation barrier and waits for it before registering the child. Existing no-launch, terminal-state, replacement-generation, and unrelated-root assertions remain unchanged.
Current main still needs the repair: Fetched main retains the runtime-load case and skips its reached barrier, permitting cancellation to progress while the fixture awaits child registration.
Real cancellation composition retained: The cancellation scope calls session preparation, then refreshes descendant discovery before traversal. The spy delegates to the original preparer after release; shared fixture teardown restores all spies after settling owned work.
Findings None None.
Security None None.

How this fits together

Subagent cancellation discovers registered descendants and holds queued work while stopping their parent. This test fixture controls registration timing and checks that cancellation prevents child launch without affecting unrelated work.

flowchart TD
  A[Parent cancellation] --> B[Session preparation barrier]
  C[Child registration] --> D[Durable registry]
  D --> B
  B --> E[Descendant discovery]
  E --> F[Hold and cancel queued child]
  F --> G[Release scheduler capacity]
Loading

Before merge

  • Complete next step (P2) - Complete and document 20 clean standalone runs of subagent-control.test.ts, three clean runs in the original failing shard order, and relevant cancellation-owner sibling tests.
Agent review details

Security

None.

PR surface

Tests +9. Total +9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 13 4 +9
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 13 4 +9

Review metrics

None.

Technical review

Best possible solution:

Keep cancellation coverage deterministic at the existing preparation boundary while preserving real registry discovery and scheduler cleanup.

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

Yes: source exposes the unbarriered registration/cancellation interleaving, and the captured body describes a controlled diagnostic reproducing the CI assertion. This read-only review did not execute tests.

Is this the best way to solve the issue?

Yes: gating the existing preparation call and then delegating to its original implementation repairs fixture ordering without weakening assertions or changing production cancellation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 14ef7a57ba7c.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded cancellation-fixture reliability repair with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR changes only test support, so contributor runtime proof is exempt; its reported fixture run is supplemental validation, with the separate flake-validation requirement still outstanding.

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)

Rank-up moves

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

  • Record 20 clean standalone file runs, three clean original-shard runs, and relevant cancellation-owner sibling results.

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-10-07T23:25:49.072Z sha ed1423f :: needs changes before merge. :: none

@RomneyDa
RomneyDa marked this pull request as ready for review October 7, 2026 23:28
@RomneyDa
RomneyDa enabled auto-merge (squash) October 7, 2026 23:33
@RomneyDa
RomneyDa merged commit eb7a4b1 into main Oct 7, 2026
204 of 205 checks passed
@RomneyDa
RomneyDa deleted the fix/subagent-control-registration-ci branch October 7, 2026 23:36
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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