feat(engines): launch your own build of an engine with MOSHCODE_ENGINE_BIN_<KEY> - #530
Merged
Merged
Conversation
…E_BIN_<KEY> `MOSHCODE_ENGINE_BIN_CODEX=/path/to/codex` makes moshcode open that executable for the codex engine instead of searching for `codex` on PATH. The same shape works for every engine in the table. It exists for the case where you are running your own build of an engine — a fork carrying a patch upstream has not taken, or a debug build you are bisecting — and the copy PATH finds first is not the one you mean. openai/codex, for instance, accepts no external pull requests at all, so a fix you need has nowhere to land but a fork you build yourself. Unset by default, and deliberately so: with no override the engine's declared name is resolved against PATH exactly as before, which is the behaviour every engine documents and every test relies on. An override is a claim to know better than PATH for one engine, so it is only ever made out loud. Applied once where the table is built rather than at each launch site, because `bin` is read directly by the CLI, the TUI's error messages, the swarm and the MCP bridge, and an override only some of them honoured would be worse than none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan1 finding(s) in the 2 file(s) this pull request changes. MEDIUM: 1
100 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 8 | **MEDIUM**: 81 | **LOW**: 11Not introduced by this pull request. The full set is in the Security tab.
…and 80 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Why
Sometimes the copy of an engine that PATH finds first is not the one you mean: a fork carrying a patch upstream has not taken, or a debug build you are bisecting.
The case in hand is codex.
openai/codexaccepts no external pull requests —docs/contributing.mdsays so outright, and GitHub refusescreatePullRequestfrom a fork — so a fix you need has nowhere to land but a build you make yourself. Arrow-key prompt navigation (openai/codex#47300) is one such fix, and without this there is no way to tell moshcode to open it.What
MOSHCODE_ENGINE_BIN_CODEX=/path/to/codexmakes moshcode launch that executable for the codex engine. The same shape works for every engine in the table: the key is the engine name upcased, with anything outsideA-Z0-9replaced by_.Unset by default, and deliberately so: with no override the engine's declared name is resolved against PATH exactly as before, which is the behaviour every engine documents and every test relies on. An override is a claim to know better than PATH for one engine, so it is only ever made out loud. An empty or whitespace-only value counts as unset rather than as an empty command.
It is applied once where the table is built, not at each launch site, because
binis read directly by the CLI, the TUI's error messages, the swarm and the MCP bridge — an override that only some of them honoured would be worse than none.Tests
Two added in
test/engines.test.mjs:codexfirst on PATH and the override pointing somewhere PATH would never look, asserting the override is what runs and still gets the engine's agent-launch arguments.run()gained an optional third argument for extra env; existing callers are unchanged.Full suite: 3132 tests, 2781 pass, 131 fail — byte-identical failure set to
main(3130 / 2779 / 131), so no new breakage. Those 131 are pre-existing moshpit contact/DNS cases.🤖 Generated with Claude Code