Skip to content

[codex] Add env config discovery and doctor commands#650

Open
willccbb wants to merge 3 commits into
mainfrom
codex/env-config-doctor
Open

[codex] Add env config discovery and doctor commands#650
willccbb wants to merge 3 commits into
mainfrom
codex/env-config-doctor

Conversation

@willccbb
Copy link
Copy Markdown
Member

@willccbb willccbb commented May 14, 2026

Summary

  • Add prime env config with text, JSON, TOML, and --resolved output modes backed by Verifiers-owned typed config introspection.
  • Add prime env doctor checks for eval-style environment resolution, package import, typed load_environment(config) loading, config-surface rendering, Verifiers structured diagnostics, pyproject config diagnostics, and optional --smoke.
  • Cover the command UX with focused tests for text output, JSON stdout purity, TOML namespace shape, tiny local env success, import/missing-loader failures, bad config section diagnostics, missing required key diagnostics, and smoke execution.

Validation

  • uv run ruff check packages/prime/src/prime_cli packages/prime/tests/test_env_config_doctor.py
  • uv run ty check packages/prime/src/prime_cli/env_config.py packages/prime/src/prime_cli/commands/env.py packages/prime/tests/test_env_config_doctor.py
  • uv run pytest packages/prime/tests/test_env_config_doctor.py -q
  • uv run pytest packages/prime/tests -q (709 passed, 4 skipped, 1 warning)

Notes

  • The CLI intentionally delegates config-surface semantics and framework diagnostics to the Verifiers introspection API rather than duplicating schema logic in Prime CLI.

Note

Medium Risk
Adds new CLI commands that dynamically import and execute verifiers introspection/diagnostics (and optionally trigger a smoke eval), so failures or API mismatches could impact CLI behavior despite being mostly additive.

Overview
Adds prime env config to display an environment’s config surface in text, toml, or machine-readable json, with --resolved support and JSON-safe stdout behavior.

Adds prime env doctor to validate that an environment resolves/imports, load_environment(config) works with a typed EnvConfig, the config surface can render, and to report structured diagnostics (including optional --smoke eval execution).

Introduces new prime_cli/env_config.py helper module to discover verifiers’ config-introspection APIs across versions, adapt to differing function signatures/renderers, and format doctor results; includes comprehensive CLI tests covering output modes and common failure/diagnostic scenarios.

Reviewed by Cursor Bugbot for commit c050106. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/prime/src/prime_cli/env_config.py
@willccbb willccbb marked this pull request as ready for review May 15, 2026 05:05
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: 1947c7e5ae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/prime/src/prime_cli/env_config.py Outdated
Comment thread packages/prime/src/prime_cli/env_config.py
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c050106. Configure here.

positional_args.append(positional_env_id)
break

return func(*positional_args, **accepted)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Positional arg conflicts with keyword arg causing TypeError

Low Severity

_call_with_supported_kwargs can raise a TypeError ("got multiple values for argument") when the unmatched required positional parameter is not the first parameter. The positional_env_id is prepended via *positional_args, so Python maps it to the function's first parameter. If that first parameter is already present in accepted as a keyword arg, Python raises a conflict. The positional value fills the wrong slot — it needs to target the unmatched parameter specifically (e.g., by inserting into accepted as a keyword instead of prepending as a positional).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c050106. Configure here.

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