fix(persistence): harden startup recovery - #399
Merged
Conversation
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
Harden main-process persistence startup and legacy state repair without changing shared provider behavior or renderer UI.
projects.workspace_idbefore project reads.modelis blank, and normalize the same legacy shape at every thread database IPC write boundary. Valid model configs pass through unchanged.basic_textbackend) as a degraded capability: use one random in-memory key for the process lifetime, never persist that key through an insecure backend, and never write plaintext secrets.busy_timeoutbehavior still makes successful BUSY/LOCKED waits silent; exhausted lock failures propagate under the existing error policy.Sentry issues and treatment
Validation
pnpm exec vitest run src/main/db/migrations.test.ts src/main/db/projectsThreads.test.ts src/main/secretStorageKey.test.ts src/shared/ipc.test.ts— 4 files, 26 tests passedpnpm run typecheck— passedpnpm run lint— passed, including type-aware lintpnpm exec oxfmt --checkon all 9 touched files — passedPrivacy and residual risk
Expected credential-storage degradation and key rotation emit only fixed local warnings and no telemetry. Thrown failures use fixed sanitized messages. This change never sends key bytes, secret values, backend exception text, commands, paths, prompts, repository data, auth values, or user content to telemetry.
When secure OS storage is unavailable, credentials encrypted with the process-stable in-memory key are intentionally not recoverable after restart. The app remains usable and no plaintext secret is stored, but users may need to authenticate again after enabling a supported system keyring. No renderer copy was added, so there is no localization surface in this PR.