fix(cli): preserve first line of channels logs at window boundary#84106
Conversation
readTailLines in src/commands/channels/logs.ts unconditionally dropped the first line of the read window whenever start > 0, even when the read happened to align exactly on a line boundary (file[start-1] === '\n'). That silently loses one valid log line every time the rolling tail window happens to land on a newline. readLogSlice in src/logging/log-tail.ts already handles this case by reading a single prefix byte and only slicing the first line when the preceding byte is not a newline. This change mirrors that pattern in readTailLines and adds a regression test that constructs a 2 MB log file of fixed-size lines so the 1 MB window starts exactly on a line boundary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: passed. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR comments provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. PR rating What the crustacean ranks mean
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. PR egg Rarity: 🥚 common. What is this egg doing here?
Real behavior proof Risk before merge Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the narrow prefix-byte guard and regression test through the existing exact-head automerge and required-check gates. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows the unconditional first-line drop, and the PR comments provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Is this the best way to solve the issue? Yes. Mirroring the already-used Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against f07c87405c30. |
…p-first-line # Conflicts: # CHANGELOG.md
Real CLI proof (per ClawSweeper request)Setup: identical 2 MB log file ( Line at index 5000 is BEFORE — published
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper automerge |
|
🦞🧹
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
|
martingarramon
left a comment
There was a problem hiding this comment.
The fix is a correct port of the identical logic already in src/logging/log-tail.ts:114-118,126 (readLogSlice). The PR reads one byte before the window start and only skips the first partial line when that byte is not \n — matching readLogSlice exactly. The test at channels.logs.test.ts:144 reproduces the boundary case from the PR body (2×MAX_BYTES file, window starts on a line boundary) and confirms the first line is no longer dropped.
* feat(ui): tool name style in usage panel (openclaw#84310) Summary: - This PR adds scoped truncation and hover titles to usage-panel context-breakdown names and adds a changelog entry crediting the source PR. - Reproducibility: yes. at source/proof level: current main renders long context names without truncation or t ... he overflow before and ellipsis/tooltip after. I did not run a live browser session in this read-only pass. Automerge notes: - PR branch already contained follow-up commit before automerge: feat(ui): tool name style in usage panel Validation: - ClawSweeper review passed for head 396e405. - Required merge gates passed before the squash merge. Prepared head SHA: 396e405 Review: openclaw#84310 (comment) Co-authored-by: Rain120 <1085131904@qq.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(clawhub): preserve base URL path prefix [AI-assisted] (openclaw#83982) Summary: - The PR updates `src/infra/clawhub.ts` URL joining, adds a path-prefix regression test in `src/infra/clawhub.test.ts`, and adds a changelog bullet. - Reproducibility: yes. Source inspection plus a direct Node URL check show current main drops `/clawhub` when resolving a leading-slash API path against a prefixed base URL. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(clawhub): preserve base URL path prefix [AI-assisted] Validation: - ClawSweeper review passed for head 7bb2cb8. - Required merge gates passed before the squash merge. Prepared head SHA: 7bb2cb8 Review: openclaw#83982 (comment) Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(docker): keep codex plugin in release images Ported from upstream d0f7c8f. Adds OPENCLAW_EXTENSIONS=diagnostics-otel,codex to both amd64 and arm64 Docker release builds and adds regression test. * fix(cli): format acp client errors with formatErrorMessage (openclaw#83904) (openclaw#84080) Summary: - The PR changes `openclaw acp client` error handling to use `formatErrorMessage`, adds a plain-object rejection regression test, and adds a changelog entry. - Reproducibility: yes. Current main visibly sends `openclaw acp client` caught errors through `String(err)`, ... catch already uses `formatErrorMessage`; I did not run a live failing ACP server in this read-only review. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(cli): format acp client errors with formatErrorMessage (openclaw#83904) Validation: - ClawSweeper review passed for head 69ef0e7. - Required merge gates passed before the squash merge. Prepared head SHA: 69ef0e7 Review: openclaw#84080 (comment) Co-authored-by: HCL <chenglunhu@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(cli): preserve first line of channels logs at window boundary (openclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(cli): preserve equals in root option values [AI-assisted] (openclaw#84107) Summary: - This PR updates CLI root option parsing to preserve embedded equals signs, adds focused Vitest coverage for inline and space-separated values, and records the fix in the changelog. - Reproducibility: yes. by source inspection: current main uses `raw.split("=", 2)`, so `--token=abc=def` returns only `abc`; the PR body also supplies after-fix live output for the same path. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(cli): preserve equals in root option values [AI-assisted] Validation: - ClawSweeper review passed for head 8a15801. - Required merge gates passed before the squash merge. Prepared head SHA: 8a15801 Review: openclaw#84107 (comment) Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(cli): reject out-of-range port numbers in parsePort (openclaw#83900) (openclaw#84008) Summary: - The PR adds a 65,535 upper-bound check to the shared CLI `parsePort` helper, a colocated regression test, and a changelog entry for the linked port-range bug. - Reproducibility: yes. Source inspection on current main shows `parsePort('99999')` delegates to `parseStrict ... sitive safe integer, so the return would be `99999`; I did not execute it because this review is read-only. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(cli): reject out-of-range port numbers in parsePort (openclaw#83900) Validation: - ClawSweeper review passed for head 9ad0705. - Required merge gates passed before the squash merge. Prepared head SHA: 9ad0705 Review: openclaw#84008 (comment) Co-authored-by: HCL <chenglunhu@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(agents): ignore duplicate embedded run clears * fix(agents): ignore duplicate embedded run clears * test(agents): fix embedded run clear lint * docs(changelog): note embedded run clear fix --------- Co-authored-by: Galin Iliev <Galin.Iliev@microsoft.com> * fix(config): allow bundled provider timeout overlays (openclaw#83267) * fix config provider timeout overlays Allow bundled model provider config entries to act as overlays so fields like timeoutSeconds can be configured without redeclaring baseUrl and models. Keep unknown custom provider declarations strict, and guard configured-provider fallback against overlay entries without models. * fix(config): include provider aliases in model overlays * fix(config): guard Foundry timeout overlays * fix(config): normalize bundled provider overlays * fix(models): reject overlay-only fallback models * fix(whatsapp): clarify inbound group diagnostics (openclaw#83969) Summary: - The PR updates WhatsApp inbound listener and group-drop diagnostics, adds focused tests, and documents that observed but unregistered groups must be admitted through `channels.whatsapp.groups`. - Reproducibility: yes. from source inspection: current main still emits the DM-only startup log and vague gro ... sions/whatsapp/src/auto-reply/monitor.ts` and `extensions/whatsapp/src/auto-reply/monitor/group-gating.ts`. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(whatsapp): clarify group drop guidance - PR branch already contained follow-up commit before automerge: fix(whatsapp): make inbound diagnostics policy-aware - PR branch already contained follow-up commit before automerge: fix(whatsapp): clarify inbound group diagnostics Validation: - ClawSweeper review passed for head 0da24e3. - Required merge gates passed before the squash merge. Prepared head SHA: 0da24e3 Review: openclaw#83969 (comment) Co-authored-by: Neerav Makwana <261249544+neeravmakwana@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> --------- Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: Rain120 <1085131904@qq.com> Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com> Co-authored-by: hcl <chenglunhu@gmail.com> Co-authored-by: Thomas Krohnfuß <BSG2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Galin Iliev <iliev@galcho.com> Co-authored-by: Galin Iliev <Galin.Iliev@microsoft.com> Co-authored-by: Gio Della-Libera <giodl73@gmail.com> Co-authored-by: Neerav Makwana <261249544+neeravmakwana@users.noreply.github.com>
…4106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312b315e087b501b55cfcc99d20f42ee1173. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312b315e087b501b55cfcc99d20f42ee1173 Review: openclaw/openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…4106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312b315e087b501b55cfcc99d20f42ee1173. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312b315e087b501b55cfcc99d20f42ee1173 Review: openclaw/openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…enclaw#84106) Summary: - The PR updates `openclaw channels logs` tail-window reading to keep a complete first line when the 1 MB window starts on a newline boundary, adds a regression test, and adds a changelog entry. - Reproducibility: yes. Source inspection on current main shows the unconditional first-line drop, and the PR ... s provide terminal before/after CLI output for a 2 MB log whose tail window starts exactly after a newline. Automerge notes: - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'origin/main' into fix/channels-logs-dro… - PR branch already contained follow-up commit before automerge: fix(cli): preserve first line of channels logs at window boundary Validation: - ClawSweeper review passed for head 284b312. - Required merge gates passed before the squash merge. Prepared head SHA: 284b312 Review: openclaw#84106 (comment) Co-authored-by: BSG2000 <bsg2000@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
Summary
readTailLinesinsrc/commands/channels/logs.tssilently drops the first complete line ofopenclaw channels logsoutput whenever the rolling tail window starts exactly on a line boundary (i.e. the byte immediately beforestartis\n).The sister implementation in
src/logging/log-tail.ts(readLogSlice) already handles this correctly — it reads a single prefix byte and only skips the first line when the preceding byte is not a newline. That fix landed in #42904 but was never applied to the parallelreadTailLineshelper.Reproduction (against current
mainand publishedopenclaw@2026.5.12)Build a log file of exactly
2 × MAX_BYTES = 2_000_000bytes made of10_000fixed-size lines (200 bytes each). The 1 MB read window starts at byte1_000_000, which is exactly the byte after the\nof line 4999, so line 5000 should be the first line of the output.Before the fix the line at the window boundary is silently dropped (
4999lines returned instead of5000, first line isfiller-5001instead ofFIRST-LINE-IN-WINDOW). See Real behavior proof below for the full liveopenclaw channels logsruns.Fix
Mirror the proven-correct pattern from
readLogSliceinsrc/logging/log-tail.ts: read one byte atstart - 1and only drop the first line when that byte is not\n.Regression test
Added a new case in
src/commands/channels.logs.test.tsthat constructs a deterministic 2 MB log file of fixed 200-byte JSON log lines, runschannelsLogsCommand, and asserts the line at the window boundary appears andlast-lineis the final entry. The test fails onmainand passes with the fix.Impact
openclaw channels logsoccasionally misses the oldest line of the visible tail. Hard to spot because the tail keeps moving.Scope
readTailLines) + one regression test + one CHANGELOG entry.start === 0or first byte ≠\n).Real behavior proof
Behavior or issue addressed:
openclaw channels logssilently drops one log line from the tail output when the file size is large enough that the rolling 1 MB read window starts exactly on a line boundary (file[start - 1] === '\n').Real environment tested: WSL Ubuntu 24.04, Node 22.x. Tested against the published
openclaw@2026.5.12binary (installed vianpm install openclaw@2026.5.12) for the BEFORE run, and against the locally-built CLI from this PR branch (fix/channels-logs-drop-first-line@3af767a49b) for the AFTER run. Both runs target the same on-disk log file at/tmp/openclaw/openclaw-2026-05-19.logand useOPENCLAW_LOG_LEVEL=silentso the CLI's own startup logging does not append to the file and shift the alignment offset.Exact steps or command run after this patch:
10 000JSON-log lines ×200bytes each), with line index5000set to a recognizable marker (FIRST-LINE-IN-WINDOW) and line9999set toLAST-LINE-MARKER. The byte atsize - 1_000_001is verified to be\nso the 1 MB tail window starts exactly on a line boundary./tmp/openclaw/openclaw-2026-05-19.log).OPENCLAW_LOG_LEVEL=silent openclaw channels logs --channel slack --lines 6000 --jsonagainst the publishedopenclaw@2026.5.12(BEFORE).pnpm run buildand runOPENCLAW_LOG_LEVEL=silent node ./openclaw.mjs channels logs --channel slack --lines 6000 --jsonagainst the same file (AFTER).FIRST-LINE-IN-WINDOWappears.Evidence after fix:
BEFORE — published
openclaw@2026.5.12:AFTER — PR branch
fix/channels-logs-drop-first-line@3af767a49b:Observed result after fix: With the PR applied, the CLI returns the full
5000lines in the read window starting withFIRST-LINE-IN-WINDOW; without the fix it returns4999lines starting withfiller-5001(line5000silently dropped). The unit test added insrc/commands/channels.logs.test.tsreproduces the same byte-perfect alignment viachannelsLogsCommandand asserts the boundary line and last line are both present — it fails onmainand passes on this branch.What was not tested: No interactive/TUI mode of
openclaw channels logswas exercised (the bug lives entirely in the JSON/text shared helper). No real production rolling-log rotation was triggered; the test uses a single hand-crafted log file at the exact byte size required to hit the alignment, since natural log files only hit this edge case occasionally.