Skip to content

refactor(voice-call): share call-history encoding and provider policy - #145661

Merged
steipete merged 1 commit into
mainfrom
codex/voice-call-persistence-owner
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/voice-call-persistence-owner

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #145047, #145382

What Problem This Solves

Voice Call's runtime persistence and Doctor migration duplicated call-record serialization and chunk construction. Provider code also repeated Plivo parameter ordering and retained an unwritten Twilio notification set.

Why This Change Was Made

Runtime and Doctor now share the record encoder, chunk keys, and row types. Snapshot capture still completes before the first await, chunk writes finish before metadata publication, and pruning remains ordered afterward. Doctor materializes every chunk before selecting migration capacity. Plivo uses one parameter-ordering implementation, and Twilio consumes the concrete media-send result.

This preserves #145382's already-landed admission guard, asynchronous provider cleanup, and fixture ownership. The retained regression covers two admissions waiting on persistence before either bridge exists; it uses the existing lifecycle helper. No production race fix or duplicate fixture is added here.

User Impact

No intended behavior change. Existing call-history bytes, migration ordering, and provider policy remain compatible. Coverage now also protects the concurrent-admission case fixed upstream.

The refreshed patch removes 101 production code lines and adds 264 test/support lines: +163 maintained code lines overall. The previously reviewed candidate was +178; its superseded race guard and fixture extraction are excluded from this PR and receive no new credit.

Evidence

At base 6678f6174b336fb5df22b661ab6e6cba0524bc9a, 217 tests passed across 11 focused Voice suites, including the current lifecycle and transcript-persistence tests. Formatting and whitespace checks passed. Fresh P2 review passed with no findings. PR-head CI remains pending.

Retained proof for the earlier 9252b591 candidate includes a full build, complete changed-file gate, nine-case/18-operation raw SQLite parity, and an installed update from published [email protected] to candidate 2026.9.4. The installed proof checked all 27 non-dependency package files and separately verified old and candidate Doctor migrations, exact selected module/root/boundary, loader/file hashes, three chunks, 120,390 payload bytes, metadata, and archived input.

That wrapper run exited 1 on an obsolete observer cache field after the product steps. Independent immutable-archive reconciliation passed; the original failure remains recorded. Those artifacts retain their original source/package identity and are not presented as a build or installed run of this newer base. The task-owned Testbox was stopped and confirmed completed. No carrier calls or live Gateway execution are claimed.

A bounded source preflight against main 3f0b8a175098c19f1a89d39e8649f8f82d54da1b found unchanged Voice source, direct persistence/Doctor contracts, and package inputs; the accepted patch still applies. Later plugin-update changes are outside the retained artifact identity.

Reuse one call-record encoder for runtime persistence and Doctor while preserving snapshot-before-await and ordered chunk publication. Consolidate Plivo parameter ordering and consume Twilio media-send results.

Retain the distinct concurrent-admission regression on the upstream lifecycle fixture without duplicating the race fix already landed in #145382.

Validation: 217 focused tests across 11 Voice suites, formatting and diff checks, and clean P2 review.
@clawsweeper

clawsweeper Bot commented Sep 12, 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: XL maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 05:49
@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 Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 1:56 AM ET / 05:56 UTC.

ClawSweeper review

What this changes

Voice Call shares call-history encoding between runtime persistence and Doctor, consolidates Plivo signature formatting, removes unused Twilio state, and strengthens boundary tests.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored refactor remains distinct from the merged lifecycle work. Source review found no introduced blocking defect.

Priority: P3
Reviewed head: 650f8a81e79c9ca9ac721cfa3cc21cb716021ab1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused production simplification with useful boundary coverage and no blocking source-review findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored refactor. Retained SQLite and installed-Doctor evidence identifies an earlier candidate, not this head; the diff preserves those storage contracts and does not materially change authority.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored refactor. Retained SQLite and installed-Doctor evidence identifies an earlier candidate, not this head; the diff preserves those storage contracts and does not materially change authority.
Evidence reviewed 8 items Introduced scope and clean checkout: Reviewed the pinned merge-base-to-head changes rather than endpoint drift. Whitespace validation passed and the checkout remained clean.
Storage compatibility: The shared encoder preserves serialization, truncation, chunk sizes and row shapes. Runtime captures bytes before awaiting writes and publishes metadata last; Doctor materializes chunks before capacity selection. No schema, retention, store routing or migration-order change was introduced.
Provider policy equivalence: Plivo retains the same sorting, delimiters, HMAC input and replay-key input. Twilio's removed notification set has no production writer at the merge base, and the installed media handler already returns a concrete sent result.
Findings None None.
Security None None.

How this fits together

The Voice Call plugin connects carrier webhooks and audio streams to OpenClaw calls. Its persistence layer saves call history in SQLite, while provider adapters verify callbacks and control audio playback.

flowchart TD
  A[Call updates] --> B[Shared record encoder]
  C[Doctor legacy import] --> B
  B --> D[SQLite chunks then metadata]
  E[Carrier callbacks] --> F[Signature and replay checks]
  F --> A
  A --> G[Twilio audio playback]
Loading

Before merge

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

Security

None.

PR surface

Source -115, Tests +248, Docs +3, Other -1. Total +135 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 5 56 171 -115
Tests 9 804 556 +248
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 16 863 728 +135

Review metrics

Metric Value Why it matters
Production versus test maintenance production -115 lines; tests/support +248 lines The pinned diff reduces production duplication while investing in boundary coverage; these measured deltas differ from the PR body's earlier totals.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/voice-call/doctor-contract-api.ts, serialized state: extensions/voice-call/doctor-contract-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 plugin-owned encoder and provider policy implementation while preserving existing record bytes, publication ordering and playback contracts.

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

Not applicable: the PR proposes consolidation without an intended behavior change; its added failure scenarios were reviewed in source but not executed here.

Is this the best way to solve the issue?

Yes: sharing the existing encoder and removing unreachable provider policy reduces competing implementations without changing public APIs or persisted formats.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is behavior-preserving cleanup with regression coverage and no established urgent user-facing defect.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored refactor. Retained SQLite and installed-Doctor evidence identifies an earlier candidate, not this head; the diff preserves those storage contracts and does not materially change authority.

Label justifications:

  • P3: This is behavior-preserving cleanup with regression coverage and no established urgent user-facing defect.
  • 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 ordinary external-contributor proof gate does not apply to this MEMBER-authored refactor. Retained SQLite and installed-Doctor evidence identifies an earlier candidate, not this head; the diff preserves those storage contracts and does not materially change authority.

Evidence

What I checked:

  • Introduced scope and clean checkout: Reviewed the pinned merge-base-to-head changes rather than endpoint drift. Whitespace validation passed and the checkout remained clean. (650f8a81e79c)
  • Storage compatibility: The shared encoder preserves serialization, truncation, chunk sizes and row shapes. Runtime captures bytes before awaiting writes and publishes metadata last; Doctor materializes chunks before capacity selection. No schema, retention, store routing or migration-order change was introduced. (extensions/voice-call/src/manager/store.ts:223, 650f8a81e79c)
  • Provider policy equivalence: Plivo retains the same sorting, delimiters, HMAC input and replay-key input. Twilio's removed notification set has no production writer at the merge base, and the installed media handler already returns a concrete sent result. (extensions/voice-call/src/webhook-security.ts:705, 650f8a81e79c)
  • Boundary coverage: Added coverage checks partial SQLite writes and retry, real loopback stream playback and cancellation, and signed Plivo callbacks including rejection before event processing. The concurrent-admission test exercises the existing upstream guard; this branch does not introduce that production fix. Tests were inspected, not executed during this read-only review. (extensions/voice-call/src/webhook/realtime-handler.admission.test.ts:15, 650f8a81e79c)
  • Still distinct on current main: Fetched main still contains Doctor's separate prepareChunks implementation and Twilio's unused notification set. The merged related PRs provide lifecycle groundwork rather than this consolidation. (extensions/voice-call/doctor-contract-api.ts:181, 785266d3af19)
  • Latest release comparison: The latest supplied release, v2026.9.4, also retains Doctor's separate prepareChunks implementation. GitHub contents inspection succeeded after local historical blob retrieval failed. (extensions/voice-call/doctor-contract-api.ts:181, 3a9d69db306c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

@steipete
steipete merged commit ee38029 into main Sep 12, 2026
219 checks passed
@steipete
steipete deleted the codex/voice-call-persistence-owner branch September 12, 2026 07:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…openclaw#145661)

Reuse one call-record encoder for runtime persistence and Doctor while preserving snapshot-before-await and ordered chunk publication. Consolidate Plivo parameter ordering and consume Twilio media-send results.

Retain the distinct concurrent-admission regression on the upstream lifecycle fixture without duplicating the race fix already landed in openclaw#145382.

Validation: 217 focused tests across 11 Voice suites, formatting and diff checks, and clean P2 review.
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 maintainer Maintainer-authored PR 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