Repository navigation
fix(logs): report truncated channel tails - #123699
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 2:43 PM ET / 18:43 UTC. ClawSweeper reviewWhat this changesThe PR adds the bounded log-tail truncation result to Merge readinessKeep open: current main drops a reader-owned truncation signal, while this focused patch forwards it to terminal and JSON consumers with direct CLI proof. Likely related people: Shakker (current implementation, high confidence) and Peter Steinberger (recent channel-log work, medium confidence). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe channel-log command filters a bounded, redacted gateway-log tail and renders it for operators. The shared reader decides whether records were omitted; this patch exposes that decision in command output. flowchart LR
A[Gateway log file] --> B[Bounded redacted tail reader]
B --> C[Channel filter]
C --> D[Truncation result]
D --> E[Terminal output]
D --> F[JSON output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +16. Total +19 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single reader-owned truncation fact, confirm additive JSON compatibility, and land the two output projections without adding another reader or policy path. Do we have a high-confidence way to reproduce the issue? Yes. The PR body records a redacted exact-head CLI run with an oversized log, showing an unqualified empty result on current main and the warning plus Is this the best way to solve the issue? Yes. The reader already owns the aggregate omission decision, and sibling log surfaces expose it; forwarding that fact is the narrowest maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4324ba2f484b. 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 (7 earlier review cycles)
|
Punchcard-Session: golden-timber-willow-68
e0797f6 to
c3f1684
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The PR body now includes the requested additive-JSON compatibility check: code-graph inbound tracing and repository-wide searches found no internal or documented strict consumer of |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
Punchcard-Session: golden-timber-willow-68
This PR does not close an issue.
What Problem This Solves
Fixes an issue where operators running
openclaw channels logscould seeNo matching log lines.even when the bounded tail read had omitted earlier matching records. JSON output also dropped the existing truncation fact, so consumers could not distinguish a complete empty result from an incomplete tail.Why This Change Was Made
The shared
readConfiguredParsedLogTailowner already records one aggregatetruncatedboolean for byte-window or line-limit omission while preserving filtering and redaction. This rewrite keeps that canonical path, always adds the boolean to JSON output, and prints one generic text warning before the empty-result return. It does not add a second reader, fallback, or cause-specific flags.User Impact
Operators and JSON consumers can now tell when channel-log output is incomplete. An oversized file that hides every matching record reports truncation instead of presenting an unqualified empty result.
Evidence
Direct real CLI before/after
Blacksmith Testbox
tbx_01m0js30xqatazdh7r88qr08tf, run https://github.com/openclaw/openclaw/actions/runs/32513214467, exercised the actual built CLI path with an isolated state/config and a log larger than the 1,000,000-byte tail window.For the before case, the task-owned synced checkout used the exact
src/commands/channels/logs.tsfrom livemainee79b0a49ae4b0ecd30f9e483c70c0f49f20232c;src/logging/log-tail.tsandsrc/cli/channels-cli.tswere byte-identical between that main SHA and the PR head. Each variant was built throughpnpm openclaw --version, then invoked throughnode openclaw.mjs channels logs --channel slackand its--jsonform. The fixture and paths were redacted.Current-main command surface:
{ "file": "<isolated>/pre/openclaw.log", "channel": "slack", "lines": [] }Exact head
c3f1684f0862a0b102bb662ef6bad03c609aa0ee:{ "file": "<isolated>/post/openclaw.log", "channel": "slack", "truncated": true, "lines": [] }Assertions passed: main had an unqualified empty result, no warning, and no
truncatedfield; exact head emitted the warning and returnedtruncated: truewith an empty result.Additive JSON compatibility
channelsLogsCommandreaches onlyregisterChannelsCliand the root CLI registrar; there is no in-repo response consumer.channels logs --json,channelsLogsCommand, and JSON parsing/strict-shape validation found no script, application, plugin, or test that parses this command's response. The only non-command references are the CLI registration tests anddocs/cli/channels.md.--jsonoption but does not publish a closed response schema. The existing object remains{ file, channel, lines }compatible for field-selecting consumers and adds the reader-owned boolean as one optional-to-consume property."truncated": true; no existing field was removed, renamed, or changed.Tests and review
src/commands/channels.logs.test.tspassed 15/15 on the exact head.src/logging/log-tail.test.tsandsrc/logging/log-tail-redaction.test.tspassed 19/19.git diff --check, core typecheck, repository guards, and the native state schema guard passed..agents/skills/autoreview/scripts/autoreview --mode branch --base ee79b0a49ae4b0ecd30f9e483c70c0f49f20232c --max-priority P1 --stream-engine-outputran with TruffleHog 3.97.0; credential scan clean; no accepted/actionable P0/P1 findings; patch correctness confidence 0.98.+5/-2(net+3) for the JSON field and operator warning; tests+16/-0.mainadvanced tocddc1acdf7f9f2d60de89a5b700fb0261a5dcb6aafter the proof; GitHub compare showed no changes tosrc/commands/channels/logs.ts,src/logging/log-tail.ts, orsrc/cli/channels-cli.tsacross that advance.Production growth is the two required output projections of the existing reader-owned fact; there is no duplicate policy or new reader to remove.
Punchcard-Session: golden-timber-willow-68
Punchcard-Session: silver-harbor-harbor-e8