Skip to content

feat: auto-select model/reasoning and add persistent user config#5

Merged
Kevin7Qi merged 6 commits intomainfrom
feat/auto-model-selection
Mar 6, 2026
Merged

feat: auto-select model/reasoning and add persistent user config#5
Kevin7Qi merged 6 commits intomainfrom
feat/auto-model-selection

Conversation

@Kevin7Qi
Copy link
Copy Markdown
Owner

@Kevin7Qi Kevin7Qi commented Mar 6, 2026

Summary

  • Auto-model selection: Follows the server's upgrade chain from the default model to the latest generation, preferring -codex variants when available. No version-string parsing — relies on the server's own succession metadata. Selects the highest supported reasoning effort for the chosen model.
  • Persistent user config: codex-collab config command to set/unset defaults for model, reasoning, sandbox, approval, and timeout. Stored in ~/.codex-collab/config.json. Three-tier precedence: CLI flag > config file > auto-detected.
  • Jobs command rewrite: codex-collab jobs now reads from local thread mapping instead of spawning a new app-server, fixing the bug where running threads were invisible. Shows model and prompt preview in the listing. Metadata refreshed on resume to keep listings accurate.
  • Review fixes: Config values use separate configured set (not forwarded on resume), Object.hasOwn for config key validation, robust error handling in config loading, and updateThreadMeta() to keep jobs accurate after resume.

Kevin7Qi added 2 commits March 6, 2026 15:21
…ser config

Replace the hardcoded default model with dynamic auto-detection that
queries the Codex app server's model list at runtime:

- Models with `upgrade === null` are identified as the latest generation
- Among those, `-codex` variants are preferred over plain models
- Reasoning effort auto-selects to the highest level the model supports
- Falls back gracefully to server default, then hardcoded fallback

Add persistent user configuration via `~/.codex-collab/config.json`:

- New `codex-collab config` command to get/set/unset defaults
- Supports model, reasoning, sandbox, approval, and timeout
- Priority: CLI flag > config file > auto-detected
- Values are validated on load; invalid entries warn and are skipped

This ensures the CLI stays current as new models are released without
requiring code changes or manual updates.
…dings

- jobs command now reads from local threads.json instead of spawning a
  new app-server (which has no knowledge of threads from other instances),
  fixing the bug where running threads were invisible
- Store prompt preview in thread mapping for jobs display
- Fix timeout config precedence (CLI flag > config file)
- Fix hidden models excluded from auto-selection
- Fix prototype property injection in config key validation
- Improve error handling in loadUserConfig, saveUserConfig, resolveDefaults
- Support --unset without key to clear all config
Copy link
Copy Markdown

@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: 844807a1aa

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

Comment thread src/cli.ts Outdated
Kevin7Qi added 4 commits March 6, 2026 16:26
When multiple models have upgrade === null, sort by ID descending
so higher version numbers (e.g. gpt-5.4 > gpt-5.3) are preferred.
Addresses Codex GitHub review comment on PR #5.
Let the server choose defaults when auto-detection fails instead of
hardcoding model/reasoning values that may become stale or invalid.
Also pass includeHidden: true to model/list so hidden models (like
-codex variants) are visible to auto-selection. Store the server's
effective model in thread mapping instead of the requested one.
Replace version-string parsing with upgrade-chain traversal for model
auto-selection: start from the server's isDefault model and follow
upgrade pointers to the latest generation, then prefer a -codex variant
if one exists. This avoids fragile version parsing and relies on the
server's own succession metadata.

Add updateThreadMeta() to refresh model/cwd/preview in threads.json
on resume, so `jobs` listings stay accurate after --resume with
overrides.

Document `config --unset` (clear all) in README, README.zh-CN, and
SKILL.md.
…lify review preview

- Change "Using defaults" to "Model and reasoning will be determined
  by the server" since there are no client-side defaults anymore
- Add not-found warning in updateThreadMeta matching updateThreadStatus
- Replace nested ternary in cmdReview with switch for readability
@Kevin7Qi Kevin7Qi merged commit 0f83da8 into main Mar 6, 2026
2 checks passed
@Kevin7Qi Kevin7Qi deleted the feat/auto-model-selection branch March 6, 2026 11:59
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