Repository navigation
fix(audio): stop canceled voice extraction leaving its process running - #1645
Conversation
Keep Process disposal with BoundedProcessWait until its asynchronous tree-kill worker finishes, while retaining the caller cleanup deadline and redirected-output drain behavior. Cover delayed worker cancellation and timeout with deterministic real-process tests. Co-authored-by: Copilot App <[email protected]>
Start the delayed-worker regression stopwatch at the cancellation boundary, matching the existing cancellation test. Preserve the three-second bound and held-worker assertions. Co-authored-by: Copilot App <[email protected]>
Keep a five-second test watchdog around the held-worker wait so a future unbounded cleanup regression fails and releases the fixture instead of hanging the suite. The three-second product assertion is unchanged. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 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 October 6, 2026, 1:15 AM ET / 05:15 UTC. ClawSweeper reviewWhat this changesThe PR keeps canceled voice-extraction processes owned by the cleanup worker until termination finishes, with regression coverage for delayed cleanup. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release retain the premature-disposal race. The focused repair has convincing native process evidence and no blocking findings. Priority: P2 Review scores
Verification
How this fits togetherPiper voice installation starts a local extractor and waits for its exit and redirected output. The shared process waiter handles cancellation and timeout cleanup before installation reports success or failure. flowchart TD
A[Voice installation] --> B[Local extractor]
B --> C[Wait for exit and output]
C --> D{Completed within deadline?}
D -->|Yes| E[Return extraction result]
D -->|No| F[Bounded cleanup return]
F --> G[Delayed worker terminates process]
G --> H[Dispose process]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep one process-lifetime owner that preserves bounded cancellation while retaining the original process object until its termination worker finishes. Do we have a high-confidence way to reproduce the issue? Yes. Main permits caller disposal while its kill worker is delayed beyond the cleanup deadline; the supplied baseline native runs also report two surviving extractors. This reviewer did not execute a reproduction. Is this the best way to solve the issue? Yes. Transferring disposal to the existing waiter repairs the lifetime race without weakening the deadline or introducing a separate PID-based termination target. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1a41be1b8ae. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landing receipt: merged through normal protected squash merge at e23f43a from exact reviewed/tested head 3973263. Build and Test run 37417483804 succeeded on attempt 1; required CI Gate job 112123759322 passed. No reruns, force push, or admin bypass. Hosted x64 CI is now verified, superseding the publication-time pending note. Final posted ClawSweeper review had no findings; both pinned local dual-model reviews were clean. Active-landing label removed. Original baseline and intermediate failure distinctions remain in the PR body. |
What Problem This Solves
Fixes: a canceled or timed-out Piper voice extraction can leave its extractor running when the cleanup worker runs after the caller has disposed its
Process.User Impact
Cancellation still returns promptly, but a delayed termination worker retains the process it needs to stop. Successful extraction and redirected output behavior are unchanged. Tree termination remains best effort, not an unconditional OS-level guarantee.
Why This Change Was Made
BoundedProcessWaitnow owns disposal, including after a delayed kill task finishes. Piper no longer disposes the supplied process on bounded return. This follows the existing MXC worker/caller-release ownership pattern without modifying MXC or introducing a PID-only kill target. The architecture ledger documents the new owner and preserved invariant: the caller deadline does not end the kill worker's process lifetime.The internal scheduler seam holds the real kill worker in tests until after cancellation/timeout returns. Tests then verify the process is still owned, release the actual killer, and verify exit and disposal. The 1-second cleanup budget and existing 3-second cancellation assertions are unchanged.
Evidence
Native Windows ARM64, .NET SDK 10.0.401. No voice/model download; tests use
OpenClaw.Shared.TestHostand local Windows tar.b1a41be1, isolated Piper cancellation, 2 CPUs, 10 repetitions8e113c86, same original test, 10 repetitions39732636, original test, 10 repetitions39732636, focused 12-test set, 10 repetitionsEarlier precondition failures are not counted as cleanup passes. No after-change repetition failed the still-running-extractor assertion. The new stopwatch now starts at cancellation, matching the existing cancellation test; its 3-second threshold is unchanged. A separate 5-second test watchdog prevents a future unbounded regression from hanging the held-worker fixture.
Other development evidence, retained rather than hidden
Process.Disposed; corrected to observe actualDispose(bool)via a realProcesssubclass, then 12 passed.Dispose()made both deterministic lifetime cases fail at the not-disposed assertion (0 passed, 2 expected failures). Mutation removed; production code is unchanged since8e113c86.Change Type
Scope
Required proof pools
none: no specialized containment, gateway, installer, architecture-specific implementation, or interactive UI behavior changed. Real child-process proof runs in the ordinary Shared suite; local ARM64 execution does not substitute for hosted x64 CI.Validation
Frozen head:
3973263666f3606d508e98f785721f4a1573ffc3Tree:
7b3deb2ef7790e6ff74784064b63eaf9b2a625a2Set
$env:OPENCLAW_REPO_ROOTto this isolated worktree and$env:OPENCLAW_TRAY_DATA_DIRto a task-local directory. Fresh test projects were restored/built before--no-restoreuse..\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoreFocused repeats set
$env:DOTNET_PROCESSOR_COUNT='2'and run:Each command ran 10 times on final head; 130 total tests passed, zero failures/skips.
Concurrency review
Both app-native rubber-duck reviewers reviewed the pinned production diff and subsequent test-only deltas. Actual runtime metadata:
claude-opus-5.5(high) andgpt-6-astra(high, long_context).Real Behavior Proof
3973263666f3606d508e98f785721f4a1573ffc3.Security Impact
No new permissions, secrets handling, network calls, command exposure, or data access scope. The existing extractor's process object is retained for its existing termination operation.
Compatibility and Migration
No configuration changes or migration. Internal ownership contract updated at every
BoundedProcessWaitcaller.Review Conversations