openclaw - ✅(Solved) Fix This issue is raised to flag critical structural and architectural conflicts in PR #75441 that prevent it from being a viable path for main stability. [2 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75651Fetched 2026-05-02 05:32:17
View on GitHub
Comments
2
Participants
2
Timeline
11
Reactions
2
Timeline (top)
mentioned ×3subscribed ×3commented ×2cross-referenced ×2

Fix Action

Fixed

PR fix notes

PR #75441: fix(config): log observe recovery write failures

Description (problem / solution / changelog)

Summary

  • Log config health-state write failures instead of silently swallowing them.
  • Add async and sync regression coverage for the remaining config observe-recovery paths from #63423.

Fixes #63423

Test plan

  • pnpm test src/config/io.observe-recovery.test.ts src/config/io.audit.test.ts
  • pnpm lint:core
  • pnpm tsgo:core
  • pnpm tsgo:core:test
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/config/io.audit.ts src/config/io.ts src/config/io.observe-recovery.ts src/config/io.observe-recovery.test.ts
  • git diff --check

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/config/io.observe-recovery.test.ts (modified, +83/-0)
  • src/config/io.observe-recovery.ts (modified, +16/-4)
  • src/config/io.ts (modified, +6/-6)
  • src/config/io.write-config.test.ts (modified, +60/-0)

PR #70515: fix(config): surface backup restore copy failures in audit and logs

Description (problem / solution / changelog)

Summary

  • Problem: During suspicious-read recovery in maybeRecoverSuspiciousConfigRead (async and sync), copyFile(backupPath, configPath) is wrapped in a bare catch {}. When the copy fails (disk full, EACCES), the code still logs "Config auto-restored from backup" and writes the audit record with valid: true.
  • Why it matters: Users and audit tooling believe the config was repaired when it was not. A corrupted config persists silently.
  • What changed: Capture the copyFile error, emit a distinct failure warning, set valid to restoredFromBackup, and persist restoreErrorCode / restoreErrorMessage on the audit record.
  • What did NOT change: No changes to the merge-patch pipeline, config reload watcher, or any other recovery path.

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Gateway / orchestration

Linked Issue/PR

  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: Bare catch {} around copyFile in io.observe-recovery.ts lines 659-662 swallowed all errors unconditionally.
  • Missing detection / guardrail: No test covered a failing copyFile during recovery.
  • Contributing context: Pattern appears in multiple sites in observe-recovery.ts, this PR addresses the backup-restore path.

Regression Test Plan (if applicable)

  • Coverage level:
    • Unit test
  • Target test or file: src/config/io.observe-recovery.test.ts
  • Scenario: records copyFile failure instead of falsely claiming restore succeeded — injects a failing copyFile (EACCES), asserts failure warning fires, success warning does not, audit record has restoredFromBackup: false, valid: false, restoreErrorCode: "EACCES".
  • Why smallest reliable guardrail: Unit test with injected fs failure covers the exact branch.

User-visible / Behavior Changes

  • Failed backup restores now log a warning instead of falsely claiming success.
  • Audit records for failed restores now show valid: false with error details.

Diagram (if applicable)

Before:
[copyFile fails] -> [log "restored from backup"] -> [audit: valid: true]

After:
[copyFile fails] -> [log "restore FAILED: <error>"] -> [audit: valid: false, restoreErrorCode: "EACCES"]

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Linux (Ubuntu 24)
  • Runtime/container: Node 24

Steps

  1. Trigger a suspicious config read with a valid .bak file present
  2. Make the .bak -> config copyFile fail (simulate EACCES)
  3. Observe logs and audit record

Expected

  • Warning log: "Config auto-restore from backup failed"
  • Audit record: valid: false, restoreErrorCode: "EACCES"

Actual (before fix)

  • Success log: "Config auto-restored from backup"
  • Audit record: valid: true, no error info

Evidence

  • Failing test/log before + passing after

Human Verification (required)

  • Verified scenarios: Unit test with injected EACCES copyFile failure
  • Edge cases checked: Both async and sync recovery paths
  • What I did not verify: Full integration test with real disk-full scenario

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: Audit record schema gains two new nullable fields (restoreErrorCode, restoreErrorMessage)
    • Mitigation: Fields default to null on non-recovery paths, no breaking change for consumers

Changed files

  • CHANGELOG.md (modified, +6/-0)
  • src/config/io.audit.ts (modified, +2/-0)
  • src/config/io.observe-recovery.test.ts (modified, +76/-0)
  • src/config/io.observe-recovery.ts (modified, +66/-10)
  • src/config/io.ts (modified, +4/-0)
RAW_BUFFERClick to expand / collapse
  1. Scope Mismatch with Issue #63423 PR #75441 is currently tagged with Fixes #63423. However, a file-diff audit shows that the PR does not address the required changes in:

src/pairing/

src/infra/

The current implementation is restricted to src/config/io.observe-recovery.ts. Claiming full resolution of #63423 is factually incorrect and misleads the project's tracking of outstanding technical debt.

  1. Dependency Breakage (Commit ad3e4dbcce) The CI failures (3s exit) in #75441 are due to a direct conflict with the recent refactor by @steipete.

The Conflict: PR #75441 attempts to import observeConfigSnapshot and observeConfigSnapshotSync from ./io.observe-recovery.js.

The Reality: Commit ad3e4dbcce ("refactor: trim unused exports") moved these functions to internal-only scope in src/config/io.ts.

By attempting to re-expose or bypass these internal boundaries, #75441 violates the current architectural direction of the project.

  1. Impact on Stability The stable "restore-copy" audit fixes (originally from #70515) are currently bundled with the unstable and structurally invalid extensions in #75441. This "all-or-nothing" packaging is holding a verified fix hostage to a broken build.

Recommended Action:

Decouple the verified recovery-audit fixes from the invalid health-state expansion.

Re-evaluate #75441 once its scope is properly aligned with the files listed in #63423.

Uphold the encapsulation boundaries established in ad3e4dbcce.

extent analysis

TL;DR

Decouple the verified recovery-audit fixes from the invalid health-state expansion in PR #75441 to resolve the immediate stability issue.

Guidance

  • Re-evaluate PR #75441 to ensure its scope aligns with the required changes in src/pairing/ and src/infra/ as per Issue #63423.
  • Remove the attempt to import observeConfigSnapshot and observeConfigSnapshotSync from ./io.observe-recovery.js in PR #75441, as these functions are now internal-only in src/config/io.ts.
  • Separate the stable "restore-copy" audit fixes from the unstable extensions in PR #75441 to prevent holding a verified fix hostage to a broken build.
  • Uphold the encapsulation boundaries established in commit ad3e4dbcce to maintain the project's architectural direction.

Notes

The provided guidance is based on the information given in the issue and may not cover all possible scenarios or edge cases. It is essential to thoroughly review and test any changes before implementing them.

Recommendation

Apply workaround: Decouple the verified recovery-audit fixes from the invalid health-state expansion in PR #75441. This will allow for the immediate resolution of the stability issue while ensuring the project's architectural direction is maintained.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix This issue is raised to flag critical structural and architectural conflicts in PR #75441 that prevent it from being a viable path for main stability. [2 pull requests, 2 comments, 2 participants]