Skip to content

fix(voice-call): bound replay memory during long-running calls - #117437

Merged
vincentkoc merged 6 commits into
mainfrom
fix/voice-call-replay-bounds-20260801
Aug 1, 2026
Merged

vincentkoc merged 6 commits into
mainfrom
fix/voice-call-replay-bounds-20260801

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Related: #116201

What Problem This Solves

Fixes an issue where long-running voice-call managers could retain processed
event IDs and rejected inbound-call reservations without a bound. Persisted
per-call replay histories could also grow indefinitely across restarts.

Why This Change Was Made

Adds one voice-call-owned replay-key helper with explicit caps: 10,000 keys for
manager-wide replay ownership, matching the existing voice-call webhook replay
window, and 500 keys per persisted call. Rejected inbound reservations use
generation tokens so a late async failure cannot delete newer ownership, and
restore processes the newest call snapshots before applying the manager cap.

This does not add config, environment variables, storage schemas, provider
behavior, or plugin SDK surface.

User Impact

Long-running voice-call processes and restored calls now have bounded replay
metadata. Events older than the retained replay window may be processed again;
that is the explicit bounded-memory tradeoff.

Evidence

Storage compatibility: there is no schema, version, or serialized shape change.
Existing oversized call records continue to parse and their cache-like replay
identity arrays are normalized to the retained suffix during load and storage;
no migration is required.

* origin/main:
  docs: generate docs map at publish time (#117398)
  refactor(plugins): move plugin contributions into the registry bundle (#117372)
  fix(tui): keep PTY progress and lifecycle truthful (#117402)
  test(xai): type realtime sent item payloads
  fix(qa): preserve Slack fallback evidence (#117420)
  fix(qa): satisfy update lane execution contracts (#117388)
  fix(qa): Matrix replies disappear after final replacement (#117390)
  test(xai): prove rejected tool call continuation
  fix(xai): complete rejected realtime tool calls
  test(xai): add live tool argument probe
  test(xai): cover rejected realtime tool arguments
  fix(xai): validate realtime tool arguments before dispatch
  fix(xai): skip tool call when rawArgs JSON parse fails instead of silently falling back to empty args
@vincentkoc
vincentkoc marked this pull request as ready for review August 1, 2026 14:08
@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 10:17 AM ET / 14:17 UTC.

ClawSweeper review

What this changes

Bounds voice-call manager and persisted per-call replay identifiers so long-running calls cannot retain replay metadata indefinitely.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this maintainer-owned PR open for normal review. Current main has unbounded manager and per-call replay collections, while the branch moves the bounds into the voice-call owner, preserves the asynchronous reject-hangup ownership invariant, and adds focused persistence/restore coverage; no actionable patch defect or security concern was found in the inspected changes.

Priority: P1
Reviewed head: 02c8e76d7f499d84740147eaa0e13b2ea7aa60f3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-bound repair with targeted regression coverage and no actionable review finding in the inspected patch.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to this maintainer-authored internal replay-state repair; the branch supplies focused lifecycle, persistence, and restore tests, while no user-visible carrier or chat flow is changed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to this maintainer-authored internal replay-state repair; the branch supplies focused lifecycle, persistence, and restore tests, while no user-visible carrier or chat flow is changed.
Evidence reviewed 5 items Current-main defect: Current main inserts every committed event identifier into the manager Set and the per-call array without a cardinality bound, so a long-running manager or call can retain replay metadata indefinitely.
Owner-bound repair: The PR centralizes bounded manager and per-call replay-key operations in the voice-call manager helper, including token-checked release of a failed rejected-call reservation.
Persistence and restore coverage: The branch trims oversized stored call replay histories and restores manager keys from the newest retained snapshots; focused tests cover per-call bounds, manager bounds, restore order, and rejected-call ownership.
Findings None None.
Security None None.

How this fits together

Voice-call webhooks enter the voice-call manager, which deduplicates events, may issue an inbound-policy hangup, and persists call snapshots through plugin state. The replay collections protect this event path from duplicates across a running process and after restore, so their ownership and retention directly affect call lifecycle behavior.

flowchart LR
  A[Carrier webhook event] --> B[Voice-call manager]
  B --> C[Replay ownership check]
  C --> D[Inbound policy or call lifecycle]
  D --> E[Persisted call snapshot]
  E --> F[Restart restore]
  F --> C
Loading

Before merge

  • Complete next step (P2) - This is an active maintainer-owned PR with no discrete repair finding; it needs normal owner review rather than an automated replacement or fix lane.
Agent review details

Security

None.

PR surface

Source +102, Tests +223. Total +325 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 123 21 +102
Tests 4 226 3 +223
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 349 24 +325

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: extensions/voice-call/src/manager.restore.test.ts, serialized state: extensions/voice-call/src/manager.ts, serialized state: extensions/voice-call/src/manager/events.test.ts, vector/embedding metadata: extensions/voice-call/src/manager/events.test.ts, vector/embedding metadata: extensions/voice-call/src/manager/store.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116201
Summary: This PR is a focused candidate fix for the replay-ownership slice of the broader bounded-realtime-voice-state issue; the issue retains additional independent resource-bound work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep replay retention owned by the voice-call manager and persisted call snapshot boundary, with the documented bounded-window tradeoff and focused lifecycle/restore regression coverage.

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

Yes, by source inspection: current main appends each committed replay key to unbounded manager and per-call collections in extensions/voice-call/src/manager/events.ts:185 and extensions/voice-call/src/manager/events.ts:237. This read-only review did not execute the focused regression tests.

Is this the best way to solve the issue?

Yes. The branch places the cap at the two replay-state owners, bounds persisted snapshots during storage and restore, and uses reservation tokens so a late failed hangup cannot erase newer ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The PR addresses unbounded replay metadata in long-running voice-call processes, a live channel workflow whose retained state can grow throughout an operator session.
  • 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: Not applicable to this maintainer-authored internal replay-state repair; the branch supplies focused lifecycle, persistence, and restore tests, while no user-visible carrier or chat flow is changed.

Label justifications:

  • P1: The PR addresses unbounded replay metadata in long-running voice-call processes, a live channel workflow whose retained state can grow throughout an operator session.
  • 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: Not applicable to this maintainer-authored internal replay-state repair; the branch supplies focused lifecycle, persistence, and restore tests, while no user-visible carrier or chat flow is changed.

Evidence

What I checked:

  • Current-main defect: Current main inserts every committed event identifier into the manager Set and the per-call array without a cardinality bound, so a long-running manager or call can retain replay metadata indefinitely. (extensions/voice-call/src/manager/events.ts:185, a172857acc75)
  • Owner-bound repair: The PR centralizes bounded manager and per-call replay-key operations in the voice-call manager helper, including token-checked release of a failed rejected-call reservation. (extensions/voice-call/src/manager/replay-keys.ts:28, 02c8e76d7f49)
  • Persistence and restore coverage: The branch trims oversized stored call replay histories and restores manager keys from the newest retained snapshots; focused tests cover per-call bounds, manager bounds, restore order, and rejected-call ownership. (extensions/voice-call/src/manager/store.ts:175, 02c8e76d7f49)
  • Feature provenance: Blame attributes the current unbounded inbound-rejection and replay insertion path to the current-main voice-call implementation introduced in the channel refactor; the PR's bounding changes date to its head-series commit. (extensions/voice-call/src/manager/events.ts:185, edfeec49e7a7)
  • Related canonical work: The linked open issue explicitly scopes several bounded-resource repairs; this PR is a focused candidate for its replay-ownership portion rather than a replacement for the full issue.

Likely related people:

  • steipete: Git blame attributes the current-main inbound rejection and unbounded replay insertion path to Peter Steinberger's voice-call implementation in the channel refactor. (role: current behavior introducer; confidence: high; commits: edfeec49e7a7; files: extensions/voice-call/src/manager/events.ts, extensions/voice-call/src/manager/store.ts, extensions/voice-call/src/manager.ts)

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer owner review complete for exact head 02c8e76d7f499d84740147eaa0e13b2ea7aa60f3.

ClawSweeper's only P2 step is satisfied: the 10,000 manager and 500 per-call replay windows, oldest-entry eviction, and possible replay beyond the retained window are accepted as the explicit bounded-memory policy. The voice-call plugin is the correct owner boundary.

The stored-data flag does not require a migration. This changes no schema, version, or serialized shape; existing oversized rows still parse and cache-like replay identities are normalized to the retained suffix on load and storage.

Native review, 58/58 focused tests, production dead-code checks, exact-head autoreview, and exact-head GitHub CI are green.

@vincentkoc
vincentkoc merged commit 133a8a6 into main Aug 1, 2026
106 of 110 checks passed
@vincentkoc
vincentkoc deleted the fix/voice-call-replay-bounds-20260801 branch August 1, 2026 14:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
…law#117437)

* origin/fix/voice-call-replay-bounds-20260801:
  fix(voice-call): keep replay caps production-owned
  test(voice-call): share replay cap constants
  test(voice-call): assert replay collection bounds
  test(voice-call): cover replay ownership bounds
  fix(voice-call): bound manager replay ownership
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 maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. 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.

1 participant