Skip to content

Verify coding-engine capabilities before dispatch - #592

Open
prasadus92 wants to merge 13 commits into
mainfrom
feat/engine-capability-registry
Open

Verify coding-engine capabilities before dispatch#592
prasadus92 wants to merge 13 commits into
mainfrom
feat/engine-capability-registry

Conversation

@prasadus92

@prasadus92 prasadus92 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add a canonical engine capability registry for Claude Code, Codex, OpenCode, and Cline
  • require protocol and authentication checks before an engine is eligible for autonomous dispatch
  • keep detected but unvalidated harnesses visible without presenting them as ready
  • expose honest readiness details in onboarding and settings
  • prevent unrelated credentials from crossing engine probe subprocess boundaries
  • require Codex dispatches to ignore unrelated user configuration and avoid session persistence

Verification

  • full Python test suite
  • Ruff 0.15.22 formatting and lint checks
  • mypy 2.3.0
  • desktop type checks, lint, tests, production build, and built-app contract tests
  • site tests
  • public metadata scrub
  • real Codex wrapper smoke test under read-only sandbox
  • independent blocker review: clean

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a canonical coding-engine readiness contract and enforces it across setup, diagnostics, and dispatch.

  • Registers Claude Code, Codex, OpenCode, and Cline capabilities while limiting autonomous dispatch to validated engines.
  • Verifies CLI protocol, version, and authentication before real Claude or Codex invocation.
  • Reports detailed readiness states through the CLI, server setup API, onboarding, and settings.
  • Isolates probe subprocess environments and runs Codex without unrelated user configuration or session persistence.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran the pre-check and observed a fail-closed protocol gate that blocked dispatch.
  • T-Rex performed the post-check and observed readiness with real-process invocation succeeding.
  • T-Rex captured a sanitized argv and environment trace for all child processes to verify isolation.
  • T-Rex included a reproducibility harness and an executable wrapper to support repeatable runs.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
lib/agent_runner/engine_registry.py Introduces canonical engine descriptors, capability metadata, sanitized protocol probes, authentication checks, and bounded readiness caching.
lib/agent_runner/process.py Gates real Claude and Codex adapters on readiness and adds hermetic, ephemeral Codex invocation flags.
lib/agent_runner/config.py Derives supported engine choices from the registry and converts invalid operator configuration into a non-dispatching state.
lib/server/setup.py Replaces executable-presence detection with canonical readiness inventory in setup status.
bin/alfred Adds engine diagnostics and discovers configured engine-aware agents from deployed scheduler state.
clients/desktop/src/components/onboarding/EngineStep.tsx Distinguishes detected engines from compatible, authenticated engines and exposes detailed probe states.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Config[Configured engine] --> Registry[Capability registry]
  Registry --> Probe[Protocol, version, and auth probe]
  Probe -->|Ready| Dispatch[Engine adapter dispatch]
  Probe -->|Not ready| Failure[Structured readiness failure]
  Registry --> Setup[Setup API and desktop readiness UI]
  Registry --> Doctor[CLI engine doctor]
Loading

Reviews (10): Last reviewed commit: "fix engine readiness and doctor roster p..." | Re-trigger Greptile

Comment thread lib/agent_runner/config.py
Comment thread lib/agent_runner/config.py
Comment thread lib/agent_runner/engine_registry.py
@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a canonical coding-engine capability registry and exposes protocol/authentication readiness throughout setup and desktop surfaces.

  • Adds bounded, scrubbed probes for Claude Code, Codex, OpenCode, and Cline.
  • Uses readiness rather than binary presence for setup and conversational engine discovery.
  • Expands onboarding/settings types, presentation, tests, and routing documentation.
  • Makes unknown configured engine identifiers fail closed.

Confidence Score: 2/5

This should not merge until autonomous dispatch enforces engine readiness and Codex authentication is not inferred from API-key presence alone.

Scheduled runners still invoke engines after binary-only preflight, while an arbitrary nonempty OPENAI_API_KEY marks Codex ready and routes work to it before real authentication occurs.

lib/agent_runner/config.py, lib/agent_runner/engine_registry.py, and lib/agent_runner/process.py

T-Rex T-Rex Logs

What T-Rex did

  • Reproduced readiness bypass by exercising the isolated fake Codex binary: it passed protocol preflight but failed its authentication probe with ready=false and state=auth_required, yet the repository invocation dispatched the engine and the regression harness exited with an error.
  • Validated key presence bypasses Codex authentication: without a real API key the canonical probe observed auth failure and ready=false, while with a placeholder key the probe skipped login and reported ready=true and a signed-in state, with endpoint status transitioning from not-ready to signed-in and engine_ready true.
  • Compared readiness UI across builds and verified visual runs: before, the engine appeared installed with no ready engine and authentication details; after, the engine remains visible with sign-in indicators and engine readiness updated to ready, with both visual runs passing and archives validated.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
lib/agent_runner/engine_registry.py Introduces canonical engine probes, but Codex treats any nonempty API key as authenticated without validating it.
lib/agent_runner/config.py Derives engine choices from the registry, but autonomous preflight still reduces capability validation to binary presence.
lib/server/setup.py Replaces presence-only setup detection with the canonical readiness inventory and propagates readiness details.
lib/compose_converse.py Limits automatically selected conversational engines to probe results marked ready, including falsely ready Codex results.
clients/desktop/src/components/onboarding/EngineStep.tsx Distinguishes installed, compatible, authenticated, and unvalidated engine states in onboarding.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Registry[Engine capability registry] --> Probe[Protocol and auth probes]
  Probe --> Setup[Setup status]
  Setup --> Desktop[Onboarding and settings]
  Setup --> Converse[Conversation engine discovery]
  Config[Scheduled agent configuration] --> Preflight[Binary-only preflight]
  Preflight --> Invoke[Autonomous engine invocation]
  Probe -. readiness not enforced .-> Preflight
Loading

Reviews (1): Last reviewed commit: "feat(engines): verify harness capabiliti..." | Re-trigger Greptile

Comment thread lib/agent_runner/config.py
Comment thread lib/agent_runner/engine_registry.py Outdated

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

Copy link
Copy Markdown

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: 9c9d8d2f79

ℹ️ 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 lib/agent_runner/engine_registry.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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

ℹ️ 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 lib/agent_runner/config.py
Comment thread lib/agent_runner/process.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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

ℹ️ 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 lib/agent_runner/engine_registry.py Outdated
Comment thread lib/agent_runner/engine_registry.py
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

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

Copy link
Copy Markdown

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: 4b7f438390

ℹ️ 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 lib/agent_runner/engine_registry.py
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

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

Copy link
Copy Markdown

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: 5f94a7c98b

ℹ️ 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 lib/agent_runner/process.py
@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptile review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 82862e6cf5

ℹ️ 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 lib/agent_runner/engine_registry.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptile review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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

ℹ️ 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 lib/agent_runner/engine_registry.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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

ℹ️ 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 lib/agent_runner/process.py
@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptile review

Exact head: be38f4fd6b12bc42406d8c0c69aa2acbc11893bd

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

Exact head: be38f4fd6b12bc42406d8c0c69aa2acbc11893bd

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: be38f4fd6b

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

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptile review

Exact head: be38f4fd6b12bc42406d8c0c69aa2acbc11893bd

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

Please review exact HEAD be38f4fd6b12bc42406d8c0c69aa2acbc11893bd.

@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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: 71cbd0b6e5

ℹ️ 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 lib/agent_runner/process.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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

ℹ️ 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 lib/agent_runner/engine_registry.py Outdated
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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: 381b547fb2

ℹ️ 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 lib/agent_runner/process.py
@prasadus92

Copy link
Copy Markdown
Contributor Author

@codex review

@prasadus92

Copy link
Copy Markdown
Contributor Author

@greptileai review

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

Copy link
Copy Markdown

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: 1e67d954bb

ℹ️ 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 on lines +201 to +209
markers=(
"--output-last-message",
"--sandbox",
"--cd",
"--skip-git-repo-check",
"--ignore-user-config",
"--ephemeral",
"-c",
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Probe every Codex option used at dispatch

When a Codex CLI or wrapper exposes the options checked here but lacks --add-dir or --dangerously-bypass-approvals-and-sandbox, this probe reports it ready even though codex_invoke later supplies those options. This affects concrete fleet paths: the planner supplies both options, while the reviewer and senior developer supply --add-dir, so they fail only after dispatch instead of being rejected by the readiness gate. Include every dispatched option in the exec --help markers, including --model if configured models are supported.

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.

1 participant