Skip to content

fix(codex): keep bundled plugins when launch arguments are overridden - #47349

Open
saphid wants to merge 4 commits into
pingdotgg:mainfrom
saphid:hunter/c-05248de564
Open

saphid wants to merge 4 commits into
pingdotgg:mainfrom
saphid:hunter/c-05248de564

Conversation

@saphid

@saphid saphid commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Problem

An unrelated T3CODE_CODEX_LAUNCH_ARGS override makes the bundled marketplace disappear for a shadow-home Codex CLI instance. When a new turn opens a session, ProviderTurnStartService calls ProviderSessionManager.open, which invokes the adapter built by CodexDriver.create; the app-server factory resolves the environment override after the shadow source has been added, so the native process never receives that source.

Deterministic repro on origin/main (fba92aeb8bd36ac60f18d6367f7d18eca6d2a201)

Run this with Codex CLI 0.166.0. The args array is the output of the base ordering: resolveCodexLaunchArgs(codexHomeLaunchArgs(path, authOverlay, configuredArgs), environment).

fixture=$(mktemp -d)
trap 'rm -rf "$fixture"' EXIT
shared="$fixture/shared home"
shadow="$fixture/shadow home"
marketplace=.tmp/bundled-marketplaces/openai-bundled
for home in "$shared" "$shadow"; do
  mkdir -p "$home/$marketplace/.agents/plugins"
  printf '%s\n' '{"name":"openai-bundled","plugins":[]}' > "$home/$marketplace/.agents/plugins/marketplace.json"
done
printf '[marketplaces.openai-bundled]\nsource_type = "local"\nsource = "%s"\n' \
  "$shared/$marketplace" > "$shadow/config.toml"
export T3CODE_CODEX_LAUNCH_ARGS='-c model_auto_compact_token_limit=250000'
read -r -a args <<< "$T3CODE_CODEX_LAUNCH_ARGS"
env -i PATH="$PATH" HOME="$fixture" CODEX_HOME="$shadow" \
  codex plugin marketplace list --json "${args[@]}"
env -i PATH="$PATH" HOME="$fixture" CODEX_HOME="$shadow" \
  codex plugin marketplace list --json \
  -c "marketplaces.openai-bundled.source=\"$shadow/$marketplace\"" "${args[@]}"

Observed: the first command exits 0 with {"marketplaces":[]}. Expected: it lists openai-bundled from the shadow home, as the second command does, while keeping the override's 250000 value.

Change

Resolve the user launch arguments first, consume the environment override, and prepend the generated marketplace source in both the driver and the session adapter. Probes and turns share this server-side behavior across web, desktop, and mobile; explicit user arguments still come last, and resolving the composed string again preserves escaped trailing whitespace.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • The existing CodexDriver.test.ts shadow-home case failed on the pinned base because the marketplace -c pair was absent. It passed on the patch with the marketplace pair first, the override pair second, and no configured 100000 value.
  • vp run check:changed exited 0: format, lint, knip, GraphQL, typecheck, and 297 tests across four affected files.
  • Credential-free before/after transcript and fixture: the native CLI went from no marketplaces to openai-bundled under the shadow home; native app-server plugin/list likewise went from empty to sample@openai-bundled with a local sample plugin.
  • Not shown: a signed-in or paid Codex turn, live server probes with a real account, and separate web, desktop, mobile, or Windows runs.

Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 2, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7e218ec

Macroscope's review found this PR approvable — This preserves the existing bundled-plugin source when Codex launch arguments are overridden, while keeping explicit user arguments and refreshed host environment values. The scope is launch configuration, with no product-default or permission changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Codex launch-argument resolver now supports environment overrides and preserves configured fallback values without trimming. The driver and adapter consume overrides from the merged environment and use the resolved arguments.

Changes: Codex launch argument resolution

Layer / File(s) Summary
Resolve and apply launch arguments
apps/server/src/provider/codexLaunchArgs.ts, apps/server/src/provider/Drivers/CodexDriver.ts, apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts, apps/server/src/provider/Drivers/CodexDriver.test.ts
The resolver returns a nonblank environment override or the configured fallback without trimming. The driver and adapter consume the override from the merged environment, use the resolved arguments, and pass onward the environment with the override hidden. The test checks the updated launch PATH and resolved app-server arguments.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 7e218

This change keeps bundled Codex plugins available when launch arguments are overridden. No merge-blocking risk was identified in the supplied changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: launch-argument overrides no longer cause the bundled plugin marketplace to be dropped for Codex. It is a conventional commit title that matches the changed files and PR ob…
Description check Passed The description follows the template sections (Problem, Change, Scope, Verification). The Problem section gives a reproduction and expected/observed behavior. The Change section explains the fix and w…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: launch-argument overrides no longer cause the bundled plugin marketplace to be dropped for Codex. It is a conventional commit title that matches the changed files and PR objectives, so it passes.

Full details: Description check

Explanation

The description follows the template sections (Problem, Change, Scope, Verification). The Problem section gives a reproduction and expected/observed behavior. The Change section explains the fix and why it applies in both the driver and the adapter. Scope cites CONTRIBUTING.md and gives a reason for skipping an issue. Verification lists focused test results and the checks not performed. The author names the model and harness used in the closing line. Minor gaps: the Scope section does not link an issue, and the template's Problem line references a bug in an unrelated override, which the author explains. Overall the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 53b8d16 and 7e218ec.

Files selected for processing: 2

  • apps/server/src/provider/Drivers/CodexDriver.test.ts
  • apps/server/src/provider/codexLaunchArgs.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
juliusmarminge and others added 2 commits December 2, 2026 09:15
…ost env

Resolve and strip T3CODE_CODEX_LAUNCH_ARGS through one helper shared by the
driver and the v2 adapter, and copy the environment only when the override is
present so a policy host env keeps its read-through PATH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 09:19

Dismissing prior approval to re-evaluate 53b8d16

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Dec 2, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
Copying the environment to drop T3CODE_CODEX_LAUNCH_ARGS froze values the
host refreshes later, such as PATH from the login shell, for every later
Codex launch. Return a read-through view that hides only the override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 09:26

Dismissing prior approval to re-evaluate 7e218ec

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment for both columns: Linux web dev client, Chromium at 1280×800 CSS pixels, light theme, real Codex CLI 0.173.0, GPT-6-Astra Medium via the available API endpoint. Separate worktrees and fresh T3 databases (T3CODE_DEV_SEED=0); same synthetic bundled zebra-facts plugin fixture and separate shadow homes. No replay or fake provider.

  1. Settings → Providers → Codex: configure shared CODEX_HOME and a separate shadow home.
  2. Add T3CODE_CODEX_LAUNCH_ARGS=-c model_auto_compact_token_limit=250000; saving refreshes the provider.
  3. Open a new Codex thread and type $zebra.
  4. Replace the composer text with: “Without searching files or using tools, list the skill names containing 'zebra' in your available skills. If none are available, reply exactly NO-ZEBRA-SKILL.” Submit to the real model.
Before After
86d49cbe48 7e218ec45b
Before: no skills found with the unrelated override After: bundled zebra skill remains available with the override
Before: real GPT-6-Astra turn reports NO-ZEBRA-SKILL After: the same real-model prompt reports zebra-facts:zebra-facts
Before interaction recording After interaction recording

The recorded real app-server launches show base drops the generated marketplace source while head keeps it alongside model_auto_compact_token_limit=250000. Captured launches and real CLI inventories show empty inventory on base and the enabled plugin on head. Temporary home paths are replaced by symbolic names.

Control on base: removing only the environment override restored both the composer skill and the real-model response. On head, explicitly supplying the shared-home marketplace source put that user argument last and intentionally hid the bundled plugin because Codex requires its shadow-home bundled path. Head explicit-source capture and the inventory evidence confirm user precedence.

Reproduction steps · Synthetic fixture seed · Real-CLI logging wrapper · Native inventory driver

Primary comparison stills and the explicit-source still were pixel-identical across screenshots taken more than 500 ms apart. Both recordings were visually inspected.

Not shown:

  • Propagation of a later host PATH refresh through the new environment view was not exercised; this proof covers bundled marketplace retention and explicit user marketplace precedence.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants