fix(storage): storage settings corrupt recovery - #5282
Open
chinawch007 wants to merge 2 commits into
Open
Conversation
Recover only JSON parse failures after preserving the original bytes in an exclusive owner-only backup. Keep read, normalization and migration errors outside recovery, and distinguish failures before publication from an unconfirmed default-settings publication without replaying the mutation. Report recovery through localized desktop notifications and the existing settings effects queue. Track renderer delivery separately from applied settings so silent recovery cannot consume the pending change event. Cover byte preservation, permissions, fault boundaries, callback failures, queued mutations and desktop refresh behavior. Refs apache#4285 Generated-by: OpenAI Codex
Return a typed invalid-JSON error naming the persisted file while preserving its bytes and omitting parser messages that may contain credentials. Show localized repair guidance in Desktop and TUI, including mutations after a successful TUI startup. Keep live MCP state intact and make error details scrollable in small terminals, with Escape returning to the server list. Cover read and mutation refusal, localized rendering, scrolling, existing connections and explicit operations after an external file repair. Refs apache#4285 Generated-by: OpenAI Codex
chinawch007
force-pushed
the
fix/storage-settings-corrupt-recovery
branch
from
September 14, 2026 09:18
aabd93c to
fab6ca4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4285
Completes the read-side follow-up to #4505. Previously, an empty or truncated
settings.jsonfailed settings loading with a bareSyntaxError; corruptmcp.jsonlikewise offered no actionable recovery guidance.0600backup on POSIX, synchronize it, then restore defaults through the existing atomic writer. Read/normalization/migration errors still propagate. A failure after default publication remains commit-unknown and never automatically replays the caller's mutation.Recovery resets application preferences, bot configuration and onboarding state. It does not rewrite Runtime Policy or credential stores.
Verification
lint,format:check, fullbuild,typecheck, andknipfor Desktop andpackages/ui.nativeTheme.updatedrecovery with exactly one renderer event. Native notification delivery returnedfailed; failure isolation was verified. Windows/Linux application runs were not performed.Reproducing a truncated settings file against the base and this change gave:
AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex authored the implementation, regression tests, review fixes and this PR draft. Both commits include
Generated-by: OpenAI Codex; retain the trailer in the final squash commit.Checklist
Does this PR entail a change in behavior?