Skip to content

[codex] preflight local AI prerequisites first - #114

Merged
davidiach merged 1 commit into
mainfrom
codex/ai-local-preflight-first
May 11, 2026
Merged

davidiach merged 1 commit into
mainfrom
codex/ai-local-preflight-first

Conversation

@davidiach

@davidiach davidiach commented May 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • run image and QEMU preflight checks before constructing the Anthropic client in AI mode
  • add CLI-level tests proving missing local prerequisites are reported before missing ANTHROPIC_API_KEY
  • update the workflow AI preflight assertion to match the new local-first ordering

Why

bridge.py ai ... previously constructed the Anthropic client before validating the local image path and QEMU executable. That could surface an API-key/import error even when the user first needed to fix a missing image or QEMU install.

Review notes

  • A read-only review confirmed the important order: AI limit/task validation, script loading when applicable, image preflight, QEMU preflight, Anthropic client setup, then LlmosSession.
  • The implementation keeps client construction in main() before launching QEMU, avoiding lazy setup inside mode_ai() after the session starts.
  • A PR review noted the missing-image test used a fixed temp path. It now uses an uncreated child inside a fresh temporary directory.
  • Hosted CI initially caught a stale inline workflow expectation; that check now asserts missing image wins before ANTHROPIC_API_KEY and no later phase is reached.

Validation

  • python -m unittest demo.test_bridge.BridgePreflightTests
  • python -m unittest demo.test_bridge
  • git diff --check -- demo/bridge.py demo/test_bridge.py .github/workflows/build.yml
  • wsl.exe -d Ubuntu make ci-check

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@davidiach davidiach left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Self-review pass complete.

Current patch review:

  • make_anthropic_client() still runs in main() before LlmosSession starts, so missing API key/import errors are reported before launching QEMU when local preflight passes.
  • Image and QEMU preflights now run first, so AI mode reports actionable local setup errors before API-key errors.
  • Tests patch make_anthropic_client and LlmosSession to prove those later phases are not reached during local preflight failures.

Local validation is green: python -m unittest demo.test_bridge.BridgePreflightTests, python -m unittest demo.test_bridge, git diff --check -- demo/bridge.py demo/test_bridge.py, and wsl.exe -d Ubuntu make ci-check.

@davidiach
davidiach force-pushed the codex/ai-local-preflight-first branch from cc0caf4 to 536d328 Compare May 11, 2026 16:23

@davidiach davidiach left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Self-review update after PR feedback.

Resolved finding:

  • The missing-image ordering test now uses an uncreated child path inside a fresh temporary directory instead of a fixed temp path.

Current patch review:

  • make_anthropic_client() still runs in main() before LlmosSession starts.
  • Image and QEMU preflights run first, so AI mode reports local setup errors before API-key errors.
  • Tests patch make_anthropic_client and LlmosSession to prove later phases are not reached during local preflight failures.

Validation rerun is green: python -m unittest demo.test_bridge.BridgePreflightTests, python -m unittest demo.test_bridge, git diff --check -- demo/bridge.py demo/test_bridge.py, and wsl.exe -d Ubuntu make ci-check.

@davidiach
davidiach force-pushed the codex/ai-local-preflight-first branch from 536d328 to 39dc3ac Compare May 11, 2026 16:28

@davidiach davidiach left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Self-review update after hosted CI feedback.

Resolved finding:

  • The workflow inline AI preflight check now matches the new contract: missing local image is reported before missing ANTHROPIC_API_KEY, and the assertion fails if API-key preflight runs first.

Validation rerun is green locally: python -m unittest demo.test_bridge.BridgePreflightTests, python -m unittest demo.test_bridge, git diff --check -- demo/bridge.py demo/test_bridge.py .github/workflows/build.yml, and wsl.exe -d Ubuntu make ci-check.

@davidiach
davidiach merged commit dd81e62 into main May 11, 2026
1 check passed
@davidiach
davidiach deleted the codex/ai-local-preflight-first branch May 18, 2026 18:42
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