Repository navigation
fix(cli): retry logs.tail after journal fallback in logs follow - #88159
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 10:56 PM ET / 02:56 UTC. Summary PR surface: Source +19, Tests +279, Docs +1. Total +299 across 3 files. Reproducibility: yes. at source level. Current main sets Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the latch-removal fix once maintainers accept the multi-source JSON follow stream; otherwise keep the retry/cursor fix and adjust JSON output to the accepted compatibility shape. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main sets Is this the best way to solve the issue? Yes for the implementation shape: removing the CLI follow-loop latch is narrower than changing Gateway logging or the journal reader. Maintainers still need to accept the documented multi-source JSON metadata compatibility change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 643410c1f3c0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +19, Tests +279, Docs +1. Total +299 across 3 files. View PR surface stats
What I checked:
Likely related people:
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. How this review workflow works
|
53bcd7f to
aea512e
Compare
|
Added a public-safe Real behavior proof note from an isolated source checkout (no production Gateway/config/runtime used): Real behavior proof
|
|
proof: override request I rechecked this proof blocker with a disposable checkout only. I did not run a live Gateway/systemd follow session because that would require an operator runtime, and I did not use any private deployment as public proof. In the disposable setup, the focused logs CLI regression suite passed and an additional runtime-seam check confirmed that follow mode still calls Deterministic non-production coverage observed:
I also rechecked the latest Since the remaining evidence would require a real local Gateway/systemd follow session, is maintainer |
aea512e to
cd0215e
Compare
|
@clawsweeper re-review Deterministic current-head proof added for the remaining real-behavior gate. What I ran: node --import tsx .tmp-proof/source-logs-cli-entry.ts \
logs --follow --json --limit 1 --interval 1 --timeout 800 --token proof-tokenHarness shape:
Observed stdout: {"type":"meta","file":"/tmp/openclaw-proof.log","sourceKind":"file","cursor":5}
{"type":"raw","raw":"gateway-file-line-1"}
{"type":"meta","source":"journalctl --user --boot --user-unit=openclaw-gateway.service _PID=4242","sourceKind":"journal","service":{"pid":4242,"unit":"openclaw-gateway.service"},"cursor":"s=journal-proof-cursor","localFallback":true}
{"type":"raw","raw":"journal-fallback-line"}
{"type":"meta","file":"/tmp/openclaw-proof.log","sourceKind":"file","cursor":10}
{"type":"raw","raw":"gateway-file-line-2"}This verifies the exact source transition that was requested: Gateway file output → journal fallback metadata with Requested outcome:
|
Rebase openclaw#88159 onto current main and keep systemd journal fallback temporary in follow mode. Preserve the journal cursor across repeated fallback outages, but retry logs.tail on the next loop so recovered Gateway RPC returns to normal log output. This refresh also replaces the stale red checks-node-core-fast result from the old head with a current-head CI run.
edd1bff to
efdadbc
Compare
|
Land-ready maintainer pass complete on exact head What was repaired:
Proof:
The PR body also retains the disposable real CLI/fake Gateway/systemd-boundary proof. Remaining gap: no live production systemd service was interrupted; the journal command, cursor handoff, delayed recovery, and cancellation paths are deterministic in the focused tests. |
|
Merged via squash.
|
…claw#88159) * fix(cli): retry logs.tail after journal fallback in logs follow Rebase openclaw#88159 onto current main and keep systemd journal fallback temporary in follow mode. Preserve the journal cursor across repeated fallback outages, but retry logs.tail on the next loop so recovered Gateway RPC returns to normal log output. This refresh also replaces the stale red checks-node-core-fast result from the old head with a current-head CI run. * Keep log source metadata explicit * ci: retrigger checks for PR openclaw#88159 * docs: clarify logs follow JSON source transitions * fix(cli): keep journal logs responsive during recovery --------- Co-authored-by: Vincent Koc <[email protected]>
* refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (#102494/#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (#84381): malformed injection was not human SIGTERM report #71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (#88159, superseded by #168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 7dccff5. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature #95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit 65f18d6 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
…#173036) * refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (openclaw#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (openclaw#84381): malformed injection was not human SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (openclaw#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (openclaw#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 89f8219. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit ca10460 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
Summary
Fixes
openclaw logs --followgetting stuck on Linux systemd journal fallback after a transient local Gateway RPC outage or Gateway restart.When implicit local
logs.tailfails in follow mode, the CLI can use the active systemd journal as a bridge. However, after a journal payload was emitted, the follow loop permanently latched journal mode and stopped probinglogs.tail. That meant log presentation could remain journal/console-style until the CLI was restarted, even after Gateway RPC recovered.This keeps journal fallback temporary:
logs.tailon the next follow iteration so recovered RPC switches back to normal Gateway log formatting/source.Related
Behavior
openclaw logs --follow:logs.tailresumes normal RPC/file log output;--urlbehavior is unchanged.Reviewer / AI review map
openclaw logs --followsource-selection state only; this does not change explicit--urlbehavior or the active systemd journal bridge itself.logs.tail.logs.tail; when RPC recovers, output returns to normal Gateway log formatting/source.logs.tail.Real behavior proof
Behavior addressed: After this patch, implicit local
openclaw logs --followretrieslogs.tailafter a temporary systemd-journal fallback. Repeated fallback reads preserve the journal cursor, and a later successfullogs.tailreturns the follow session to normal Gateway RPC/file log output instead of staying journal-latched.Real setup tested: Disposable non-production OpenClaw checkout at PR head
aea512eec0ff0f6ecd096d05c0941041c05956c7, using a synthetic profile/home, a loopback fake Gateway WebSocket that implements the real Gateway protocol handshake andlogs.tailmethod, and fakesystemctl/journalctlbinaries at the OS boundary. No production Gateway, live runtime state, live config, or real system service was used.Exact steps or command run after this patch: Built the CLI startup bundle, started the fake Gateway on loopback, then ran the actual CLI follow command against the disposable profile with synthetic systemd tools first in
PATH:The timeout wrapper only bounded the long-running follow command; the evidence below was emitted before timeout.
Evidence after fix: The fake Gateway log recorded two initial failed
logs.tailcalls, then recovered Gateway RPC calls including cursor resume:The CLI output showed journal fallback lines followed by recovered Gateway RPC/file log lines:
The fake
journalctlinvocation log also showed cursor-preserving follow reads:Observed result after fix: The actual CLI process first fell back to the synthetic systemd journal when local
logs.tailfailed, kept retrying Gateway RPC instead of latching onto journal mode, then resumed Gateway log output after the fake Gateway recovered. The recovered RPC call used the Gateway cursor from the prior successful response (cursor=10), while journal fallback calls used--after-cursor, confirming both cursor paths advance independently.What was not tested: No production Gateway, no live OpenClaw runtime state, no live config, and no real systemd journal/service. The proof uses a disposable checkout plus synthetic loopback Gateway/systemd boundary so the CLI/runtime path is real while the external OS/Gateway boundary is controlled and public-safe.