Skip to content

fix(voice-call): ngrok tunnels no longer survive cleanup - #110122

Merged
steipete merged 5 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-voice-call-ngrok-stop-bound
Jul 18, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-voice-call-ngrok-stop-bound

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Related: #109416

Fixes an issue where voice-call could release ngrok process ownership while the process was still running when it ignored SIGTERM. This affected both normal runtime cleanup and the 30-second startup-timeout path, where a surviving process could keep an external tunnel active after stop completed or startup failed.

Why This Change Was Made

A module-local ngrok termination helper now waits two seconds for graceful termination, escalates to SIGKILL, and waits for the child close event. A final one-second fallback keeps ownership release bounded even if close is never observable. Both successful stop and startup timeout use the helper. To compose with #109416, the startup watchdog is also unref'ed, while startup settlement remains distinct from actual child closure so a timed-out live process is still reaped. The change adds no configuration or API surface.

User Impact

Voice-call no longer leaves a SIGTERM-resistant ngrok tunnel behind after either runtime shutdown or startup failure. Both paths retain finite upper bounds, so an unresponsive child cannot make cleanup wait forever.

Evidence

  • Current-main reproductions: a real executable named ngrok ignored SIGTERM; the old stop() returned with its PID still alive, and the old startup-timeout path rejected with its PID still alive one second later.
  • Standalone production-path proof: startTunnel spawned a real ngrok-named child; the child was alive before cleanup, recorded SIGTERM, and was dead when stop() returned after about 2.0 seconds.
  • Standalone startup-timeout proof: a real ngrok-named child emitted no recognized URL, ignored SIGTERM, and was dead before startTunnel rejected after about 32.0 seconds.
  • pnpm exec vitest run --config test/vitest/vitest.extension-voice-call.config.ts extensions/voice-call/src/tunnel.test.ts extensions/voice-call/src/tunnel.process.test.ts — 2 files passed, 22 tests passed.
  • pnpm exec oxlint extensions/voice-call/src/tunnel.ts extensions/voice-call/src/tunnel.test.ts extensions/voice-call/src/tunnel.process.test.ts — passed.
  • pnpm exec oxfmt --check extensions/voice-call/src/tunnel.ts extensions/voice-call/src/tunnel.test.ts extensions/voice-call/src/tunnel.process.test.ts — passed.
  • Composition with fix(voice-call): unref ngrok startup timeout, mark closed only on close event #109416 is covered directly: the startup timer is unref'ed, while the timeout path still sends SIGTERM, escalates to SIGKILL, and waits for process closure before rejecting.
  • The live proof does not contact the ngrok service or use credentials; a real OS child reproduces the targeted SIGTERM-resistant shutdown behavior. Broader extension TypeScript/check-changed coverage remains with hosted CI.

@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: M labels Jul 17, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 12:40 AM ET / 04:40 UTC.

Summary
The branch adds a bounded ngrok termination helper for normal stop and startup timeout, unrefs the startup watchdog, and adds mocked plus real-child process regression tests.

PR surface: Source +24, Tests +231. Total +255 across 3 files.

Reproducibility: no. independently executed current-main reproduction was available in this read-only review, but the described failure is concretely exercised by the added real-child test: an ngrok-named child ignores SIGTERM and remains alive until forced cleanup.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/voice-call/src/tunnel.process.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Risk before merge

  • [P2] Both open PRs alter the startup-timeout ownership model; merging them independently could leave duplicate or conflicting lifecycle policy.
  • [P1] Cleanup may now intentionally wait up to roughly three seconds for a SIGTERM-resistant child, so the maintainer should explicitly accept that bounded shutdown tradeoff.

Maintainer options:

  1. Consolidate the lifecycle before merge (recommended)
    Choose this branch as the canonical cleanup implementation and resolve the overlapping startup-timeout PR before either change lands.
  2. Accept separate sequencing
    Land one PR first only if the maintainer explicitly confirms that the other will be rebased or closed without reintroducing competing timeout ownership.

Next step before merge

  • [P2] A maintainer must select one canonical timeout and child-closure design across this PR and the related open PR; no narrow automated repair can safely make that policy choice.

Maintainer decision needed

  • Question: Should this PR become the single canonical implementation for ngrok startup-timeout and shutdown cleanup, superseding the overlapping lifecycle changes in fix(voice-call): unref ngrok startup timeout, mark closed only on close event #109416?
  • Rationale: The two branches modify the same timer, child-closure, and timeout ownership semantics; choosing the enduring design is a maintainer merge decision rather than a safe mechanical repair.
  • Likely owner: xydigit-zt — They authored the adjacent open implementation and are the best available routing contact in the supplied evidence for resolving the overlap.
  • Options:
    • Adopt this bounded lifecycle (recommended): Land this PR as the canonical SIGTERM-to-SIGKILL and close-wait design, then close or rebase the overlapping PR so only one timeout lifecycle remains.
    • Prefer the related narrow patch: Land the timer-focused approach from the related PR first, then ask for this branch to be rebased into a follow-up that preserves the chosen lifecycle contract.

Security
Cleared: The diff is limited to voice-call child-process termination and tests; it adds no dependency, workflow, permission, credential, download, or package-resolution surface.

Review details

Best possible solution:

Adopt one canonical ngrok lifecycle implementation that unrefs the startup watchdog, waits for actual child closure, and uses the bounded escalation helper for both normal stop and startup failure; then rebase, close, or narrow the overlapping PR accordingly.

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

No independently executed current-main reproduction was available in this read-only review, but the described failure is concretely exercised by the added real-child test: an ngrok-named child ignores SIGTERM and remains alive until forced cleanup.

Is this the best way to solve the issue?

Unclear until maintainers choose one canonical timeout lifecycle: the bounded helper is a maintainable solution for the reported orphan-process behavior, but it overlaps an active implementation at #109416.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 4e0cc187a21c.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: A SIGTERM-resistant optional voice-call tunnel can outlive shutdown or failed startup, but the change has limited channel-specific blast radius.
  • merge-risk: 🚨 availability: The PR changes process termination and wait timing on runtime shutdown and startup timeout, which can affect host shutdown latency and tunnel reaping.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body records after-fix runs using a real SIGTERM-resistant ngrok-named child for both stop and startup-timeout paths, with the child confirmed dead after bounded cleanup; no credentials or live ngrok service were used.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records after-fix runs using a real SIGTERM-resistant ngrok-named child for both stop and startup-timeout paths, with the child confirmed dead after bounded cleanup; no credentials or live ngrok service were used.
Evidence reviewed

PR surface:

Source +24, Tests +231. Total +255 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 64 40 +24
Tests 2 232 1 +231
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 296 41 +255

What I checked:

Likely related people:

  • xydigit-zt: Authored the still-open related PR that changes the same ngrok startup timer and child-close lifecycle, making them the clearest available routing contact for consolidation context. (role: adjacent lifecycle contributor; confidence: medium; commits: a35ce91cef64; files: extensions/voice-call/src/tunnel.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-17T18:08:34.919Z sha f4c8f9f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T19:36:11.610Z sha 36d8d54 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 17, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 18, 2026
@steipete steipete self-assigned this Jul 18, 2026
@steipete
steipete merged commit 3444052 into openclaw:main Jul 18, 2026
108 of 172 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
…0122)

* fix(voice-call): ngrok tunnels no longer survive cleanup

* fix(voice-call): document bounded ngrok shutdown

* fix(voice-call): reap ngrok after startup timeout

* fix(voice-call): type ngrok process with ignored stdin

* fix(voice-call): compose ngrok timeout lifecycle
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…0122)

* fix(voice-call): ngrok tunnels no longer survive cleanup

* fix(voice-call): document bounded ngrok shutdown

* fix(voice-call): reap ngrok after startup timeout

* fix(voice-call): type ngrok process with ignored stdin

* fix(voice-call): compose ngrok timeout lifecycle
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 merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. 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