Skip to content

refactor(voice-call): deslop voice-call - #165276

Merged
steipete merged 1 commit into
mainfrom
deslop/fd5-voice-call-20261004-a
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/fd5-voice-call-20261004-a

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Voice-call repeats carrier request configuration and owner-state plumbing across its PSTN, realtime, call-manager, and CLI paths, increasing maintenance cost.

User Impact

No user-visible change. Every feature, CLI/RPC/tool description, configuration key/default, persisted call shape, carrier payload, signature/replay rule, and number-ownership check is preserved. No migration or operator action is required.

Why This Change Was Made

  • Reuse the existing VoiceCallProvider adapter contract and configure one shared carrier HTTP/status owner, retaining each carrier's headers, audit/error labels, regional host restrictions, and recovery behavior.
  • Collapse transcript adoption/cleanup wrappers and repeated final-transcript persistence; consolidate the audio-pacer reset and playback settlement owners.
  • Remove mirrored manager context/result types and single-use admission wrappers while retaining queued persistence-before-publication and live-call identity checks.
  • Derive nested configuration defaults from their field schemas and remove redundant normalization. Consolidate response extraction, ngrok readiness, and Tailscale route construction.
  • Inline the single-use runtime resource factory and response projections; share CLI action ownership and tool initiation parameters. Use an exhaustive Doctor description table and shrink the assertion baseline through its generator.

Production TypeScript: 15,786 → 15,240 LOC, net −546 (3.46%), including the new shared carrier module and excluding tests, fixtures/support, docs, and generated metadata. Tests gain 12 fixture-adapter lines; behavioral assertions are unchanged. This is the single below-1,000 batch after full feature coverage; it does not meet the requested 20% reduction.

Evidence

  • Linux / Node 24.19.0: node scripts/run-vitest.mjs extensions/voice-call — 68 files, 748 tests passed, two shards in 83.07 s.
  • Exact before/after config comparison passed: input/output JSON schema bytes/order, raw validation, normalization, provider credential resolution, and default object/array sharing and mutation propagation.
  • Final focused validation passed all eight Plivo tests, all 51 config tests, the existing reaper transport/lifecycle tests, exact config parity, and extension production/test typechecking. The changed Twilio API fixture passed nine tests with --maxWorkers=1: 1.26 s Vitest / 2.48 s wrapper wall time; equivalent CI work is one existing nine-test suite, with no added assertions or test cases.
  • Both mandatory import-cycle checks reported 0.
  • Independent Codex autoreview: scoped-clean through P2. Original narrow endCall/lookup types and optional lifecycle cleanup contracts are retained; tests and assertions stay unchanged.
  • Plugin contracts: 1,139 passed; one inherited failure. plugin-sdk-runtime-api-guardrails.test.ts:309 expects 38 runtime API surfaces but finds 39 because extensions/x/runtime-api.ts is absent from its expected list. The identical failure reproduces on clean base dc518bfca481d64aef69f9a4f8435fc6d46ed46d, with the voice-call patch removed. None of those contract inputs changed here.
  • node scripts/check-changed.mjs passed completely on the final candidate, including production/test types, all changed-file lint, ratchets, Doctor contracts, boundaries and dead-export scans. Final realtime handler/lifecycle rerun: 60 tests passed.
  • Stored-data compatibility: the base-to-head diff is empty for src/types.ts (including CallRecordSchema), src/manager/store.ts, and src/config-migration.ts under extensions/voice-call. No SQL schema, migration identity, or migration executor changes. Doctor edits only replace description dispatch; setup edits retain the existing config migration owner and cloned output. The passing full suite includes doctor-contract-api.test.ts (plugin-local SQLite repair and retained legacy-source behavior), config-migration.test.ts, manager/store.test.ts, and manager.restore.test.ts. Exact config schema/default parity also passed. There is no changed data model requiring a new upgrade migration.
  • Carrier behavior was exercised at HTTP/webhook and stream boundaries; no live PSTN calls were placed.
Full coverage log: every production file over 200 lines
File (under extensions/voice-call) Before → after Coverage and disposition
src/webhook/realtime-handler.ts 2,210 → 2,109 READ — collapse transcript adoption/cleanup wrappers and unified final transcript persistence; retain ownership, cancellation, replacement, settling and durability checks.
src/webhook.ts 1,082 → 1,047 READ — one Twilio response envelope, direct response projection and one upgrade URL parse; retain signature admission, replay reservation, number ownership and shutdown barriers.
src/media-stream.ts 862 → 851 READ — one upgrade reservation disposer, direct playback settlement functions, inline sole Talk factory; retain caps, FIFO cancellation and mark acknowledgments.
src/config.ts 812 → 771 READ — derive seven nested defaults from field schemas, remove duplicate normalization and routing; retain every config shape and default-sharing contract.
src/webhook-security.ts 775 → 775 READ — retain exact carrier signature algorithms, canonical replay keys, URL variants and forwarding trust rules; no sound structural reduction without changing security behavior.
src/providers/twilio.ts 756 → 702 READ — configured shared carrier transport and SDK synthesis timeout owner; retain one-shot TwiML, stream token and media lifecycles.
index.ts 629 → 620 READ — share tool initiation input; preserve lifecycle generation fencing, RPC scopes, error precedence and trusted caller identity.
src/manager/outbound.ts 626 → 591 READ — remove mirrored context and lookup-result types; retain admission, persistence and all call-control transitions.
src/providers/plivo.ts 581 → 545 READ — shared carrier API and XML envelope; retain request UUID aliases and original transfer failure ordering.
src/manager.ts 568 → 534 READ — direct configuration ownership and one ordered restore-summary emitter; retain restore verification, draining and call work tracking.
src/runtime.ts 554 → 530 READ — inline single-use resource lifecycle factory; retain idempotent stop, complete cleanup, lazy providers and consult authority.
src/cli.ts 508 → 501 READ — common Gateway/standalone action owner and combined dry-run reporting; retain all options, descriptions, output and interruption handling.
src/response-generator.ts 498 → 471 READ — unified spoken JSON/plain extraction and direct early-delivery callback; retain prompts, model locks, sessions and flush ordering.
src/manager/events.ts 450 → 402 READ — inline one-use admission helpers into the mutation queue and remove duplicate context projections; retain persistence-before-publication and replay ownership.
src/manager/store.ts 391 → 391 READ — retain chunking, corruption handling, retained-event order and publication rules; these are independently tested persistence contracts.
src/providers/telnyx.ts 364 → 324 READ — shared carrier API/status lifecycle, direct hangup mapping; retain call-control payloads, streaming fields and signature verification.
src/webhook/realtime-audio-pacer.ts 349 → 336 READ — one queue reset owner and direct mark/queue handling; retain receipt accounting, retention and pacing.
src/cli-gateway-call.ts 289 → 289 READ — retain credential/transport distinctions, redaction, deadline-limited polling and standalone fallback; these are separate user-visible failure contracts.
src/tunnel.ts 258 → 239 READ — first qualifying ngrok log settles readiness directly and close uses existing rejection owner; retain bounded logs and process reap/escalation.
src/cli-call-log.ts 237 → 237 READ — retain bounded custom-log scanning, rotation/truncation handling, output backpressure and SQLite history semantics; no safe removal of either supported input mode.
src/types.ts 224 → 224 READ — schemas own persisted call validation and event/wire types; all remaining contracts are used.

All smaller production files were also read. Larger reductions were rejected where they changed callback identity, exception propagation, transfer-error ordering, pacing/receipt accounting, or lifecycle authority. The exact signature implementation, record store, and persisted schemas remain unchanged.

Consolidate carrier request and status configuration behind the existing
provider contract. Remove redundant transcript, call-manager, runtime, CLI,
and configuration plumbing while preserving carrier wire formats, webhook
verification/replay, call ownership, persisted records, and public surfaces.

Remove 546 net production TypeScript lines (15,786 to 15,240; 3.46%).
Retain the contract-bearing paths after full subsystem coverage.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 channel: voice-call Channel integration: voice-call size: XL labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 10:44 PM ET / October 5, 2026, 02:44 UTC (Revision 2).

ClawSweeper review

What this changes

The PR consolidates Voice Call carrier requests, configuration defaults, transcript persistence, playback cleanup, and CLI plumbing while preserving existing behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

The earlier stored-data compatibility blocker is resolved: source inspection confirms no changed stored-data contract or migration executor. No actionable introduced defect was found, and the refactor remains useful.

Priority: P3
Reviewed head: f91e40a1a3a57b12ed3f0385f03882ce75ed1bfd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful consolidation with preserved contracts, substantial reported validation, and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author qualifies for the trusted-author exemption. Reported HTTP/webhook and stream-boundary validation is supplemental; no live PSTN call is claimed. Independent source review establishes that no stored-data contract changes, so the earlier migration-proof blocker does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author qualifies for the trusted-author exemption. Reported HTTP/webhook and stream-boundary validation is supplemental; no live PSTN call is claimed. Independent source review establishes that no stored-data contract changes, so the earlier migration-proof blocker does not apply.
Evidence reviewed 9 items Stored-data owners are unchanged: The pinned introduced diff is empty for the call-record schema, SQLite record store, and legacy-config migration owner. Reading those owners confirms unchanged serialized fields, storage namespaces, chunk encoding, and migration rules.
Doctor descriptions preserve migration execution: The switch becomes an exhaustive description table with the same strings. Migration identity, detection, repair execution, warnings, and retained-state handling remain unchanged.
Setup retains its migration owner: Setup still calls the existing legacy-config migration, clones plugin configuration, retains entry settings, and replaces only the migrated config. Configuration defaults are derived from the same field defaults; no option or default value is added.
Findings None None.
Security None None.

How this fits together

Voice Call connects OpenClaw agents to telephone carriers. It turns CLI, tool, and webhook inputs into call controls, spoken responses, and persisted call history.

flowchart TD
  A[CLI and agent tools] --> C[Voice Call manager]
  B[Carrier webhooks] --> C
  C --> D[Carrier request adapter]
  D --> E[Telephone carriers]
  C --> F[SQLite call history]
  E --> G[Audio and transcripts]
  G --> C
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -546, Tests +12, Other -1. Total -535 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 27 692 1238 -546
Tests 1 13 1 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 3 -1
Total 29 707 1242 -535

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/voice-call/doctor-contract-api.ts, migration/backfill/repair: extensions/voice-call/setup-api.ts, unknown-data-model-change: extensions/voice-call/doctor-contract-api.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one carrier transport owner and the existing persistence and migration contracts, without adding a migration for this refactor.

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

Not applicable: this is a behavior-preserving refactor, and source inspection found no introduced bug requiring reproduction.

Is this the best way to solve the issue?

Yes: consolidating private carrier and lifecycle plumbing is a focused maintenance path, and the inspected diff preserves the existing public and stored-data contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal maintenance with no intended user-visible behavior, configuration, or stored-data change.
  • 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 verified repository-admin author qualifies for the trusted-author exemption. Reported HTTP/webhook and stream-boundary validation is supplemental; no live PSTN call is claimed. Independent source review establishes that no stored-data contract changes, so the earlier migration-proof blocker does not apply.

Evidence

What I checked:

  • Stored-data owners are unchanged: The pinned introduced diff is empty for the call-record schema, SQLite record store, and legacy-config migration owner. Reading those owners confirms unchanged serialized fields, storage namespaces, chunk encoding, and migration rules. (extensions/voice-call/src/types.ts:82, f91e40a1a3a5)
  • Doctor descriptions preserve migration execution: The switch becomes an exhaustive description table with the same strings. Migration identity, detection, repair execution, warnings, and retained-state handling remain unchanged. (extensions/voice-call/doctor-contract-api.ts:50, f91e40a1a3a5)
  • Setup retains its migration owner: Setup still calls the existing legacy-config migration, clones plugin configuration, retains entry settings, and replaces only the migrated config. Configuration defaults are derived from the same field defaults; no option or default value is added. (extensions/voice-call/setup-api.ts:15, f91e40a1a3a5)
  • Three-way merge preserves stored-data owners: Raw test-merge parent records match the pinned base followed by the exact PR head. Comparing that merge result with its main parent also produces no changes to the schema, store, or config-migration owner. (extensions/voice-call/src/manager/store.ts:1, c5aa5200e1b1)
  • Existing compatibility coverage: Inspected tests cover plugin-local SQLite repair, preserved legacy-source bytes, canonical config precedence, and restoration through a retained state runtime. The captured PR body reports 748 passing tests and exact before/after config parity; these results were not independently rerun during this read-only review. The re-review comment explicitly supplies the compatibility clarification: refactor(voice-call): deslop voice-call #165276 (comment). (extensions/voice-call/src/manager.restore.test.ts:173, f91e40a1a3a5)
  • Security and public boundaries retained: The shared carrier adapter retains guarded HTTP requests, carrier-specific credentials and content types, host restrictions, error handling, and recovery status semantics. The provider contract, public barrel, manifest, and package metadata have no introduced changes. The refactor does not materially change authorization or final-effect reachability. (extensions/voice-call/src/providers/shared/carrier-api.ts:6, f91e40a1a3a5)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: 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-10-05T02:29:39.914Z sha f91e40a :: blocked before merge. :: none

@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The Evidence section now explicitly records stored-data compatibility for this head. CallRecordSchema, the call-record store, and the config migration owner have no base-to-head changes; no SQL schema, migration identity, or executor changes. The full passing voice-call suite includes Doctor SQLite repair/legacy-source, config migration, persistence, and restore tests, and the before/after config-schema/default-sharing comparison passed. Please reconcile the filename-based data-model blocker with that evidence and the review's finding that no stored-data contract changed.

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 94f1e93 into main Oct 5, 2026
127 checks passed
@steipete
steipete deleted the deslop/fd5-voice-call-20261004-a branch October 5, 2026 03:33
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
Consolidate carrier request and status configuration behind the existing
provider contract. Remove redundant transcript, call-manager, runtime, CLI,
and configuration plumbing while preserving carrier wire formats, webhook
verification/replay, call ownership, persisted records, and public surfaces.

Remove 546 net production TypeScript lines (15,786 to 15,240; 3.46%).
Retain the contract-bearing paths after full subsystem coverage.
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

1 participant