Skip to content

fix: repair missing Local Project assignments for existing chats#1559

Open
yazan1991 wants to merge 1 commit into
BigPizzaV3:mainfrom
yazan1991:fix/backfill-local-project-assignments
Open

fix: repair missing Local Project assignments for existing chats#1559
yazan1991 wants to merge 1 commit into
BigPizzaV3:mainfrom
yazan1991:fix/backfill-local-project-assignments

Conversation

@yazan1991

Copy link
Copy Markdown

Summary

Closes #1558.

Adds an explicit Manager maintenance action that analyzes and repairs missing Local Project assignments for existing conversations with a valid rollout CWD.

Root cause

Local Projects are retained in global state, and older rollout files retain their working directory. Some legacy threads lack the thread-project-assignments record that the UI requires to show the conversation beneath its Local Project.

Behavior

  • analyzes without writing, reporting existing assignments, safe matches, unmatched records, and ambiguous records
  • matches only exact normalized CWDs
  • preserves every existing assignment and unrelated global-state field
  • skips missing CWDs, unmatched paths, ambiguous roots, malformed JSONL, and duplicate rollout thread IDs
  • supports both supported rollout CWD locations
  • creates a timestamped backup before apply, writes atomically, reopens and verifies the result, and restores the original state on verification failure
  • is idempotent and does not run during normal startup

Schema assumptions

The repair requires local-projects to be an object keyed by the project IDs in project-order. It pairs each such ID with the same-index root in electron-saved-workspace-roots; malformed types or unequal array lengths fail safely without writing.

Tests

Added focused Rust tests for exact matches, existing assignments, unmatched and missing CWDs, both rollout CWD locations, malformed JSONL, ambiguous roots, duplicate thread IDs, dry runs, idempotency, backups, verification rollback, and preservation of unrelated fields.

Validation run:

  • git diff --check — passed
  • cargo fmt --check / cargo test -p codex-plus-core local_project_repair — not run: Rust/Cargo is unavailable in the local environment
  • npm run check / build — not run: manager dependencies are unavailable locally

No personal state, paths, thread IDs, or local test artifacts are included.

@yazan1991
yazan1991 marked this pull request as ready for review July 17, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: existing local chats can miss Local Project assignments

1 participant