Skip to content

Protect and migrate existing ReviewMonitor local state during recovery cutover #108

Description

@lynnswap

Parent: #96
Related: #97, #102

Risk

Current-main and v0.6.2 use materially different account/runtime/history layouts. A recovery build must never use the existing ~/.codex_review home or codexReview.runtimePreferences value as a writable destination.

Recovery environment

Use versioned recovery-owned paths/preferences under ReviewMonitor Application Support:

  • RecoveryV1/CodexHome
  • RecoveryV1/review-history.sqlite
  • codexReview.recoveryV1.runtimePreferences

Development probes also use an isolated preference suite and MCP port.

Import eligibility and identity

  • Source fingerprint is SHA-256 of source installation ID, registry schema version, and canonical source-root identity; no credential bytes enter it.
  • A review is eligible only when a non-subagent outer thread has stable thread/turn IDs, a canonical review marker, and typed entered/exited-review-mode evidence.
  • Reviewer/compact/spawn/other child threads and thread-only records without canonical turn evidence are skipped with a manifest reason.
  • Deterministic ReviewID is legacy-v1: plus SHA-256 of source fingerprint, outer thread ID, and review turn ID.
  • Human result comes only from canonical outer exitedReviewMode.review.
  • Exact duration uses authoritative start/completion/duration data; missing data imports as lower-bound/unavailable, never guessed.

Credentials/preferences

  • ChatGPT auth bytes may be copied only into the recovery home with owner-only permissions, never decoded/logged, then validated by current app-server account read.
  • Invalid ChatGPT auth requires normal sign-in.
  • Raw API keys are not copied. Only non-secret API-key account metadata imports as requiring reauthentication through Reintroduce API key authentication on the v0.6.2 recovery architecture #97.
  • Runtime home/database paths and probe ports are never copied from legacy preferences; only validated user choices are imported.

Transaction and rollback

  • reviewImports records source fingerprint, importer/schema version, deterministic legacy key, source content hash, destination review ID, status, and skip/failure reason.
  • Each review imports atomically with unique (sourceFingerprint, legacyKey, importerVersion).
  • Identical committed import is a no-op.
  • A failed transaction leaves no review rows and records a retryable manifest failure separately.
  • The current source remains unchanged and its preflight hash manifest is the rollback point; deleting/recreating only the recovery destination is always safe.

Acceptance criteria

  • Environment preparation completes before app-server/MCP admission and cannot fall through to legacy defaults.
  • Import is idempotent, deterministic, content-heuristic-free, and secret-safe.
  • Canonical outer reviews import once; reviewer JSON never becomes product history.
  • Current-main source and original preferences remain byte-for-byte untouched.
  • Both current-main and recovery builds can relaunch from their independent homes.
  • Partial failure, retry, app termination, duplicate source, incompatible schema, missing metadata, invalid auth, and database rollback are tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions