Repository navigation
fix(state): converge legacy startup migrations - #107002
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e03deef113
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| warnings: [ | ||
| `Left plugin install index in place because shared SQLite state has conflicting plugin install metadata for: ${merged.conflicts.join(", ")}`, | ||
| ], | ||
| warnings: |
There was a problem hiding this comment.
Preserve archive failures for acknowledged install conflicts
When all plugin install conflicts are acknowledged, archiveLegacyInstalledPluginIndex can still append to the local warnings array if the legacy plugins/installs.json cannot be renamed or removed (for example because the .migrated target collides with a directory or permissions fail), but this return rebuilds warnings as [] whenever unresolved.length === 0. That reports a successful notice while leaving the legacy source in place, so startup keeps retrying without surfacing the archive failure; return the accumulated warnings in this branch.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 10:46 PM ET / July 14, 2026, 02:46 UTC. Summary PR surface: Source +328, Tests +247. Total +575 across 17 files. Reproducibility: yes. at source and reported-live level: the linked issue shows already-imported residue producing warnings, and startup refuses readiness whenever those warnings persist; the PR also reports a clean second run for one real doctor scenario. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Keep the unified convergence approach, preserve every archive-operation warning in the acknowledged plugin-conflict branch, add a focused failure regression, then rebase and land only after a likely owner explicitly accepts the SQLite-authoritative notice policy and exact-head upgrade checks pass. Do we have a high-confidence way to reproduce the issue? Yes at source and reported-live level: the linked issue shows already-imported residue producing warnings, and startup refuses readiness whenever those warnings persist; the PR also reports a clean second run for one real doctor scenario. Is this the best way to solve the issue? Mostly yes: applying one convergence policy across sibling migrations is preferable to isolated exceptions, but the current plugin-install return path must preserve archive failures before this is the best safe implementation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9b823c610816. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +328, Tests +247. Total +575 across 17 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
ec85ad4 to
81a79fd
Compare
Co-authored-by: Eva <[email protected]>
81a79fd to
2763aad
Compare
|
Land-ready at
|
|
Merged via squash.
|
* fix(state): converge legacy startup migrations Co-authored-by: Eva <[email protected]> * refactor(state): split legacy migration helpers * fix(memory): persist legacy source acknowledgements * fix(state): remove stale migration imports * fix(memory): recognize numbered migration archives * fix(matrix): downgrade archived migration residue * fix(memory): satisfy migration lint --------- Co-authored-by: Eva <[email protected]>
What Problem This Solves
Gateway startup treats every doctor migration warning as blocking. Already-imported legacy state could therefore create permanent startup loops when SQLite was authoritative but an old JSON/sidecar source remained, was recreated by an older process, or collided with an existing migration archive.
Closes #103076
Fixes #97563
Why This Change Was Made
.migratedarchive, including numbered collisions.User Impact
Upgrades no longer require repeated manual gateway starts for migration residue that was already imported or safely archived. Real divergent state still blocks startup and remains available for operator repair.
Evidence
tbx_01kxf5rntxq2a3a6qmdabc8weg: 204 focused migration tests passed across 5 Vitest shards.pnpm buildpassed, including plugin SDK declaration validation and Control UI build.pnpm check:changed: formatting, LOC, SDK baseline, dependency guards, and all four typecheck lanes passed. The only failure was an untouched current-main lint atsrc/agents/model-fallback.test.ts:3764; test: restore moving-main quality gates #106972 fixed that baseline before this branch's final rebase.doctor --fix --non-interactive --yesrun archived/noticed superseded update-check residue; second run was clean.codex: app-server protocolthread/resumeconsumes persisted rollout/thread identity; foreign legacy harness sidecars are therefore informational after successful binding retirement.