Keep marketplace upgrade state out of config (#39595)

## What changed

- Stop writing `last_updated` and `last_revision` to marketplace entries in
  `config.toml`; keep the activated revision in
  `.codex-marketplace-install.json` instead.
- Use installed marketplace metadata to detect up-to-date checkouts.
- Snapshot the installed marketplace before activation and roll back a stale
  upgrade if another installation changed the destination concurrently.

## Testing

- Verify marketplace add and upgrade operations leave `config.toml` unchanged.
- Cover restoring a newer concurrently installed marketplace when a stale
  activation is rejected.

GitOrigin-RevId: 10942c3fc7c6c3f68b7d5953e8c1b5e86bf71866
This commit is contained in:
willwang-openai
2026-08-19 19:05:50 +00:00
committed by copyberry
parent 1bfabb21fe
commit 8f4a48a6ad
10 changed files with 208 additions and 144 deletions

View File

@@ -17,8 +17,6 @@ fn codex_command(codex_home: &Path) -> Result<assert_cmd::Command> {
fn configured_marketplace_update() -> MarketplaceConfigUpdate<'static> {
MarketplaceConfigUpdate {
last_updated: "2026-04-13T00:00:00Z",
last_revision: None,
source_type: "git",
source: "https://github.com/owner/repo.git",
ref_name: Some("main"),

View File

@@ -36,8 +36,6 @@ fn codex_command_in(codex_home: &Path, current_dir: &Path) -> Result<assert_cmd:
fn configured_local_marketplace(source: &str) -> MarketplaceConfigUpdate<'_> {
MarketplaceConfigUpdate {
last_updated: "2026-05-06T00:00:00Z",
last_revision: None,
source_type: "local",
source,
ref_name: None,
@@ -381,8 +379,6 @@ async fn marketplace_list_json_includes_configured_git_marketplace_source() -> R
write_plugins_enabled_config(codex_home.path())?;
write_marketplace_source(&marketplace_root)?;
let update = MarketplaceConfigUpdate {
last_updated: "2026-06-04T08:39:49Z",
last_revision: Some("abc123"),
source_type: "git",
source: "https://example.com/acme/agent-skills.git",
ref_name: None,
@@ -430,8 +426,6 @@ async fn marketplace_list_json_keys_configured_source_by_root() -> Result<()> {
write_marketplace_source(home.path())?;
write_marketplace_source(&marketplace_root)?;
let update = MarketplaceConfigUpdate {
last_updated: "2026-06-04T08:39:49Z",
last_revision: Some("abc123"),
source_type: "git",
source: "https://example.com/acme/agent-skills.git",
ref_name: None,
@@ -679,8 +673,6 @@ async fn plugin_list_json_includes_configured_git_marketplace_source() -> Result
write_plugins_enabled_config(codex_home.path())?;
write_marketplace_source(&marketplace_root)?;
let update = MarketplaceConfigUpdate {
last_updated: "2026-06-04T08:39:49Z",
last_revision: Some("abc123"),
source_type: "git",
source: "https://example.com/acme/agent-skills.git",
ref_name: None,