Repository navigation
fix(codex): persist plugin registrations across managed-home remirrors - #10494
Bongseop-Kim wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughCodex configuration synchronization now tracks plugin registration tables in persisted baselines, reads and updates registration blocks in TOML, and applies registration-specific promotion and conflict-preservation logic. Scalar setting promotion uses shared value and conflict-resolution helpers. Runtime snapshots include registrations, and generated system configuration preserves formatting and line endings. Integration tests cover promotion, conflicts, removal, legacy baselines, idempotence, and cache-file handling. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/codex/config-plugin-registration-promotion.test.ts (1)
71-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the exact first-pass output bytes.
The second mirror only proves idempotence of its own output. A regression that reformats the original preamble,
[features]block, or blank lines still passes thesetoContainchecks. Comparesystemwith an exact CRLF expected string after the first promotion.As per PR objectives, registration reconciliation must preserve byte stability.
src/main/codex/config-settings-baseline.ts (1)
63-74: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win
pluginRegistrationsis always serialized, unlikeconflicts, breaking null/untracked round-trip fidelity.
writeCodexSettingsBaselineunconditionally setspluginRegistrations: Object.fromEntries(baseline.pluginRegistrations ?? []), coercing anull(untracked/legacy) baseline into a tracked-but-empty{}on write. Contrast withconflicts, which is only addedif (baseline.conflicts.size > 0). SincereadCodexSettingsBaselineusesObject.hasOwn(parsed, 'pluginRegistrations')to distinguish "untracked" (null) from "tracked" (aMap, even empty), any future call site that writes a baseline object while intentionally preservingpluginRegistrations: nullwould silently have it promoted to tracked-empty on the next read, defeating the untracked-conflict semantics thatcollectCodexPluginRegistrationChangesrelies on (context.baseline.pluginRegistrations === null). Today's only caller (snapshotCodexRuntimeSettingsBaseline) always passes a realMap, so this isn't exercised yet, but the write/read contract itself is inconsistent.♻️ Mirror the conditional pattern used for `conflicts`
const file: StoredSettingsBaseline = { version: 2, - settings: Object.fromEntries(baseline.settings), - pluginRegistrations: Object.fromEntries(baseline.pluginRegistrations ?? []) + settings: Object.fromEntries(baseline.settings) } + if (baseline.pluginRegistrations !== null) { + file.pluginRegistrations = Object.fromEntries(baseline.pluginRegistrations) + } if (baseline.conflicts.size > 0) { file.conflicts = Object.fromEntries(baseline.conflicts) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e8c8933c-8942-4aea-aa58-2059dd8fc64c
📒 Files selected for processing (7)
config/tsconfig.cli.jsonsrc/main/codex/codex-config-settings-preservation.tssrc/main/codex/codex-plugin-registration-config.tssrc/main/codex/config-plugin-registration-promotion.test.tssrc/main/codex/config-settings-baseline.tssrc/main/codex/config-settings-conflict-resolution.tssrc/main/codex/config-settings-promotion.ts
|
Thank you for this — it was genuinely good work, and you are credited as a co-author on the commit that landed. You reached the central conclusion independently and correctly: a runtime-only registration has to be promoted, but a registration the canonical config removed must not be resurrected, and the mirrored baseline is the only thing that can tell those two apart. Your guard — One thing your PR does that the merged fix deliberately does not, and it is a place your design is better than ours: for a baseline with no registration ancestry you anchor a conflict rather than promoting. That sidesteps a residual risk the merged version accepts (if the baseline is lost at the same moment a canonical removal is pending, the removal can be undone). The merged fix promotes instead, so that a v2→v3 upgrade heals an existing install into Closing as superseded by #20150, which covers this plus the #11770 half. Your PR compares whole normalised table blocks, so a marketplace metadata refresh reads as a wholesale block change with no field-level |
Summary
CODEX_HOMEacross config remirrors.[tui]settings, but not the dynamic[marketplaces.<name>]and[plugins."<plugin>@<marketplace>"]tables, so the next system-config mirror replaced them.Reconciliation policy
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAdditional coverage:
oxfmt --checkpassed for all changed files.HOME/CODEX_HOMEregression with Codex CLI 0.145.0: marketplace add, plugin add/list, repeated real mirror byte stability, plugin/marketplace removal, and no resurrection after remirror.AI Review Report
Security Audit
Notes
CODEX_HOMErouting or authentication isolation; those remain separate from this managed-account persistence fix.pnpm buildexited successfully with the existing bundle warnings and local/usr/local/bin/orca-devsymlink permission notice.Fixes #10489
ELI5
Codex marketplace and plugin registrations inside Orca-managed CODEX_HOME were wiped on the next config remirror. Those plugin tables are preserved across remirrors so installed plugins stick.