Repository navigation
fix(voice-call): bound diagnostic JSONL reads to prevent OOM on large logs - #111759
sunlit-deng wants to merge 3 commits into
Conversation
f04505a to
5195abc
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 4:05 AM ET / 08:05 UTC. ClawSweeper reviewWhat this changesThe PR caps custom voice-call diagnostic JSONL reads at 1 MB, follows appended records in 64 KiB chunks, and warns operators when retained history omits data. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readinessKeep open. Current main still reads whole custom diagnostic files, while this PR bounds both startup and follow-mode reads; the latest docs fix the prior filename-sentinel finding and no new blocking correctness defect was found. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe voice-call plugin registers flowchart LR
A[Operator CLI command] --> B[Voice-call diagnostic command]
B --> C{Managed calls.jsonl path?}
C -->|Yes| D[SQLite-backed call history]
C -->|No| E[Custom JSONL reader]
E --> F[Bounded chunk and record handling]
D --> G[CLI JSON or JSONL output]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +214, Tests +293, Docs +13. Total +520 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the documented SQLite/custom-file split and land the bounded reader once the final merge result has green exact-head checks. Do we have a high-confidence way to reproduce the issue? Yes: current main's custom-file path directly performs whole-file and whole-appended-range allocations, and the PR body supplies after-fix terminal traces for a larger-than-1-MB append and partial-record completion. Is this the best way to solve the issue? Yes: bounding reads at the custom-file CLI owner preserves the managed SQLite path and handles partial records, UTF-8, truncation, and replacement files without adding a new configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 876f2de46f1a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (28 earlier review cycles; latest 8 shown)
|
5195abc to
a9a1294
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3129517 to
ea238b2
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a436f88 to
646db9f
Compare
646db9f to
852a9c8
Compare
852a9c8 to
2a2b7c8
Compare
2a2b7c8 to
a9c9ff5
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Superseded by #134838, now landed in 9607d302c6f. Thanks @sunlit-deng for identifying the diagnostic allocation problem; your contribution is credited in the replacement. The shared reader covers custom-log startup and follow reads, partial UTF-8 records, replacement/observed truncation, and stdout backpressure. It preserves requested history instead of introducing the proposed 1 MB history/record cap, so cap-omission warnings are intentionally not carried forward. The same repair also bounds SQLite tail deduplication and fixes initial Proof includes 41 owner/store/CLI cases, failure-first regressions, exact-output real CLI ordering, and a paused stdout pipe: the same 8,481,706-byte append produced identical output while queued bytes fell from 4,242,477 to 66,207. Final CI and independent review passed. This proves the diagnostic allocation/backpressure repair, not a measured OOM or carrier-call result. Closing this older implementation now that the underlying problem is handled by the canonical reader on main. |
What Problem This Solves
openclaw voicecall tail --file <path>bounded its initial JSONL read, but a file growing by more than 1 MB between polls still allocated the entire appended range at once. A partial final JSONL record also needed to survive into the next poll.Why This Change Was Made
The follow path now reads fixed 64 KiB chunks, emits complete records incrementally, and carries one unfinished record as raw bytes between reads, so UTF-8 code points split at a chunk boundary are decoded only after the complete JSONL record arrives. A single record larger than the existing 1 MB diagnostic limit is discarded through its next newline, keeping retained memory bounded. Initial and follow reads identify the file through
fstaton the same descriptor used for reading. When that identity changes, or the same file is truncated, the offset, pending record, and discard state are reset before reading the new contents. The cap applies to existing custom files whose basename is notcalls.jsonl; the managedcalls.jsonlpath continues to use SQLite-backed history.Every capped omission is now visible: a follow-mode record that crosses the 1 MB cap, an initial read that omits older complete records, and an initial read that starts inside a partial record all emit concise stderr warnings while stdout JSONL stays intact. If the initial retained window is still inside an oversized unfinished record, follow mode keeps discarding through that record's next newline before emitting later complete records.
User Impact
Voice-call diagnostics remain responsive when logs grow quickly, without losing ordinary records that cross chunk or poll boundaries or joining a stale partial record to a replacement file. When eligible custom diagnostic history is omitted by the 1 MB retained window, the operator sees a stderr warning instead of silently incomplete output. This intentionally changes eligible custom-file
tailandlatencyfrom full-history reads to the newest 1 MB retained window; the filename-gatedcalls.jsonlSQLite path is unchanged.Evidence
./node_modules/.bin/tsx proof-live.tsregistered the real voice-call CLI, startedtail, appended 1,150,906 bytes after startup, and completed a JSON record in a later poll../node_modules/.bin/tsx proof-rotation.tsran the same production CLI, atomically renamed a larger replacement over a file containing an unfinished record, and emitted only the old complete record plus the new file's record../node_modules/.bin/tsx proof-utf8.tsplaced the first byte of中at offset 65,535 of the follow window and verified the production CLI emitted the exact original text after two bounded reads../node_modules/.bin/tsx proof-cap-warning.tsran the same production CLI against a >1 MB follow record and against a file whose last 1 MB starts mid-record; stdout remained valid JSONL and stderr carried exactly one warning per omission path../node_modules/.bin/tsx proof-initial-window.tsran the same production CLI at8c23fcc4858b8beef166ed782a3123c5f8fbd288; a record-boundary cutoff warned about omitted complete history, and an unfinished oversized initial record was discarded through its later newline without emitting its suffix.node scripts/run-vitest.mjs extensions/voice-call/src/cli.test.ts: 21 tests passed, including the >1 MB append, larger replacement identity, split UTF-8, record-boundary omission warning, initial oversized-record discard, and stderr omission-warning regressions.pnpm run lint:plugins:no-extension-test-core-imports,pnpm run test:extensions:package-boundary:compile, andnode scripts/report-test-temp-creations.mjs --base 98b222ded8a003a5376c06158d889adf4d8f7f16 --head HEAD --fail-on-findings: passed.pnpm docs:list: passed.proof-live.ts
proof-rotation.ts
proof-utf8.ts
proof-cap-warning.ts
proof-initial-window.ts
AI-assisted: built with Codex