Skip to content

fix(voice-call): stream diagnostic logs with backpressure - #134838

Merged
steipete merged 2 commits into
mainfrom
codex/voice-log-stream-owner
Sep 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/voice-log-stream-owner

Conversation

@steipete

@steipete steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Replaces #111759 with a shared streaming implementation for Voice Call diagnostics. Custom JSONL tailing and latency analysis currently read whole files or appended regions into memory, and tailing keeps writing when stdout is blocked. SQLite tailing also retains every serialized snapshot for the process lifetime and unexpectedly backfills old history after --since 0 or --since 1.

Why This Change Was Made

One descriptor/range reader now owns complete-line framing, initial history selection, partial records, file replacement, observed truncation, and descriptor cleanup. Tail reads and writes 64 KiB chunks and awaits stdout drain. Latency parses selected records individually, preserving requested history, normal JSON semantics, malformed-record skipping, and a final unterminated JSON record. No arbitrary byte window or record-size cap is introduced.

The SQLite tail loop primes deduplication from the existing retained history while printing only the requested initial records, then replaces the seen set with each retained snapshot. This changes ephemeral CLI state only: no schema, persistence, retention, configuration, dependency, or SDK change.

User Impact

Slow consumers no longer cause the CLI to queue the rest of a large append, rotation starts a fresh stream, and --since 0 follows new snapshots without replaying old history. Documentation now distinguishes the default SQLite store from explicit custom JSONL diagnostics. Thanks @sunlit-deng for the original work and report.

Evidence

  • Failure-first owner tests reproduced whole-file reads, append-sized allocations, replacement corruption, ignored output backpressure, and lifetime deduplication. Real-store/registered-command regressions separately reproduced the incorrect --since 0 and --since 1 startup behavior.
  • Final owner/store cohort: 19 passed; unchanged CLI sibling cohort: 22 passed. Existing short-read, copytruncate, partial-startup and UTF-8 controls remain unchanged and pass.
  • Actual registered CLI with a real paused stdout pipe: the same 8,481,706-byte append produced exactly 8,481,717 output bytes before and after. Queued stdout fell from 4,242,477 to 66,207 bytes. Exact output hashes matched, source stayed unchanged during each run, and all owned processes and fixture state were cleaned up. This pressure proof preceded the final type-safe ring iteration cleanup; final-source history ordering was then checked separately. This is synthetic local CLI proof, not a carrier call or measured OOM.
  • Codex autoreview: no actionable findings at the default blocking threshold. The full changed-file gate passed on the final source, including production and test types, lint, and all selected architecture guards. A final real registered-CLI probe also verified exact UTF-8 output and history order for wrapped and non-wrapped requested history, with complete child cleanup.

Production +144/-88 (net +56), tests +268, docs net +13. The shared reader removes duplicate whole-file/append decoding and nested tail wrappers; the remaining growth owns bounded range reads, file identity, and output backpressure. The original proposal added 214 production lines.

Latency memory still scales with the largest selected JSON record plus requested metric samples. Concurrent in-place rewrites are not atomic snapshots: inode replacement and observed shrink reset the stream, but an undetected same-inode truncate/regrow between polls cannot be inferred.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: voice-call Channel integration: voice-call size: L maintainer Maintainer-authored PR labels Sep 1, 2026
@steipete
steipete marked this pull request as ready for review September 1, 2026 04:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 1:19 AM ET / 05:19 UTC.

ClawSweeper review

What this changes

This PR streams custom Voice Call diagnostic JSONL in bounded chunks with stdout backpressure, corrects SQLite tail startup history, and updates the related documentation and regression coverage.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer review: current main still performs the unbounded custom-log reads, the prior documentation finding is addressed, and no blocking introduced defect was found in the reviewed patch.

Priority: P2
Reviewed head: d2f3e649f05cf9303dbed8141e04e75f8372a6ce

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has coherent ownership, focused regression coverage, and supplied runtime evidence; the remaining gate is exact-head CI and maintainer review.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless supplies registered-CLI paused-pipe evidence for the changed diagnostic owner.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless supplies registered-CLI paused-pipe evidence for the changed diagnostic owner.
Evidence reviewed 7 items Introduced streaming owner: The introduced custom-file path reads framed byte ranges and awaits stdout drain before advancing, replacing the prior whole-file and append-sized allocations.
Persistence boundary: The default command path obtains retained call records from the Voice Call store; custom existing files alone use the range reader, preserving the SQLite-owned default.
Current-main necessity: Current main still reads the entire custom JSONL file for latency and allocates the full appended range while tailing, so the central problem is not already solved there.
Findings None None.
Security None None.

How this fits together

Voice Call’s diagnostic CLI reads either the plugin’s persisted call history or an explicitly supplied JSONL file. It emits records to an operator pipe and computes latency summaries without changing live call delivery.

flowchart LR
A[Voice Call CLI] --> B{Default history or custom log}
B -->|Default| C[SQLite call history]
B -->|Custom file| D[Chunked JSONL reader]
C --> E[Diagnostic output]
D --> E
E --> F[Operator pipe or terminal]
Loading

Before merge

  • Resolve merge risk (P1) - The exact-head required check set is still in progress, so landing must wait for its terminal result.
  • Complete next step (P2) - No repair lane is needed: this is an active maintainer-authored PR with no supported correctness finding; await exact-head CI and normal owner review.
Agent review details

Security

None.

PR surface

Source +56, Tests +268, Docs +13. Total +337 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 144 88 +56
Tests 2 268 0 +268
Docs 2 21 8 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 433 96 +337

Review metrics

Metric Value Why it matters
Production versus test delta production +56, tests +268, docs +13 The production growth is concentrated in one local range/framing and backpressure owner that replaces the prior whole-buffer paths; tests cover its failure modes.

Root-cause cluster

Relationship: canonical
Canonical: #134838
Summary: This PR explicitly replaces the earlier custom-log bounded-read proposal with a shared streaming implementation that also covers pipe backpressure and SQLite startup history.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared reader and SQLite-tail repair, then land after exact-head checks complete and a Voice Call owner approves the implementation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared reader and SQLite-tail repair, then land after exact-head checks complete and a Voice Call owner approves the implementation.

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

Yes—current-main source has the whole-file and append-sized allocation paths, and the PR supplies registered-CLI pressure evidence for the repaired behavior; this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes—the single custom-log range/framing owner serves both tail and latency while preserving SQLite as the default history owner, avoiding duplicate streaming implementations.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs diagnostic CLI memory and pipe-handling behavior with limited blast radius and no change to live calling.
  • 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: Repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless supplies registered-CLI paused-pipe evidence for the changed diagnostic owner.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 75fcaba adds extensions/voice-call/src/cli-call-log.ts:3 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 75fcaba9191e; files: extensions/voice-call/src/cli-call-log.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the exact-head required checks to finish, then obtain Voice Call owner approval.

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-09-01T05:06:52.145Z sha 70d6fb6 :: found issues before merge. :: [P3] Correct the subcommand table's storage description

@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review's documentation finding and rank-up move in d2f3e64: both subcommand summaries now describe persisted call history and explicit custom JSONL logs. Runtime and tests are unchanged from the reviewed and green head.

The production delta remains +56. This is the one shared range/framing owner for both diagnostic commands; it replaces the duplicated whole-file/append allocation paths and owns descriptor cleanup and stdout backpressure. No parallel diagnostic path or arbitrary record-size limit was added. The paused-pipe proof preserves exact output while reducing queued bytes from 4,242,477 to 66,207. I accept this bounded growth for those ownership and streaming guarantees.

@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

The final head d2f3e64 now has green exact-head CI: https://github.com/openclaw/openclaw/actions/runs/33472769322. The latest review confirms the documentation correction and finds no actionable defect.

The suggested separate owner approval is not an enforced gate for this bounded diagnostic refactor: the touched paths have no restricted CODEOWNERS entry, and live main rules require the CI gate and linear history, not independent approval. Maintainer review is complete under the requested fix-and-land workflow; the shared-reader growth rationale and real CLI proof are recorded above. Proceeding through native prepare/merge without bypassing checks.

@steipete
steipete merged commit 9607d30 into main Sep 1, 2026
183 checks passed
@steipete
steipete deleted the codex/voice-log-stream-owner branch September 1, 2026 05:30
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix(voice-call): stream diagnostic logs with backpressure

Co-authored-by: sunlit-deng <[email protected]>

* docs(voice-call): align diagnostic command summaries

---------

Co-authored-by: sunlit-deng <[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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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