Skip to content

fix(logs): report truncated channel tails - #123699

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
masatohoshino:channels-logs-truncation-notice
Aug 21, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
masatohoshino:channels-logs-truncation-notice

Conversation

@masatohoshino

@masatohoshino masatohoshino commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

This PR does not close an issue.

What Problem This Solves

Fixes an issue where operators running openclaw channels logs could see No 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 readConfiguredParsedLogTail owner already records one aggregate truncated boolean 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.ts from live main ee79b0a49ae4b0ecd30f9e483c70c0f49f20232c; src/logging/log-tail.ts and src/cli/channels-cli.ts were byte-identical between that main SHA and the PR head. Each variant was built through pnpm openclaw --version, then invoked through node openclaw.mjs channels logs --channel slack and its --json form. The fixture and paths were redacted.

Current-main command surface:

Log file: <isolated>/pre/openclaw.log
Channel: slack
No matching log lines.
{
  "file": "<isolated>/pre/openclaw.log",
  "channel": "slack",
  "lines": []
}

Exact head c3f1684f0862a0b102bb662ef6bad03c609aa0ee:

Log file: <isolated>/post/openclaw.log
Channel: slack
Log tail truncated; earlier entries were omitted.
No matching log lines.
{
  "file": "<isolated>/post/openclaw.log",
  "channel": "slack",
  "truncated": true,
  "lines": []
}

Assertions passed: main had an unqualified empty result, no warning, and no truncated field; exact head emitted the warning and returned truncated: true with an empty result.

Additive JSON compatibility

  • Code-graph inbound tracing for channelsLogsCommand reaches only registerChannelsCli and the root CLI registrar; there is no in-repo response consumer.
  • Repository searches for 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 and docs/cli/channels.md.
  • The public CLI reference documents the --json option 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.
  • The exact-head direct CLI proof parses the result as JSON and verifies "truncated": true; no existing field was removed, renamed, or changed.

Tests and review

  • Focused regression: src/commands/channels.logs.test.ts passed 15/15 on the exact head.
  • Owner/sibling coverage: src/logging/log-tail.test.ts and src/logging/log-tail-redaction.test.ts passed 19/19.
  • Static proof: targeted Oxfmt, Oxlint, git diff --check, core typecheck, repository guards, and the native state schema guard passed.
  • Exact-head CI: 148 success, 64 skipped, 1 neutral, 0 failed, 0 pending on https://github.com/openclaw/openclaw/actions/runs/32506161472.
  • Fresh autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base ee79b0a49ae4b0ecd30f9e483c70c0f49f20232c --max-priority P1 --stream-engine-output ran with TruffleHog 3.97.0; credential scan clean; no accepted/actionable P0/P1 findings; patch correctness confidence 0.98.
  • LOC split: production +5/-2 (net +3) for the JSON field and operator warning; tests +16/-0.
  • Main drift: live main advanced to cddc1acdf7f9f2d60de89a5b700fb0261a5dcb6a after the proof; GitHub compare showed no changes to src/commands/channels/logs.ts, src/logging/log-tail.ts, or src/cli/channels-cli.ts across 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

@clawsweeper

clawsweeper Bot commented Aug 14, 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 commands Command implementations size: M labels Aug 14, 2026
@masatohoshino
masatohoshino marked this pull request as ready for review August 14, 2026 14:58
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 2:43 PM ET / 18:43 UTC.

ClawSweeper review

What this changes

The PR adds the bounded log-tail truncation result to channels logs JSON and terminal output.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: c3f1684f0862a0b102bb662ef6bad03c609aa0ee

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, behaviorally covered, and supported by direct CLI proof; only routine additive-output compatibility review remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.
Evidence reviewed 8 items Current-main gap: Current main reads only tail.lines, so an empty filtered result has no indication that earlier records were omitted.
Canonical owner: The shared reader already records truncated for byte-window omission and for the post-filter line limit before returning redacted lines.
Entrypoint and sibling behavior: The CLI dispatches to this command, while the gateway log-tail handler already returns the complete reader payload and the general logs CLI surfaces truncation notices.
Findings None None.
Security None None.

Live Verification

Command: node openclaw.mjs channels logs --help

Result: FAIL (partial) — step 2 expect_output Show recent channel logs from the gateway log file: expected terminal output was not visible within 30 seconds: "Show recent channel logs from the gateway log file"

node openclaw.mjs channels logs --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123699-QBjW3S/target$ node openclaw.mjs channels logs --help
file:///tmp/clawsweeper-live-proof-123699-QBjW3S/target/openclaw.mjs:781
      throw new Error(await buildMissingEntryErrorMessage());
            ^

Error: openclaw: missing dist/entry.(m)js (build output).
This install looks like an unbuilt source tree or GitHub source archive.
Build locally with ˋpnpm install && pnpm buildˋ, or install a built package instead.
For pinned GitHub installs, use ˋnpm install -g github:openclaw/openclaw#‹ref›ˋ instead of a raw ˋ/archive/‹ref›.tar.gzˋ URL.
For releases, use ˋnpm install -g openclaw@latestˋ.
    at file:///tmp/clawsweeper-live-proof-123699-QBjW3S/target/openclaw.mjs:781:13

Node.js v24.19.0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123699-QBjW3S/target$ node openclaw.mjs channels logs --help
file:///tmp/clawsweeper-live-proof-123699-QBjW3S/target/openclaw.mjs:781
      throw new Error(await buildMissingEntryErrorMessage());
            ^

Error: openclaw: missing dist/entry.(m)js (build output).
This install looks like an unbuilt source tree or GitHub source archive.
Build locally with ˋpnpm install && pnpm buildˋ, or install a built package instead.
For pinned GitHub installs, use ˋnpm install -g github:openclaw/openclaw#‹ref›ˋ instead of a raw ˋ/archive/‹ref›.tar.gzˋ URL.
For releases, use ˋnpm install -g openclaw@latestˋ.
    at file:///tmp/clawsweeper-live-proof-123699-QBjW3S/target/openclaw.mjs:781:13

Node.js v24.19.0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123699-QBjW3S/target$























Assertions:

  • FAIL expect_output: Show recent channel logs from the gateway log file

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - The JSON field is additive, but strict downstream response-shape validators should be checked before merge.
  • Resolve merge risk (P1) - Production code grows by three net lines; the two required output projections cannot be absorbed into the reader without moving presentation policy into it.
  • Complete next step (P2) - The focused PR has sufficient real-behavior proof and needs normal assigned-maintainer review, not an automated repair.
Agent review details

Security

None.

PR surface

Source +3, Tests +16. Total +19 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 2 +3
Tests 1 16 0 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 2 +19

Review metrics

Metric Value Why it matters
Production versus test delta production +3, tests +16 The production growth is limited to exposing an existing fact in two output modes, while the test covers the omitted-record case.

Stored data model

Persistent data-model change detected: serialized state: src/commands/channels.logs.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm additive JSON compatibility (recommended)
    Verify that documented or internal consumers tolerate the newly present truncated boolean, then merge the focused projection.

Technical review

Best 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 truncated: true after the patch.

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.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Machine-readable command output gains an additive field that strict consumers may validate exactly.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded operator-visible diagnostic gap without affecting delivery or runtime availability.
  • merge-risk: 🚨 compatibility: Machine-readable command output gains an additive field that strict consumers may validate exactly.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies redacted before-and-after output from the built exact-head CLI, demonstrating the observed warning and JSON result.

Evidence

What I checked:

  • Current-main gap: Current main reads only tail.lines, so an empty filtered result has no indication that earlier records were omitted. (src/commands/channels/logs.ts:107, 4324ba2f484b)
  • Canonical owner: The shared reader already records truncated for byte-window omission and for the post-filter line limit before returning redacted lines. (src/logging/log-tail.ts:98, c3f1684f0862)
  • Entrypoint and sibling behavior: The CLI dispatches to this command, while the gateway log-tail handler already returns the complete reader payload and the general logs CLI surfaces truncation notices. (src/cli/channels-cli.ts:258, c3f1684f0862)
  • Regression coverage: The new test writes a log whose matching channel record is outside the one-megabyte tail, then verifies both truncated: true JSON and the terminal warning; it fails on current main because neither projection exists. (src/commands/channels.logs.test.ts:220, c3f1684f0862)
  • History: Blame ties the missing projection and reader-owned truncation behavior to the current implementation carried by a5bac03; adjacent channel-log maintenance includes f59392f. (src/commands/channels/logs.ts:107, a5bac03e514d)
  • Real behavior proof: The PR body provides redacted exact-head Testbox output showing both the warning and truncated: true after an oversized-log fixture omits the matching record. (src/commands/channels/logs.ts:110, c3f1684f0862)

Likely related people:

  • Shakker: Current-main blame covers both the unprojected command result and the shared truncation state. (role: current implementation contributor; confidence: high; commits: a5bac03e514d; files: src/commands/channels/logs.ts, src/logging/log-tail.ts, src/gateway/server-methods/logs.ts)
  • Peter Steinberger: Recent history includes the channel-log filtering and redaction repair adjacent to this output contract. (role: recent area contributor; confidence: medium; commits: f59392fdf5e6; files: src/commands/channels/logs.ts)

Rank-up moves

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

  • Confirm any strict JSON consumers accept the new truncated field.

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 (7 earlier review cycles)
  • reviewed 2026-08-14T14:58:34.550Z sha e0797f690ef0392783644f5644acaef058470306 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T15:04:12.031Z sha e0797f690ef0392783644f5644acaef058470306 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T16:19:34.202Z sha e0797f690ef0392783644f5644acaef058470306 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T18:52:36.235Z sha e0797f690ef0392783644f5644acaef058470306 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-21T15:13:20.320Z sha e0797f690ef0392783644f5644acaef058470306 :: found issues before merge. :: [P1] Rebase onto the canonical redacted tail reader
  • reviewed 2026-08-21T17:09:22.014Z sha c3f1684 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-21T17:52:26.660Z sha c3f1684 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. clawsweeper-recovery-stuck and removed clawsweeper-recovery-stuck labels Aug 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. clawsweeper-recovery-stuck labels Aug 21, 2026
@vincentkoc vincentkoc self-assigned this Aug 21, 2026
Punchcard-Session: golden-timber-willow-68
@vincentkoc
vincentkoc force-pushed the channels-logs-truncation-notice branch from e0797f6 to c3f1684 Compare August 21, 2026 17:03
@vincentkoc vincentkoc changed the title fix(logs): openclaw channels logs never reports a truncated tail fix(logs): report truncated channel tails Aug 21, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 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 exact_review_queue).
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 status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 21, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 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 exact_review_queue).
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 21, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@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 channels logs --json; the public CLI reference publishes the flag but no closed response schema. Please reassess the exact head and its remaining rank-up move.

@clawsweeper

clawsweeper Bot commented Aug 21, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit 87d02a9 into openclaw:main Aug 21, 2026
236 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
Punchcard-Session: golden-timber-willow-68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants