Skip to content

Conversation

@quippy-dev
Copy link
Contributor

@quippy-dev quippy-dev commented Jan 26, 2026

Summary

Adds two first-class Codex runtime controls:

  • Default Codex CLI args for codex app-server (e.g. --profile personal), validated by doctor.
  • Per-workspace CLI args and CODEX_HOME overrides (worktrees inherit).
image

Key Changes

  • Settings UI
    • Workspace overrides: CODEX_HOME + Codex args added next to Codex binary.
    • Global Codex setting: “Default Codex args”.
  • Backend parity
    • Shared codex_args.rs parses args (shell quoting) and injects them before app-server.
    • codex_doctor uses the same args.
    • Local + daemon spawns both respect args/settings.
  • CODEX_HOME resolution
    • Supports ~, $VAR/${VAR}, %VAR%.
    • Worktrees inherit parent workspace override.
    • Respawns sessions when a connected workspace’s codexHome changes.
  • Prompts + local usage
    • Global prompts now resolve via the active workspace’s CODEX_HOME.
    • Usage scan aggregates sessions from default + overridden homes.

Why / Justification

  • Multi-profile reality: distinct homes + args are common (work/personal, auth/env, prompts).
  • Correctness: doctor validates the exact argv used at runtime.
  • Merge safety: logic is isolated to small helpers (codex_home.rs, codex_args.rs) plus plumbing.

Behavior Notes

  • Args are injected before app-server (global flags only).
  • workspace codexArgs changes now respawn active sessions (same behavior as codexHome)
  • Experimental flags still write to default CODEX_HOME/config.toml (UI warns when overrides exist).

Tests

  • npm run lint
  • npm run test
  • npm run typecheck
  • cd src-tauri && cargo test

- Add WorkspaceSettings.codexHome and Settings UI to override CODEX_HOME per workspace.
  - Worktrees inherit the parent workspace codexHome override (and still support legacy .codexmonitor).
  - Normalize CODEX_HOME values (tilde, $VAR/${VAR}, %VAR%) for env/config inputs.
  - Respawn app-server sessions when codexHome changes for a connected workspace.
- Add AppSettings.codexArgs and Settings UI to pass extra flags to the codex binary.
  - Parse args with shell-words (supports quoting); invalid strings surface as errors.
  - Apply args before `app-server` for local backend and daemon spawns.
  - Doctor uses the same args when checking `codex app-server --help`.
- Route the "global prompts" directory through CODEX_HOME for the active workspace.
- Local usage scanning reads sessions from the default CODEX_HOME and all workspace overrides.
Defer workspace settings persistence until respawn succeeds to avoid partial state.\nHarden prompt reveal when no workspace and cover with hook tests.\nPolish overrides: group spawn args, trim codex bin, and DRY workspace override drafts.
Support per-workspace codexArgs with parent/app fallback, restart
sessions when args change, and expose overrides in settings UI
with tests and storage updates
@quippy-dev
Copy link
Contributor Author

Summary

  • bb27581: Fixes two regressions. Workspace settings no longer partially persist when a respawn fails (rollback + defer write). Global prompts reveal is now safe with no
    workspace selected (guarded + UI disabled). Also polishes spawn arg ordering, trims codexBin, and DRYs workspace override drafts.
  • 89ce715: Adds per‑workspace Codex CLI args overrides. Resolution precedence is workspace → parent (worktree) → app defaults; all spawn/respawn paths (local + daemon) use the resolved args. Settings UI
    exposes the new override with Clear and persists it in workspaces.json.

Scope

  • Backend: WorkspaceSettings.codexArgs persisted, resolver in codex_args, spawn/respawn paths updated.
  • Frontend: Settings UI adds “Codex args override” per workspace.

Tests (what/why)

  • src/features/prompts/hooks/useCustomPrompts.test.tsx: locks the no‑workspace global prompts fallback.
  • src/features/settings/components/SettingsView.test.tsx: verifies workspace args override commits on blur.
  • src-tauri/src/codex_args.rs: validates override precedence (workspace → parent → app).
  • src-tauri/src/types.rs + src-tauri/src/storage.rs: defaults + persistence for the new field.

Test runs

  • npm run lint
  • npm run test (warnings about --localstorage-file invalid path; preexisting)
  • npm run typecheck
  • cd src-tauri && cargo test (preexisting warnings: unused set_window_appearance_override, unused mut in daemon)

@quippy-dev quippy-dev marked this pull request as ready for review January 26, 2026 05:10
@quippy-dev

This comment was marked as resolved.

@quippy-dev quippy-dev changed the title feat: workspace CODEX_HOME overrides + configurable Codex CLI args (with tests!) feat: workspace CODEX_HOME + CLI args overrides (with tests!) Jan 26, 2026
@quippy-dev quippy-dev changed the title feat: workspace CODEX_HOME + CLI args overrides (with tests!) feat: default codex args and workspace CODEX_HOME + args overrides (with tests!) Jan 26, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89ce7157ca

ℹ️ 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".

Ensure connected child worktrees restart when parent CODEX_HOME or
codex args overrides change so their sessions pick up new settings.
@quippy-dev
Copy link
Contributor Author

@codex review and confirm that 0b56b22 fixes:
P2 Badge Restart worktree sessions when parent overrides change

@Dimillian
Copy link
Owner

@codex review

@Dimillian
Copy link
Owner

We'll get even more review :p

@quippy-dev
Copy link
Contributor Author

We'll get even more review :p

While we wait, do you have plans to add /fork or a right click option to fork from a message? That was my next target but I won't duplicate the effort if it's in the works

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b56b225f3

ℹ️ 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".

merge patch updates inside updateWorkspaceSettings and
remove redundant spreading of existing settings across callers
@Dimillian
Copy link
Owner

We'll get even more review :p

While we wait, do you have plans to add /fork or a right click option to fork from a message? That was my next target but I won't duplicate the effort if it's in the works

It's on my list but feel free to do it

image

Since it's a CLI command it should be easy to do by just binding it like it's done for review I guess?

yes it should be on the thread right click menu

@quippy-dev quippy-dev marked this pull request as draft January 26, 2026 06:02
track workspace settings in a ref to avoid stale state when
multiple updates are queued and add a regression test
@quippy-dev quippy-dev marked this pull request as ready for review January 26, 2026 06:40
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 386ff252b5

ℹ️ 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".

quippy-dev and others added 4 commits January 26, 2026 00:09
Resolve relative codex_home values against the workspace or parent
path so worktrees inherit correct locations and add tests.
Introduces a new optional 'codexArgs' field to the AppSettings struct in Rust, including its default implementation. Also updates the SettingsView test to include the required 'openAppIconById' prop.
@Dimillian Dimillian merged commit 812c21a into Dimillian:main Jan 26, 2026
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.

2 participants