Skip to content

fix(subagents): resume yielded tasks after slow Gateway admission - #149208

Merged
steipete merged 2 commits into
mainfrom
codex/fix-yield-continuation-admission
Sep 15, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-yield-continuation-admission

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #85308

What Problem This Solves

Fixes: a parent task can stop permanently after sessions_yield when admitting its continuation takes longer than the announcement wait.

User Impact

Tasks retain completed child results while their continuation is pending and can resume without repeating completed work. Explicit Stop and existing delivery deadlines remain effective. Previously cancelled sessions still require a new continuation.

Why This Change Was Made

Separate the private handoff's observation deadline from cancellation of the underlying Gateway turn. Treat a known in-flight request as pending work instead of another failed delivery, using the existing scheduling owner. Reject an already-cancelled caller before dispatch. Preserve the completed-requester replay protection from #85308. CI-exposed test cleanup now drains the exact cron database worker before removing storage and uses the canonical live-process check for Matrix descendants; no assertions or timeouts were relaxed.

Evidence

The real Gateway/SQLite regression failed before the repair: delayed admission recorded a failed completion without running the requester. The integrated fix passed 419 focused tests. The CI follow-up passed all 1,288 Gateway database-worker tests plus 564 cleanup, replay, process-liveness, and Matrix tests, along with typechecking, scoped lint, formatting, and independent review.

The first CI run exposed two file-size violations and two test-cleanup failures. The follow-up removes redundant delivery code and fixes fixture resource cleanup. Updated-head CI validates the published candidate before landing.

Keep private completion observation deadlines separate from turn cancellation, preserve in-flight completion obligations, and retain explicit Stop and existing delivery expiry behavior. Reproduced with real Gateway admission and SQLite receipts; focused regressions, typechecks, lint, and independent review passed.
@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@steipete
steipete marked this pull request as ready for review September 15, 2026 15:25
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete steipete self-assigned this Sep 15, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 12:06 PM ET / 16:06 UTC (Revision 2).

ClawSweeper review

What this changes

The branch preserves pending subagent continuations during slow Gateway admission, adds cancellation and retry regressions, documents the behavior, and corrects two test cleanup paths.

Merge readiness

✅ Ready for maintainer review

This remains a useful repair: inspected current main still cancels private admission when the announcement wait expires. No blocking defect was found in the introduced changes, and the earlier completed-requester replay protection remains intact.

Priority: P1
Reviewed head: f78776f80a488ae590d5b6c192c044e93aa5f76f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful admission, cancellation, and retry coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts this internal reliability PR from the external-contributor proof gate. Its reported validation maps to real Gateway admission and SQLite receipts with a controlled agent command; it does not establish live provider or channel behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this internal reliability PR from the external-contributor proof gate. Its reported validation maps to real Gateway admission and SQLite receipts with a controlled agent command; it does not establish live provider or channel behavior.
Evidence reviewed 8 items Current main still contains the reported mechanism: The inspected main revision combines the observation deadline with the caller signal and passes that combined signal to dispatch with cancelOnDeadline enabled. The proposed separation is absent. Release inclusion was not established; no shipped-fix claim is made.
Observation and cancellation remain separately owned: Private dispatch retains the caller's cancellation signal; only its observer receives the announcement deadline. Pre-cancelled callers are rejected, and execution still checks live delivery ownership. The Gateway facade retains cancellation against the exact accepted abort owner.
Pending observations preserve the existing settlement obligation: A requester_turn_pending result defers the same dispatching batch without incrementing failure or stale-deferral budgets. Existing requester identity, generation, Gateway lifetime, and cancellation checks remain. Individual announcements retain the lifecycle delivery deadline.
Findings None None.
Security None None.

How this fits together

The subagent registry retains completed child results and schedules continuation of a parent that yielded. Gateway admission runs that continuation, while the registry tracks whether its results were consumed or still need delivery.

flowchart TD
  A[Completed child results] --> B[Registry settlement batch]
  B --> C[Private Gateway admission]
  C --> D{Request outcome}
  D -->|Still pending| B
  D -->|Completed| E[Record consumption]
  F[Explicit cancellation] --> C
  E --> G[Resume parent task]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +18, Tests +163, Docs +6. Total +187 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 6 86 68 +18
Tests 6 205 42 +163
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 298 111 +187

Review metrics

None.

Technical review

Best possible solution:

Keep Gateway admission responsible for continuation execution and the existing registry responsible for observing completion, preserving explicit cancellation and delivery expiry.

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

Yes, source establishes the trigger: hold private Gateway admission past the announcement timeout. The added Gateway/SQLite regression exercises that boundary, but this read-only review did not run it.

Is this the best way to solve the issue?

Yes. Separating observation from cancellation repairs the existing ownership boundary without adding a scheduler, configuration option, or persistence format.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Slow Gateway admission can permanently interrupt a yielded parent task despite completed child results.
  • 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 supplied MEMBER association exempts this internal reliability PR from the external-contributor proof gate. Its reported validation maps to real Gateway admission and SQLite receipts with a controlled agent command; it does not establish live provider or channel behavior.

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)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-15T15:37:50.326Z sha d3c3ec1 :: needs maintainer review before merge. :: none

Drain the cron fixture worker before removing its database and use canonical process liveness in the Matrix stream-error fixture. Simplify completion-flow branches to satisfy the existing file-size limits without changing delivery semantics. All 1288 Gateway database-worker tests and 564 focused cleanup, replay, process-liveness and Matrix tests passed; scoped static checks and independent review are clean.
@kvnloo

kvnloo commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

CHECK — head f78776f80a488ae590d5b6c192c044e93aa5f76f

“Admission slower than announce wait” is already covered on this head with wall-clock evidence: src/gateway/server.private-completion.test.ts → keeps delayed private admission %s after the announcement wait expires (timeoutMs: 200, lifecycle-mutation hold → observation gateway request timeout for agent → in_flight/admissionPending: true → process or caller-cancel). Settle retention for the same in-flight turn is in subagent-announce.requester-settle-dispatch.test.ts → retains an in-flight private wake past the failure retry limit until %s (requester_turn_pending).

Ask: name those two tests (path + title) in the PR Evidence section so the sessions_yield resume claim is pinned to the suite reviewers can re-run—no new design, no extra scope.

Ask (design, light):

  1. Per yield-handoff ownership: is announce-wait allowed to retire a settlement obligation, or only to stop waiting on announcements while requesterSettleWake / successor admission still owes the continuation?
  2. Docs say the successor needs fresh Gateway admission (no revived authority). Is “late admission adopts the paused row under a new run ID” the invariant we want named next to those two tests — so the next slow dependency can’t reintroduce soft-deadline-as-cancel?
  3. Should “yielded, waiting successor admission” be operator-visible (session/turn field), or stay gateway-private forever?

@steipete
steipete merged commit 7ad9d0b into main Sep 15, 2026
198 checks passed
@steipete
steipete deleted the codex/fix-yield-continuation-admission branch September 15, 2026 16:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…enclaw#149208)

* fix(subagents): resume yielded tasks after slow gateway admission

Keep private completion observation deadlines separate from turn cancellation, preserve in-flight completion obligations, and retain explicit Stop and existing delivery expiry behavior. Reproduced with real Gateway admission and SQLite receipts; focused regressions, typechecks, lint, and independent review passed.

* fix: stabilize continuation cleanup checks

Drain the cron fixture worker before removing its database and use canonical process liveness in the Matrix stream-error fixture. Simplify completion-flow branches to satisfy the existing file-size limits without changing delivery semantics. All 1288 Gateway database-worker tests and 564 focused cleanup, replay, process-liveness and Matrix tests passed; scoped static checks and independent review are clean.
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 extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

2 participants