Skip to content

fix(runner): advertise codex in the /health harnesses list - #5964

Closed
WhoamiI00 wants to merge 1 commit into
Agenta-AI:mainfrom
WhoamiI00:fix/runner-health-codex-harness
Closed

fix(runner): advertise codex in the /health harnesses list#5964
WhoamiI00 wants to merge 1 commit into
Agenta-AI:mainfrom
WhoamiI00:fix/runner-health-codex-harness

Conversation

@WhoamiI00

Copy link
Copy Markdown

Summary

GET /health did not list codex among the runner's harnesses, so a client asking the runner what it supports concluded Codex was unavailable on a deployment where Codex runs work.

Root cause: HARNESS_KINDS in services/runner/src/version.ts is a hardcoded list that was never extended when Codex became a harness of its own.

export const HARNESS_KINDS = ["pi_core", "claude", "pi_agenta"] as const;

Codex is a first-class harness everywhere else in the stack:

  • HarnessKind in sdks/python/agenta/sdk/agents/dtos.py carries all four values, and test_harness_identity.py pins the set as {"pi_core", "pi_agenta", "claude", "codex"}.
  • The generated API client (web/packages/agenta-api-client/.../HarnessKind.ts) lists Codex: "codex".
  • The /run wire contract has a run_request.codex.json golden asserted from both the Python and TypeScript sides.
  • The runner drives it: run-plan.ts maps codex straight through to its ACP agent, and acp-interactions.ts branches on acpAgent === "codex".

Only the runner's advertisement was stale. Nothing is gated on HARNESS_KINDS — the health payload is its sole consumer — so no run was ever blocked. The impact is that anything deciding what is available from this payload under-reports Codex, and it actively misleads while setting up a Codex mount: the endpoint saying Codex is absent reads as "the image doesn't have Codex" and sends you looking in the wrong place.

Why it went unnoticed

Both /health tests asserted only that harnesses was an array, never its contents, so the list could drift from the enum silently. Both now pin the member set, which is what makes this a fix rather than a one-character patch.

Changes

  • services/runner/src/version.ts — add codex; document the SDK enum as the source of truth so the two are extended together.
  • services/runner/src/protocol.ts — refresh the AgentRunRequest.harness docstring, which listed the same stale three ids.
  • Both /health tests — assert the exact member set instead of Array.isArray.

Closes #5693

Testing

Verified locally

  • npx tsc --noEmit in services/runner — passes (the typecheck gate CI runs).
  • npx vitest run --project unit tests/unit/server.test.ts — 34/34 pass.
  • npx vitest run --project acceptance tests/acceptance/server-contract.test.ts — 18/18 pass.
  • Confirmed the new assertion actually catches the bug: stashing src/version.ts back to the three-entry list fails the health test with the expected diff, and restoring it passes.
  • Full unit suite (--project unit): 2059 passed / 53 failed, identical before and after this change (same 15 files, byte-identical sets). Those 53 are pre-existing failures on my Windows machine caused by path-separator assumptions ('\tmp\run-agent\README.md' vs the expected '/tmp/run-agent/README.md') in suites like workspace-import and attachment-path-safety. They are unrelated to this change and do not occur on the ubuntu-latest runner CI uses.

Added or updated tests

Updated the two existing /health tests rather than adding new ones, since the gap was in what they asserted:

  • tests/unit/server.test.tsGET /health returns runner identity now asserts the sorted harnesses set equals ["claude", "codex", "pi_agenta", "pi_core"].
  • tests/acceptance/server-contract.test.ts — the /health contract test asserts the same set.

The expected list is pinned as a literal rather than derived from HARNESS_KINDS: asserting the payload against its own source would hold for any list, which is exactly how this drift survived. Sorted because the advertisement's order carries no meaning.

QA follow-up

N/A — no runtime behaviour changes. HARNESS_KINDS has no consumer other than the health payload, and Codex run dispatch goes through a separate path in run-plan.ts that this does not touch.

Demo

N/A — not a UI change.

Checklist

  • I have included a video or screen recording for UI changes, or marked Demo as N/A
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

`HARNESS_KINDS` was a hardcoded three-entry list that was never extended when
Codex became a harness of its own, so `GET /health` reported
[pi_core, claude, pi_agenta] on a runner that drives Codex fine. Nothing
is gated on the list (its only consumer is the health payload; `run-plan.ts`
maps `codex` to its ACP agent separately), so no run was ever blocked -- but a
client reading the payload concludes Codex is unsupported, and it misleads
anyone debugging a Codex mount into thinking the image lacks Codex.

The SDK enum already carries the four harnesses (`HarnessKind` in
sdks/python/agenta/sdk/agents/dtos.py, pinned by test_harness_identity.py), as
does the generated API client; only the runner was stale. Add `codex` and note
the enum as the source of truth.

The drift survived because both /health tests only asserted
`Array.isArray(harnesses)` and never its contents. Both now pin the member set,
so the next harness cannot be added without updating the advertisement.

Also refresh the `AgentRunRequest.harness` docstring, which listed the same
stale three ids.

Closes Agenta-AI#5693
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 12, 2026
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

@WhoamiI00 is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the typescript Pull requests that update typescript code label Aug 12, 2026
@CLAassistant

CLAassistant commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @WhoamiI00, thanks for opening a pull request. 🙏

This PR was automatically closed because it does not yet meet our contribution requirements:

  • This PR changes functional code (SDK, API, or frontend) but includes no demo. Add a screenshot or short video of the change. Only test-only, docs-only, or chore changes may skip it.

We ask for this so every change is documented and demonstrably tested before review.

How to get it reopened
Update the PR description (and add a demo recording if your change touches functional code). The bot reopens the PR automatically once the requirements are met. No need to open a new one.

See the Contributing guide and Creating your first PR. If you think this was closed in error, leave a comment and a maintainer will take a look.

@github-actions github-actions Bot added the incomplete-pr PR is missing required template sections or a demo recording label Aug 12, 2026
@github-actions github-actions Bot closed this Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e63d768-0b4a-426b-b9c4-0d3fce713a87

📥 Commits

Reviewing files that changed from the base of the PR and between e3f57d1 and 45f5168.

📒 Files selected for processing (4)
  • services/runner/src/protocol.ts
  • services/runner/src/version.ts
  • services/runner/tests/acceptance/server-contract.test.ts
  • services/runner/tests/unit/server.test.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for the Codex harness.
    • The runner now advertises Codex as an available harness.
  • Tests

    • Updated health endpoint checks to verify that all supported harnesses are correctly listed.

Walkthrough

The runner now documents Codex as a supported harness and includes it in HARNESS_KINDS. /health acceptance and unit tests verify the complete four-harness list.

Changes

Codex harness advertisement

Layer / File(s) Summary
Harness declaration
services/runner/src/protocol.ts, services/runner/src/version.ts
The AgentRunRequest.harness documentation lists codex. HARNESS_KINDS now exports codex.
Health contract validation
services/runner/tests/acceptance/server-contract.test.ts, services/runner/tests/unit/server.test.ts
The /health tests verify claude, codex, pi_agenta, and pi_core.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@WhoamiI00

Copy link
Copy Markdown
Author

Closing in favour of #5715, which predates this by a week and fixes the same thing. Apologies for the duplicate — I checked the issue for assignees but not for open PRs referencing it, which is on me.

Leaving this closed. @WahidSaeed's PR should be the one that lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incomplete-pr PR is missing required template sections or a demo recording size:S This PR changes 10-29 lines, ignoring generated files. typescript Pull requests that update typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(bug) The runner's /health endpoint doesn't list codex as a harness

2 participants