Skip to content

feat(providers): Codex on a ChatGPT plan, and Kimi via Moonshot - #100

Merged
github-actions[bot] merged 3 commits into
mainfrom
claude/codex-and-kimi-providers
Aug 10, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
claude/codex-and-kimi-providers

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR for claude/codex-and-kimi-providers. Auto-merges to main once CI is green.

kingithegreat and others added 2 commits August 10, 2026 11:44
Companion to homebot-defect-patterns, which covers wiring — code that isn't
reachable. This covers state: code that IS reachable, runs, and still leaves
the user broken because the data on their disk was written under an older rule.

Six patterns, all observed live in one day. Four were introduced by an earlier
fix in the same session, which is the point of writing it down:

 1. A fix that needs the user to act is not a fix. Correcting the code that
    WRITES persisted state does nothing for state already written. Reported
    three times as "Qwen selected, opus answering" — each time after a
    relaunch, each time after I said it was fixed. Resolution: change the READ
    rule, migrate the data, or repair the file. Not the write alone.
 2. Asymmetric flag writes — one branch sets a flag, the other forgets to
    clear it, and the system holds a state that says both.
 3. Non-idempotent transforms compound. Encryption with no ciphertext marker
    re-encrypted its own output every save, ~33% growth per pass, found as a
    180,106,622-character apiKey.
 4. Recovery that archives but doesn't repair loops — 42 corrupt-file archives
    stamped 30 seconds apart.
 5. Encoding is not corruption. A UTF-8 BOM (from my own repair) triggered
    destructive recovery and wiped the user's settings.
 6. "Cloud provider" does not mean "HTTP endpoint" — three features hand-rolled
    a URL for a provider that is a CLI, producing "Invalid URL".

Plus a Windows subprocess section from the Codex work: spawn EINVAL on .cmd
(CVE-2024-27980) which .exe-based CLIs never hit, why the prompt must go over
stdin rather than argv once shell:true is required, and the stdin-close hang
that is invisible from a terminal because the shell closes stdin for you.

Each carries the concrete live case rather than the generality, and the
verification standard section records what actually caught these: reading the
user's real file, A/B against a stash, grepping the shipped bundle, and running
the CLI through the production spawn shape.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two providers, one branch because both extend the same provider union and
settings surfaces — separate branches would conflict by construction.

CODEX (`codex`) — OpenAI's Codex CLI signed in with a ChatGPT account, so
usage draws on the user's plan rather than a metered API key. Sibling of the
existing claude-code provider: keyless, endpoint-less, validated on model
alone, exempt from the list-models URL guard, offered in Settings.

Three things only running it could have found, all fixed here:

 - spawn EINVAL. npm installs the CLI as codex.cmd, and modern Node refuses
   to spawn .cmd without shell:true (CVE-2024-27980). claude.exe is a real
   executable and never hits this, so copying the working provider would have
   shipped broken.
 - Prompt must NOT go in argv. Once shell:true is forced, arguments are
   concatenated unescaped — a prompt containing & or | would execute
   commands. The prompt now goes over stdin via `codex exec -`, keeping every
   untrusted byte off the command line; only our own literal flags remain.
 - stdin must be closed. Codex reads stdin for extra context even when given
   a prompt, and hangs forever while the pipe is open. Invisible from a
   terminal, where the shell had already closed it.

Verified against the real CLI through the exact production spawn shape:
returns PONG, exit 0, parsed from item.completed/agent_message events. Event
shape confirmed against OpenAI's docs, not guessed.

No tool bridge for Codex, deliberately: openai/codex#15451 reports --json
output going malformed once MCP servers are active, and a corrupted stream is
worse than no tools. Chat only; claude-code keeps HomeBot's gated toolset.
Text also arrives per item rather than per token, so replies land in one or
two chunks — the CLI's granularity, documented in the code.

KIMI (`moonshot`) — OpenAI-compatible at api.moonshot.ai/v1, so no bespoke
client: a base URL, a vault key field (moonshotApiKey, encrypted at rest and
hydrated by resolveCloudLLM like the others), and a dropdown entry. NEEDS
ADEN: an API key from platform.moonshot.ai, which requires a paid top-up.

Verified: tsc clean; build green; 12 new tests (provider shape, validation,
key hydration, and that codex/claude-code stay absent from PROVIDER_API_URLS);
full suite 161/161, 2473/2473; all five new symbols confirmed in the shipped
main bundle. Not yet exercised through the app UI — needs a relaunch and a
provider switch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions
github-actions Bot enabled auto-merge (squash) August 10, 2026 11:21
@github-actions
github-actions Bot merged commit a2b3363 into main Aug 10, 2026
12 of 20 checks passed
@kingithegreat
kingithegreat deleted the claude/codex-and-kimi-providers branch October 10, 2026 22:15
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.

0 participants