Skip to content

fix(voice-call): stop log tails when interrupted - #186691

Merged
obviyus merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-voicecall-tail-cancel-20261028
Oct 28, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-voicecall-tail-cancel-20261028

Conversation

@Alix-007

@Alix-007 Alix-007 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw voicecall tail keeps polling and printing appended records after SIGINT or SIGTERM, preventing normal command cleanup.

User Impact

Operators can stop either a custom JSONL diagnostic tail or retained SQLite history with a signal. With normally draining stdout, the CLI exits with status 130 for SIGINT or 143 for SIGTERM and does not print records appended afterward. No actual calling or channel-delivery behavior changes.

Why This Change Was Made

The tail action owns one AbortController, retains first-signal status, and uses abortable polling/stdout waits with finally-based listener cleanup. An already-started history read is allowed to settle before its result is rejected for output. This follows the same command-owned pattern as policy watch in #186562, without adding a generic SDK helper or changing shared process supervision.

The original commit by @Alix-007 is preserved. The private tail writer now requires its signal because all three callers already supply it. Production is +57/−29 (net +28); the 86 gross lines include moving the existing tail body into its guarded cleanup scope.

Diagnostic tests share fixtures instead of adding another harness. Short-read/copytruncate cases moved from the large CLI integration helper into the canonical log-reader suite, preserving byte/output checks. Total test delta against the merge base is 0 (+127/−61 in the canonical suite; −67 in the caller suite; +4/−3 in the retained-store fixture). No test-budget increase.

Evidence

Real built CLI / Linux Node 24.22.1 signal comparison and known limitation.

Main 51420782b3810b4aa1230aa9621aec78f7dbbd3c and candidate were separately installed/built in secretless Docker, with private state/config/HOME profiles. The voice-call plugin was enabled but calling disabled; no telephony/provider credentials were used.

  • After record 0, send SIGINT or SIGTERM, then independently append record 1 after 500 ms. Two runs per signal per version: main stays alive and prints record 1; candidate exits 130/143 in 41–46 ms and never prints it.
  • Real retained SQLite history: candidate exits 130 in 43.9 ms / 143 in 118.5 ms; main remains alive. Records were seeded offline through production persistence APIs, not a mocked reader.
  • No-signal tails stay active on both versions. Finite latency reports exit 0 with expected summaries on both JSONL and SQLite inputs.
  • 44/44 focused tests pass across both CLI suites (4.43 s invocation), plus 15/15 real retained-store tests under the hosted database-worker config (39.30 s invocation). In-flight-read, first-signal, listener/descriptor, unrelated-error, bounded-read, UTF-8, rotation and argument-validation coverage remains. Scoped lint, repository oxfmt/Bun formatter parity and diff whitespace checks pass.

Known limitation outside this fix: if the stdout consumer never drains an 8 MiB pending record after interruption, the candidate stops in about 1.03–1.17 s through the outer launcher's SIGTERM outcome, including after an initial SIGINT; that case is not claimed to preserve status 130. Main remains alive and needs teardown. No stdout destruction, forced command exit or shared supervisor change is included.

The SQLite tail consumer fixture now mocks the actual abortable Node timer owner, preserving other real exports, instead of the former SDK sleep export. This fixes both PR-caused hosted --since 0/1 tail timeouts without changing production or increasing timeouts.

Merge danger

Two-way door: reverting restores previous tail cancellation behavior; no state migration, schema, public config or API changes. Blast radius is voicecall diagnostic tails and their command-owned listener cleanup. Finite latency reports and normal polling retain their behavior; telephony runtime startup and provider/channel delivery are untouched.

@clawsweeper

clawsweeper Bot commented Oct 28, 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 docs Improvements or additions to documentation channel: voice-call Channel integration: voice-call size: S labels Oct 28, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Stops voice-call log tails on SIGINT or SIGTERM and releases their signal listeners.

Example: Run openclaw voicecall tail --file diagnostics.jsonl --since 1 --poll 250, then send SIGINT.

  • Before: The CLI stays alive and prints a record appended after interruption.
  • After: With draining stdout, the CLI exits with status 130 and prints no later record.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful fix with shipped-entry-point proof, preserved streaming contracts, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied isolated built-CLI output exercises JSONL and real retained SQLite tails with SIGINT/SIGTERM, verifies natural 130/143 exits and no later records, and preserves no-signal and finite-latency controls; final-head production matches the proven revision.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot stop a voice-call diagnostic tail normally because polling and later output continue after interruption.
Reason: The bounded repair restores expected CLI interruption without adding configuration, public APIs, persistence changes, or telephony behavior.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current diagnostic-tail cancellation bug with a focused implementation and convincing built-CLI proof; no actionable defects were found, and exact-head CI remains pending.

Priority: P2
Reviewed head: fd4601857d9cfe1ea6a42bb1fd6dbf0f0e13fa20

Before merge

None.

Findings

None.

Agent review details

How this fits together

The voice-call plugin registers diagnostic CLI commands that read custom JSONL files or retained SQLite call history and stream records to stdout.

flowchart TD
 CLI[Voicecall tail command] --> Owner[Command cancellation owner]
 Signals[SIGINT or SIGTERM] --> Owner
 Owner --> File[JSONL range reader]
 Owner --> Store[SQLite history reader]
 File --> Output[Abortable stdout writer]
 Store --> Output
Loading

Technical review

Best possible solution:

Retain command-owned cancellation in the existing diagnostic reader and writer without expanding shared process supervision.

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

The supplied built-CLI comparison reproduces continued output after real signals on main, and fetched-main source still contains the responsible non-cancellable loops; this review ran no target code.

Is this the best way to solve the issue?

The patch fixes cancellation at its existing command owner while preserving streaming and history semantics; the reported never-draining pipe outcome remains a separate launcher limitation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Bounded diagnostic streaming, backpressure, and retained-history deduplication keeps the original intent (9607d30: Replace whole-file reads and uncontrolled stdout writes while preserving complete records, rotation behavior, and requested SQLite history selection.)
  • Short-read and copytruncate regression coverage keeps the original intent (478a895: Prevent skipped bytes, split records, and corrupted UTF-8 under short filesystem reads; the PR moves the corresponding cases into the canonical reader suite.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Leon-SK668: Raw commit 51d8827 adds extensions/voice-call/src/cli-call-log.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 51d8827cccfa; files: extensions/voice-call/src/cli-call-log.ts)

PR surface

Source +28, Tests 0, Docs +2. Total +30 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 57 29 +28
Tests 3 131 131 0
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 190 160 +30

Review metrics

Metric Value Why it matters
Production versus test LOC Production +57/-29; tests +131/-131. The production growth adds cancellation and guarded cleanup around existing loops; consolidated fixtures preserve distinct reader and lifecycle coverage without net test growth.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Interrupt handling breaks an operator diagnostic workflow with limited blast radius and no calling or delivery changes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-28T11:09:36.708Z sha 28acde4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-28T12:22:16.969Z sha 60367f9 :: needs maintainer review before merge. :: none

Reviewed October 28, 2026, 8:50 AM ET / 12:50 UTC (Revision 3).

@obviyus

obviyus commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Built CLI / Linux Node 24.22.1 interruption proof

Main: 51420782b3810b4aa1230aa9621aec78f7dbbd3c. Final candidate: fd4601857d9cfe1ea6a42bb1fd6dbf0f0e13fa20, retaining the contributor's original commit. Production is identical to the built/proved 60367f97fbdda515dc8c1c47584eac0df910f3c7; the final commit only aligns a consumer test's timer mock. Both runtimes were separately installed and built in secretless Node 24.22.1 Docker. The real openclaw.mjs voicecall executable ran with private HOME/config/state/profile paths, the voice-call plugin enabled, and calling disabled. No actual telephony, provider credentials, model, or channel delivery was used.

Normal JSONL tail: real OS signals, twice each

For every fresh process, the harness waited for record 0 from a task-owned custom JSONL file (not named calls.jsonl), sent the indicated OS signal to the CLI PID, and independently appended record 1 after 500 ms. The command was voicecall tail --file <fixture> --since 1 --poll 250.

Signal / repeat Main Candidate
SIGINT, run 1 Still alive after 1.5 s; prints record 1 Exits 130 in 43.1 ms; never prints record 1
SIGINT, run 2 Still alive after 1.5 s; prints record 1 Exits 130 in 45.8 ms; never prints record 1
SIGTERM, run 1 Still alive after 1.5 s; prints record 1 Exits 143 in 41.2 ms; never prints record 1
SIGTERM, run 2 Still alive after 1.5 s; prints record 1 Exits 143 in 42.0 ms; never prints record 1

Candidate exits are natural process exits: the harness did not kill them. Stuck baseline processes were explicitly killed only after recording the failure.

Real retained SQLite history and controls

Records were seeded offline through the production voice-call persistence/state APIs, then read by the built CLI's retained-history path. The retained database is a real state/openclaw.sqlite file with the SQLite format header; no history reader was mocked in these process runs. After the initial retained record was printed, main remains alive on either signal; the candidate exits 130 in 43.9 ms for SIGINT and 143 in 118.5 ms for SIGTERM.

  • No-signal controls: JSONL tails on both versions stay alive and print appended record 1. SQLite tails on both versions stay alive. These intentionally endless controls were killed only for teardown.
  • Normal-end controls: finite voicecall latency --last 1 commands exit 0 on both versions for custom JSONL and real retained SQLite history, returning one record and the expected 100 ms latency summary.
  • Controlled in-flight history-read, first-signal precedence, listener/descriptor cleanup, unrelated errors, bounded reads, UTF-8, copytruncate and malformed JSON cases are retained in the focused unit suites.

Known limitation outside this command-owned fix

With an 8 MiB record and a stdout pipe that the consumer never drains after the signal, the candidate stops in 1.03–1.17 s, but the outer process is terminated by SIGTERM, including when the first signal was SIGINT; this is not claimed as status-130 success. The corresponding main cases still remain alive at the observation deadline and require teardown. This is a separate fully unread-pipe/shared-launcher outcome, not a reason to hide the cancellation improvement or change the shared supervisor here. No stdout destruction, forced command exit, or supervisor modification was added.

Simplification and final checks

The cancellation ownership matches the already-landed policy-watch pattern from #186562: one private command AbortController, first-signal exit status, abortable waits, and finally-based listener release. A new generic SDK helper would widen the contract unnecessarily. The private tail writer now requires its cancellation signal because all three callers already supply it. The 86 gross production lines are +57/−29, net +28, largely the existing tail body entering the guarded cleanup scope, rather than 86 new lines of machinery.

Diagnostic fixtures now share existing setup. The three short-read/copytruncate cases moved from the large CLI integration helper into the canonical log-reader suite without losing their byte/output assertions. Total test-line delta is 0 (+127/−61 in the canonical suite, −67 in the caller suite, +4/−3 in the retained-store fixture), with no budget increase.

Final focused checks: 44/44 tests pass across both CLI suites, invocation 4.43 s including cold transforms/imports. The retained-store suite also passes 15/15 under its actual extension-database-workers config (39.30 s invocation). Scoped Oxlint reports 0 warnings/errors, repository oxfmt/Bun formatter parity passes, and diff whitespace checks pass. Existing CLI documentation covers the new signal behavior.

The first pushed head exposed two PR-caused 120 s timeouts in store.test.ts: SQLite tail --since 0 and --since 1 still mocked the former SDK sleep export after production moved to abortable Node timers. The final test-only correction mocks the actual node:timers/promises owner while preserving its other real exports; both cases and all 15 retained-store cases pass. No production timeout was suppressed or extended, and no CI job was rerun.

@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 28, 2026
@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 28, 2026
@obviyus
obviyus merged commit e094e4c into openclaw:main Oct 28, 2026
105 of 106 checks passed
@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Landed in e094e4c. Thanks @Alix-007. voicecall tail now stops on Ctrl-C or a service stop.

github-actions Bot pushed a commit to Anti-RombikAnti-Rombik8790/openclaw that referenced this pull request Oct 28, 2026
fix(voice-call): stop voicecall tail on Ctrl-C and SIGTERM

openclaw voicecall tail ignored SIGINT and SIGTERM while it followed the call log, so it kept running and printing records after Ctrl-C or a service stop. It now stops on the first signal and exits with the conventional status, following the pattern policy watch uses (#186562).

Evidence: built Linux CLI on Node 24.22.1. On main tail stayed alive and printed a later JSONL record after each signal (twice each); with this change it exited with 130 or 143 in 41 to 46 ms, with no later output (twice each). The SQLite-backed tail also exits correctly, and no-signal and finite-run controls pass. If stdout is never read, the process now stops through the launcher's SIGTERM after about 1.1 s; on main it never stops in that case. Details: openclaw/openclaw#186691 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for reviewing and merging this, and for the additional SQLite validation and CI fixture fix. Much appreciated!

obviyus added a commit that referenced this pull request Oct 28, 2026
fix(cron): stop cron run --wait on Ctrl-C and SIGTERM

cron run --wait (and the automations alias) ignored SIGINT and SIGTERM while it polled for the job result, so it kept polling after Ctrl-C or a service stop. It now stops on the first signal, exits with the conventional status and prints no final result. It doesn't cancel the job itself, matching policy watch (#186562) and voicecall tail (#186691).

Evidence: built CLI on Node 24.22.1 with both aliases (48 real processes). On main the waiter stayed alive more than 5 s after each signal and made 201 more polls in total (twice each); with this change it exited with 130 or 143 in 20 to 32 ms, with no later polls, no final-result output and no cancel RPC (twice each). Completed, deadline, no-wait and zero-wait controls behave the same on both refs. The Gateway side was a recorded WebSocket fixture. Details: #186750 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
fix(voice-call): stop voicecall tail on Ctrl-C and SIGTERM

openclaw voicecall tail ignored SIGINT and SIGTERM while it followed the call log, so it kept running and printing records after Ctrl-C or a service stop. It now stops on the first signal and exits with the conventional status, following the pattern policy watch uses (openclaw#186562).

Evidence: built Linux CLI on Node 24.22.1. On main tail stayed alive and printed a later JSONL record after each signal (twice each); with this change it exited with 130 or 143 in 41 to 46 ms, with no later output (twice each). The SQLite-backed tail also exits correctly, and no-signal and finite-run controls pass. If stdout is never read, the process now stops through the launcher's SIGTERM after about 1.1 s; on main it never stops in that case. Details: openclaw#186691 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…#186750)

fix(cron): stop cron run --wait on Ctrl-C and SIGTERM

cron run --wait (and the automations alias) ignored SIGINT and SIGTERM while it polled for the job result, so it kept polling after Ctrl-C or a service stop. It now stops on the first signal, exits with the conventional status and prints no final result. It doesn't cancel the job itself, matching policy watch (openclaw#186562) and voicecall tail (openclaw#186691).

Evidence: built CLI on Node 24.22.1 with both aliases (48 real processes). On main the waiter stayed alive more than 5 s after each signal and made 201 more polls in total (twice each); with this change it exited with 130 or 143 in 20 to 32 ms, with no later polls, no final-result output and no cancel RPC (twice each). Completed, deadline, no-wait and zero-wait controls behave the same on both refs. The Gateway side was a recorded WebSocket fixture. Details: openclaw#186750 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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