Skip to content

fix: preserve install markers for Codex plugin roots#3110

Open
dongyeop-cmyk wants to merge 2 commits into
thedotmack:mainfrom
dongyeop-cmyk:fix/codex-install-marker
Open

fix: preserve install markers for Codex plugin roots#3110
dongyeop-cmyk wants to merge 2 commits into
thedotmack:mainfrom
dongyeop-cmyk:fix/codex-install-marker

Conversation

@dongyeop-cmyk

Copy link
Copy Markdown

Summary

  • resolve install markers against nested plugin/ roots so marketplace installs and Codex-installed plugin roots share the same marker path
  • write the install marker into the durable marketplace plugin root after successful install and repair flows
  • cover the marketplace-root marker behavior with setup-runtime and install wiring regressions

Verification

  • bun test tests/setup-runtime.test.ts tests/install-non-tty.test.ts tests/plugin-version-check.test.ts

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR preserves install markers for marketplace installs that use a nested plugin/ root. The main changes are:

  • Resolve install marker reads, writes, and freshness checks through plugin/.install-version when a marketplace root is passed.
  • Write marketplace plugin markers after successful install and repair flows.
  • Avoid creating SQLite platform_source indexes before the column exists on legacy databases.
  • Add tests for marketplace marker behavior and the legacy SQLite migration path.

Confidence Score: 4/5

This PR needs a small compile fix before merging.

A single contained build-breaking scope error remains in the install command marker write. The marker-path and SQLite migration changes are narrow and covered by tests.

src/npx-cli/commands/install.ts

T-Rex T-Rex Logs

What T-Rex did

  • Reproduced the cacheDir scope issue by running the project typecheck route and performing a narrow TypeScript compile of install.ts; the typecheck stopped before source checking due to missing Bun/Node typings, and the compile reported Cannot find name 'cacheDir' at install.ts(1642,26).
  • Verified version-state transitions across two runs; the before/after snapshots show the version values shifting as described, and both runs exited with code 0.
  • Compared repair-marketplace marker state before and after execution; the before snapshot showed a cache marker existed with no durable marker, and the after snapshot showed the durable marker existed with a JSON version/bun/uv/installedAt, with the run exiting code 0.
  • Compared platform schema states before and after initialization; the before run had an SQLiteError about a missing platform_source column, while the after run shows platform_source exists with default 'claude' and related index tables present, and the constructor reported OK with exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/npx-cli/commands/install.ts Moves install marker writing after task completion and mirrors marketplace markers, but references cacheDir outside its declaration scope.
src/npx-cli/install/setup-runtime.ts Resolves install markers and node_modules checks through nested marketplace plugin/ roots when present.
src/services/sqlite/SessionStore.ts Defers platform-source index creation until the column exists so legacy schema initialization can proceed through later migrations.
tests/install-non-tty.test.ts Adds source-level tests for marketplace marker writes in install and repair flows.
tests/setup-runtime.test.ts Adds marker read/write coverage for marketplace roots containing nested plugin/package.json.
tests/sqlite/session-store-migrations.test.ts Adds a legacy pre-platform_source migration fixture verifying initialization no longer crashes and preserves data.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
  participant Installer as runInstallCommandInner
  participant Runtime as setup-runtime
  participant Cache as Versioned cache root
  participant Market as Marketplace root
  Installer->>Runtime: ensureBun / ensureUv
  Installer->>Cache: installPluginDependencies(cacheDir)
  Installer->>Runtime: writeInstallMarker(cacheDir, versions)
  Runtime->>Cache: .install-version
  alt marketplace plugin/package.json exists
    Installer->>Runtime: writeInstallMarker(marketplaceDirectory(), versions)
    Runtime->>Market: resolve to plugin/.install-version
  end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
  participant Installer as runInstallCommandInner
  participant Runtime as setup-runtime
  participant Cache as Versioned cache root
  participant Market as Marketplace root
  Installer->>Runtime: ensureBun / ensureUv
  Installer->>Cache: installPluginDependencies(cacheDir)
  Installer->>Runtime: writeInstallMarker(cacheDir, versions)
  Runtime->>Cache: .install-version
  alt marketplace plugin/package.json exists
    Installer->>Runtime: writeInstallMarker(marketplaceDirectory(), versions)
    Runtime->>Market: resolve to plugin/.install-version
  end
Loading

Reviews (2): Last reviewed commit: "fix: tolerate pre-platform-source sessio..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

T-Rex pricing update — T-Rex was free through June 2026. Effective July 1, 2026, T-Rex adds 2 credits on top of the standard 1-credit review (3 total). T-Rex settings

await runTasks(tasks);

if (installedBunVersion && installedUvVersion) {
writeInstallMarker(cacheDir, version, installedBunVersion, installedUvVersion);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Restore cacheDir scope
cacheDir is declared inside the runtime setup task at line 1597, so this post-runTasks marker write is outside its block scope and the TypeScript build fails with Cannot find name 'cacheDir'. Hoist const cacheDir = pluginCacheDirectory(version) before the tasks are created, or recompute it here before calling writeInstallMarker.

Artifacts

Repro: project typecheck attempt output showing missing type definitions before source checking

  • Keeps the command output available without making the summary code-heavy.

Repro: narrow TypeScript compile output showing Cannot find name cacheDir at install.ts line 1642

  • Keeps the command output available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

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.

1 participant