Skip to content

feat: enable FakeHarnessAdapter with CODEXHOST_FAKE_HARNESS - #94

Open
riba2534 wants to merge 1 commit into
BytePioneer-AI:mainfrom
riba2534:pr3-mock-harness
Open

feat: enable FakeHarnessAdapter with CODEXHOST_FAKE_HARNESS#94
riba2534 wants to merge 1 commit into
BytePioneer-AI:mainfrom
riba2534:pr3-mock-harness

Conversation

@riba2534

Copy link
Copy Markdown

What

Adds an opt-in debug tier: when CODEXHOST_FAKE_HARNESS=1, every external Harness Adapter is replaced with the existing FakeHarnessAdapter.

Why

FakeHarnessAdapter (packages/harness-adapter/src/testing.ts) is a well-built test double with fault injection and call counting, but today it is only reachable from vitest. Debugging renderer injection or Desktop interaction therefore burns real model quota on every iteration.

This makes a "real Host + real Codex Desktop + fake Harness" tier available without touching any production code path.

How

  • createExternalHarnessAdapters returns a map of FakeHarnessAdapter instances when the env var is set to 1, and is otherwise untouched
  • A stderr notice is emitted on activation so the tier is never mistaken for real output
  • FAKE_HARNESS_ENV is re-exported alongside the existing CODEXHOST_*_COMMAND constants

@codexhost/harness-adapter/testing is already a public export in that package's exports map, so this introduces no new surface and does not trip tools/check-boundaries.mjs.

Scope notes

  • Unset, empty, or any other value keeps the production Adapter classes — zero behaviour change by default
  • FakeHarnessAdapter itself is unmodified, and its export map is unchanged
  • Launcher env forwarding was deliberately left out to keep this TypeScript-only; it can follow separately if the packaged macOS/Windows path needs it

Verification

Rebased onto current main (df334f4) and re-run there:

Check Result
npm run lint pass
npm run typecheck pass
packages/host-runtime/ 275 passed, 2 skipped (28 files)

npm run test:rust was not run — this change does not touch the Rust crates.

Tests cover both directions: unset returns the real Adapter classes, =1 returns FakeHarnessAdapter while preserving each harnessId.

Replace every external Adapter with FakeHarnessAdapter when
CODEXHOST_FAKE_HARNESS=1 so Desktop and renderer flows can be
debugged without calling real models. Unset or any other value
keeps the production Adapter classes.
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

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