Repository navigation
fix(subagents): resume yielded tasks after slow Gateway admission - #149208
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 12:06 PM ET / 16:06 UTC (Revision 2). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +18, Tests +163, Docs +6. Total +187 across 13 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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.
CHECK — head
|
|
Merged via squash.
|
…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.
Related: #85308
What Problem This Solves
Fixes: a parent task can stop permanently after
sessions_yieldwhen 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.