feat: enable FakeHarnessAdapter with CODEXHOST_FAKE_HARNESS - #94
Open
riba2534 wants to merge 1 commit into
Open
Conversation
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.
|
To use Codex here, create an environment for this repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in debug tier: when
CODEXHOST_FAKE_HARNESS=1, every external Harness Adapter is replaced with the existingFakeHarnessAdapter.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
createExternalHarnessAdaptersreturns a map ofFakeHarnessAdapterinstances when the env var is set to1, and is otherwise untouchedFAKE_HARNESS_ENVis re-exported alongside the existingCODEXHOST_*_COMMANDconstants@codexhost/harness-adapter/testingis already a public export in that package'sexportsmap, so this introduces no new surface and does not triptools/check-boundaries.mjs.Scope notes
FakeHarnessAdapteritself is unmodified, and its export map is unchangedVerification
Rebased onto current
main(df334f4) and re-run there:npm run lintnpm run typecheckpackages/host-runtime/npm run test:rustwas not run — this change does not touch the Rust crates.Tests cover both directions: unset returns the real Adapter classes,
=1returnsFakeHarnessAdapterwhile preserving eachharnessId.