Skip to content

fix(cli): retry logs.tail after journal fallback in logs follow - #88159

Merged
vincentkoc merged 5 commits into
openclaw:mainfrom
anyech:fix/logs-follow-retry-rpc-after-journal
Jul 1, 2026
Merged

vincentkoc merged 5 commits into
openclaw:mainfrom
anyech:fix/logs-follow-retry-rpc-after-journal

Conversation

@anyech

@anyech anyech commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes openclaw logs --follow getting stuck on Linux systemd journal fallback after a transient local Gateway RPC outage or Gateway restart.

When implicit local logs.tail fails 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 probing logs.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:

  • preserve the journal cursor so repeated fallback reads do not duplicate journal output;
  • do not permanently force journal mode after a journal fallback payload;
  • retry logs.tail on the next follow iteration so recovered RPC switches back to normal Gateway log formatting/source.

Related

Behavior

  • Implicit local openclaw logs --follow:
    • transient RPC failure can emit active systemd journal fallback logs;
    • later successful logs.tail resumes normal RPC/file log output;
    • stale configured-file fallback is still not used for follow mode outages.
  • Explicit --url behavior is unchanged.

Reviewer / AI review map

  • Scope: openclaw logs --follow source-selection state only; this does not change explicit --url behavior or the active systemd journal bridge itself.
  • Before: one journal fallback payload latched follow mode into journal output and stopped retrying local Gateway logs.tail.
  • After: journal fallback can bridge a transient outage, but the next follow iteration retries logs.tail; when RPC recovers, output returns to normal Gateway log formatting/source.
  • Non-overlap: this is a CLI follow-loop state fix, not a Gateway config/runtime lifecycle change and not a general logging backend rewrite.
  • Review focus: cursor preservation across repeated fallback reads, removal of the persistent journal latch, and resuming the Gateway cursor after recovered logs.tail.

Real behavior proof

  • Behavior addressed: After this patch, implicit local openclaw logs --follow retries logs.tail after a temporary systemd-journal fallback. Repeated fallback reads preserve the journal cursor, and a later successful logs.tail returns 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 and logs.tail method, and fake systemctl/journalctl binaries 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:

    OPENCLAW_GATEWAY_PORT=19081   HOME=<synthetic-home>   OPENCLAW_STATE_DIR=<synthetic-home>/.openclaw   OPENCLAW_PROFILE=proof   OPENCLAW_SYSTEMD_UNIT=openclaw-proof-gateway   PATH=<synthetic-bin>:<proof-bin>:$PATH   timeout 8s node openclaw.mjs logs --follow --plain --interval 50 --timeout 700

    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.tail calls, then recovered Gateway RPC calls including cursor resume:

    logs.tail call #1 -> terminate-for-fallback
    logs.tail call #2 -> terminate-for-fallback
    logs.tail call #3 -> recovered line cursor=10
    logs.tail call #4 -> cursor=10, recovered line cursor=20
    

    The CLI output showed journal fallback lines followed by recovered Gateway RPC/file log lines:

    Log source: journalctl --user --boot --user-unit=openclaw-proof-gateway.service _PID=4242
    Service PID: 4242
    Service Unit: openclaw-proof-gateway.service
    first journal bridge line
    second journal bridge line
    2026-06-03T07:45:00.000+00:00 info gateway rpc recovered line cursor=10
    2026-06-03T07:45:00.000+00:00 info gateway rpc recovered line cursor=20
    

    The fake journalctl invocation log also showed cursor-preserving follow reads:

    journalctl ... --show-cursor -n 200
    journalctl ... --show-cursor --after-cursor=s=abc
    journalctl ... --show-cursor --after-cursor=s=def
    
  • Observed result after fix: The actual CLI process first fell back to the synthetic systemd journal when local logs.tail failed, 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.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 29, 2026
@clawsweeper

clawsweeper Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 10:56 PM ET / 02:56 UTC.

Summary
The PR removes the logs --follow journal latch, retries Gateway logs.tail after journal fallback, emits source-transition metadata, adds regression tests, and documents JSON follow transitions.

PR surface: Source +19, Tests +279, Docs +1. Total +299 across 3 files.

Reproducibility: yes. at source level. Current main sets forceJournal after a journal payload and checks it before attempting logs.tail, so a recovered Gateway RPC is not probed on the next follow iteration.

Review metrics: 1 noteworthy metric.

  • JSON follow stream contract: 1 documented output-shape change. Maintainers should notice that --follow --json can now emit source-transition metadata before accepting the merge risk.

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

Root-cause cluster
Relationship: canonical
Canonical: #88159
Summary: This PR is the current canonical follow-up for residual logs --follow journal-latch behavior after the merged systemd journal fallback work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Merging intentionally changes the observable openclaw logs --follow --json stream: consumers can receive additional source-transition meta records, including file → journal → file transitions, and should track cursors per sourceKind.

Maintainer options:

  1. Accept documented source transitions (recommended)
    Merge after maintainer acceptance that --follow --json may emit multiple source meta records and consumers should track cursors by sourceKind.
  2. Preserve legacy JSON assumptions
    Ask for a compatibility-preserving JSON shape while retaining the retry-after-journal and cursor-preservation behavior.

Next step before merge

  • Manual review only: no automated repair is indicated; maintainers need to accept or reject the JSON follow-stream compatibility change before merge.

Security
Cleared: The diff changes CLI log-follow state, docs, and tests only; no dependency, workflow, package, secret-handling, or supply-chain surface is added.

Review details

Best 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 forceJournal after a journal payload and checks it before attempting logs.tail, so a recovered Gateway RPC is not probed on the next follow iteration.

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 changes

Label justifications:

  • P2: This is a bounded CLI logging correctness fix with operator-debugging impact and limited runtime blast radius.
  • merge-risk: 🚨 compatibility: The PR changes the observable openclaw logs --follow --json stream by adding documented source-transition metadata.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body/comments include after-fix terminal proof through the real CLI registration path against a loopback Gateway protocol server and synthetic systemd/journal boundary, showing file to journal to recovered-file output.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body/comments include after-fix terminal proof through the real CLI registration path against a loopback Gateway protocol server and synthetic systemd/journal boundary, showing file to journal to recovered-file output.
Evidence reviewed

PR surface:

Source +19, Tests +279, Docs +1. Total +299 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 61 42 +19
Tests 1 279 0 +279
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 341 42 +299

What I checked:

  • Repository policy read: Root AGENTS.md and docs/AGENTS.md were read fully; fallback compatibility, docs-output, and whole-path review guidance applied to this PR review. (AGENTS.md:1, 643410c1f3c0)
  • Current-main latch source: Current main checks cursors.forceJournal before attempting logs.tail, so a prior journal payload can keep the loop on journal output. (src/cli/logs-cli.ts:107, 643410c1f3c0)
  • Current-main latch assignment: Current main sets forceJournal = true after a journal payload, which is the persistent latch this PR removes. (src/cli/logs-cli.ts:672, 643410c1f3c0)
  • Latest release still has latch: The latest release tag v2026.6.10 still contains forceJournal and the journal-first branch, so the central fix is not already shipped. (src/cli/logs-cli.ts:107, aa69b12d0086)
  • PR retry path: At PR head, fetchLogs always attempts logs.tail first and only uses systemd journal inside the implicit-local fallback catch path. (src/cli/logs-cli.ts:137, edd1bff429b2)
  • PR cursor and metadata handling: At PR head, journal and Gateway cursors advance separately, source metadata is emitted on source changes, and no journal-first latch is reintroduced. (src/cli/logs-cli.ts:590, edd1bff429b2)

Likely related people:

  • vincentkoc: Authored and merged the systemd journal fallback in the merged precursor that introduced the current journal-follow state this PR refines. (role: feature owner and recent area contributor; confidence: high; commits: 6e3b3183dd85; files: src/cli/logs-cli.ts, src/cli/logs-cli.test.ts, src/cli/logs-cli.runtime.ts)
  • Peter Steinberger: History ties this person to the original logs CLI surface, local fallback, and expanded logs docs that this PR builds on. (role: introduced earlier logs CLI and fallback behavior; confidence: medium; commits: d1ceb3aa60b0, 306fe841f54b, d584ccfc77b5; files: src/cli/logs-cli.ts, src/cli/logs-cli.test.ts, docs/cli/logs.md)
  • shashank-poola: Authored the merged transient reconnect behavior for openclaw logs --follow, which this PR must preserve while changing journal fallback recovery. (role: adjacent logs-follow contributor; confidence: medium; commits: 23fe3559e5a2; files: src/cli/logs-cli.ts, src/cli/logs-cli.test.ts, docs/cli/logs.md)
  • RomneyDa: Authored merged reconnect notice and JSON notice parity work on the same logs-follow stream surface. (role: recent adjacent contributor; confidence: medium; commits: 4bb4127a33bf; files: src/cli/logs-cli.ts, src/cli/logs-cli.test.ts, docs/cli/logs.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 29, 2026
@anyech
anyech force-pushed the fix/logs-follow-retry-rpc-after-journal branch from 53bcd7f to aea512e Compare May 29, 2026 23:22
@anyech

anyech commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Added a public-safe Real behavior proof note from an isolated source checkout (no production Gateway/config/runtime used):

Real behavior proof

  • Setup: disposable OpenClaw source checkout at PR head aea512eec0ff0f6ecd096d05c0941041c05956c7, using the repository test harness only.

  • Command:

    .github/scripts/openclaw-heavy-run --backend auto -- node scripts/run-vitest.mjs run src/cli/logs-cli.test.ts -t "retry|journal|fallback|logs" --reporter=dot --pool=forks --maxWorkers=1
  • After-fix evidence: PASS. Vitest reported Test Files 1 passed (1) and Tests 34 passed (34).

  • Behavior exercised: the selected logs CLI regression coverage includes temporary systemd journal fallback when implicit local logs.tail fails, repeated fallback with journal cursor preservation, and switching back to Gateway logs.tail after RPC recovery instead of staying permanently journal-latched.

  • Caveat: this is non-production source-level behavior proof. I intentionally did not exercise this against a live user Gateway/config/runtime.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 3, 2026
@anyech

anyech commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

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 logs.tail each loop, uses systemd journal only as a temporary bridge, preserves the journal cursor for repeated fallback, and resumes the Gateway cursor after recovery.

Deterministic non-production coverage observed:

  • focused logs CLI tests: 1 file passed, 34 tests passed
  • runtime-seam check: Gateway RPC runtime path, journal fallback runtime, repeated fetch loop, journal cursor handling, Gateway cursor recovery, and journalctl fallback path all present

I also rechecked the latest checks-node-core-fast annotations. The failures are in websocket-open and compaction-planning tests outside this PR's changed files; the PR changes only logs CLI files, so these look base/unrelated rather than branch-caused.

Since the remaining evidence would require a real local Gateway/systemd follow session, is maintainer proof: override acceptable for this PR?

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 3, 2026
@anyech
anyech force-pushed the fix/logs-follow-retry-rpc-after-journal branch from aea512e to cd0215e Compare June 6, 2026 08:31
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 6, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Jun 6, 2026
@anyech

anyech commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

@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-token

Harness shape:

  • Real registerLogsCli / logs --follow --json action path from current head.
  • Loopback Gateway protocol server on localhost.
  • First logs.tail returned file cursor 5.
  • Next logs.tail closed the RPC, triggering the local systemd journal fallback.
  • The next Gateway reconnect returned file cursor 10.

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 sourceKind: "journal" / localFallback: true / service details → recovered Gateway file output with a new cursor.

Requested outcome:

  • Please re-check current head. Target if accepted: status: 👀 ready for maintainer look.

@clawsweeper clawsweeper Bot added 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 14, 2026
anyech and others added 5 commits July 1, 2026 06:42
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.
@vincentkoc
vincentkoc force-pushed the fix/logs-follow-retry-rpc-after-journal branch from edd1bff to efdadbc Compare July 1, 2026 13:42
@vincentkoc vincentkoc self-assigned this Jul 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Land-ready maintainer pass complete on exact head efdadbc231ecf69e7ef7f4ed6677a622302ad78e.

What was repaired:

  • kept journal fallback responsive while one cancellable Gateway recovery probe runs in the background;
  • preserved independent Gateway and journal cursors, clearing the obsolete journal cursor after Gateway recovery so a later outage starts from the recovery timestamp;
  • forwarded AbortSignal through the CLI Gateway RPC path so an EPIPE/output close cancels a pending probe;
  • documented the intentional at-least-once cross-source overlap contract and covered source transitions in plain and JSON output.

Proof:

  • Blacksmith Testbox through Crabbox, provider blacksmith-testbox, id tbx_01kwev2t4sgjkcmd6e7hk3rtrs;
  • pnpm test:serial src/cli/gateway-rpc.runtime.test.ts src/cli/logs-cli.test.ts: 55/55 passed;
  • exact six-file pnpm check:changed: core and test typechecks, lint, import cycles, and selected guards passed;
  • fresh branch autoreview against origin/main: no accepted/actionable findings;
  • exact-head GitHub CI: complete and green; repository hosted-gate verifier passed;
  • unresolved review threads: none.

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.

@vincentkoc
vincentkoc merged commit bd5bf48 into openclaw:main Jul 1, 2026
105 of 107 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 Jul 2, 2026
…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]>
steipete added a commit that referenced this pull request Oct 15, 2026
* 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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation 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. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L 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