Skip to content

feat: per-thread Codex args overrides with runtime sync (incl. no-thread fallback)#443

Open
quippy-dev wants to merge 7 commits intoDimillian:mainfrom
quippy-dev:feat/per-thread-args-overrides
Open

feat: per-thread Codex args overrides with runtime sync (incl. no-thread fallback)#443
quippy-dev wants to merge 7 commits intoDimillian:mainfrom
quippy-dev:feat/per-thread-args-overrides

Conversation

@quippy-dev
Copy link
Contributor

@quippy-dev quippy-dev commented Feb 15, 2026

Summary

Adds per-thread Codex args overrides as a composer control and applies effective args at runtime before thread start/resume/send.

The change keeps per-thread runtime behavior aligned with the selected profile without mutating workspace/global defaults.

The dropdown only renders when more than one args profile option exists (default + at least one configured override), so there is no extra composer noise for users without overrides.

image

Key Changes

  • Composer + thread UX
    • Added per-thread Codex args selector to ComposerMetaBar.
    • Added a dedicated slider icon for Codex-args selection.
    • Added per-thread args badges in sidebar thread rows (regular + pinned lists).
  • Thread-scoped state + no-thread seeding
    • Extended persisted ThreadCodexParams with codexArgsOverride.
    • Added and exported __no_thread__ scope support so pre-thread selections persist.
    • Wired codex args through pending new-thread seed flow so first message inherits composer selection.
  • Runtime apply path (app + daemon parity)
    • Added set_workspace_runtime_codex_args end-to-end:
      • shared core: workspaces_core::set_workspace_runtime_codex_args_core
      • app command surface (src-tauri/src/workspaces/commands.rs, src-tauri/src/lib.rs)
      • daemon RPC surface (src-tauri/src/bin/codex_monitor_daemon.rs, rpc/workspace.rs)
      • remote allowlist (src-tauri/src/remote_backend/mod.rs)
      • frontend wrapper (src/services/tauri.ts)
    • Runtime args apply before:
      • startThread / workspace thread ensure
      • resumeThread on thread selection
      • turn/start send path
    • Steer path intentionally skips runtime apply.
  • Args parsing/sanitization utilities
    • Added src/features/threads/utils/codexArgsProfiles.ts to parse/sanitize args and build user-facing labels/options.
    • Unsupported flags are filtered for per-thread runtime overrides; selection with ignored flags shows a warning toast.
    • Settings help text documents ignored flags.
  • Post-review regression hardening
    • Thread selection resume no longer fails when runtime preflight sync errors; resume still proceeds.
    • Composer options now include the active selected override even when it no longer exists in app/workspace settings.
    • Thread badges now reflect sanitized/effective runtime args (ignored-only overrides no longer appear as active badges).

Behavior Notes

  • Composer selection persists in no-thread scope and carries into first-thread creation.
  • Thread-scoped override takes precedence when present.
  • If thread-scoped params are missing, runtime apply falls back to no-thread scope.
  • Explicit thread-scoped null still means “use resolved default args”.
  • Backend runtime apply returns { appliedCodexArgs, respawned }.
  • Runtime apply is a no-op when disconnected or when effective args are unchanged.

Test Coverage Added/Updated

  • Added src/features/threads/utils/codexArgsProfiles.test.ts
  • Added src/features/app/orchestration/useThreadOrchestration.test.ts
  • Expanded src/features/threads/utils/threadCodexParamsSeed.test.ts for no-thread fallback + sanitization scenarios
  • Expanded src/features/threads/hooks/useThreadMessaging.test.tsx for runtime-apply behavior and steer skip
  • Expanded src/features/threads/hooks/useThreads.integration.test.tsx to assert runtime apply occurs before start/resume entry points
  • Expanded src/features/threads/hooks/useThreads.integration.test.tsx to assert resume still occurs when runtime preflight fails
  • Expanded src/features/threads/utils/codexArgsProfiles.test.ts for active-override option inclusion and effective badge behavior

Validation Run

  • npm run typecheck
  • npm run test -- src/features/threads/hooks/useThreads.integration.test.tsx src/features/threads/hooks/useThreadMessaging.test.tsx src/features/threads/utils/threadCodexParamsSeed.test.ts src/features/threads/hooks/useThreadCodexParams.test.tsx src/features/threads/utils/codexArgsProfiles.test.ts src/features/app/orchestration/useThreadOrchestration.test.ts
  • npm run test
  • cd src-tauri && cargo check
  • cd src-tauri && cargo test set_workspace_runtime_codex_args --lib

Fixes pre-existing lint findings (not introduced by this branch):\n- react-hooks exhaustive-deps in DesktopLayout\n- unnecessary callback dependency/unused param in useThreadMessaging\n- no-useless-escape in codexArgsProfiles
@quippy-dev
Copy link
Contributor Author

@codex review

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: 2f5ea95a7d

ℹ️ 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 quippy-dev marked this pull request as ready for review February 15, 2026 21:25
@Dimillian
Copy link
Owner

@codex review

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: fef7d38cca

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

resolvedEffort,
accessMode,
selectedCollaborationModeId,
codexArgsOverride: selectedCodexArgsOverride ?? null,

Choose a reason for hiding this comment

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

P1 Badge Seed codex args from the resolved thread scope

This seed path persists codexArgsOverride from selectedCodexArgsOverride, but that value is synchronized in App.tsx via a passive useEffect, so on thread changes this effect can run with the previous thread's selection before the new scope value is applied. Because the thread is then marked as seeded, the stale override is locked in and future runtime syncs for that thread use unintended args (for example, switching from a thread using --profile a to an unseeded thread can incorrectly persist --profile a there).

Useful? React with 👍 / 👎.

Comment on lines +34 to +37
if (/^[A-Za-z][A-Za-z0-9-]*$/.test(token)) {
return `${prefix}${token.length === 1 ? "-" : "--"}${token}`;
}
return `${prefix}-${token}`;

Choose a reason for hiding this comment

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

P2 Badge Preserve long-flag equals forms in smart-dash normalization

The smart-dash normalization only treats tokens matching [A-Za-z][A-Za-z0-9-]* as long/short flags; tokens with = fall into the single-dash fallback. As a result, input like —profile=dev is rewritten to -profile=dev (invalid long-flag form), so downstream parsing no longer recognizes it as --profile and the intended runtime override can be dropped or misapplied.

Useful? React with 👍 / 👎.

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