Repository navigation
Add Codex subscription provider with isolated runtime and safe recovery - #6
Merged
Merged
Conversation
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.
Summary
Add an optional Codex subscription provider so Harvey can use a file-based ChatGPT login for model usage. Claude remains the default. Setup, training, the heartbeat, CLI status, dashboard and usage accounting support the selected provider; there is no silent model/provider or API-billing fallback.
The adapter runs Codex in an isolated temporary environment with no model-visible tools, MCP servers, hooks or instructions. It attests routes and configuration before introducing an access-token-only login copy, never copies the refresh token, and leaves the native login unchanged. Unsupported versions, unsafe configuration, incompatible models and unusable credentials fail closed. Timeouts include queueing and process startup; teardown removes private files and process groups.
Provider failures pause work with visible health status and recovery. Usage-limit pauses survive restarts. Reply drafting now finishes before conversation state is committed, avoiding lost or duplicated replies after a provider outage. Across both providers, native mailbox reads and reply handling precede queued sends; failed or timed-out reply processing holds sends until recovery. This fixes the prior race between stop-on-reply cancellation and outbox delivery.
Validation completed before opening this PR
The initial feature sources matched the final locally validated snapshot. Follow-up commit
a16e640fixes dashboard UTF-8 decoding and adds four regression cases; the complete remote CI matrix passes on this commit.The 19 skips are the 18 real-CLI tests and one packaging test, each executed separately above. Linux suites used purpose-built containers without external networking or credentials. Real-CLI security tests use Codex 0.159.3 against localhost mocks. Wheel build/install and CLI smoke checks also passed on both Linux architectures.
git diff --checkpassed.Additional live synthetic acceptance:
No real emails were sent. Live model checks used disposable synthetic state and a capturing-only mail transport. No production deployment or live SMTP delivery was tested.
The new GitHub Actions matrix covers Python 3.11/3.12 on Linux, macOS and Windows. Codex integration steps run only on Linux/macOS; Windows runs the remaining suite and unsupported-platform guards. Remote CI now passes all six jobs on commit
a16e640: Python 3.11 and 3.12 on Linux, macOS and Windows. See the successful CI run. Results in the table above record the original local validation.Supported scope and limitations
brain.model: gpt-5.5, and a file-based ChatGPT login in~/.codex/auth.jsonor$CODEX_HOME/auth.json, using the documented checkout installation.codex loginto renew it roughly every eight days; expiry or renewal due pauses Harvey safely.Existing Instantly delivery-failure semantics are unchanged: a failure after storing a handled reply does not automatically retry that answer. This PR does not claim to fix that pre-existing delivery limitation.
Windows dashboard regression fix
The initial Windows CI run exposed a pre-existing bug: dashboard assets were read with the host default encoding, causing CP1252 decoding to fail on UTF-8 CSS. HTML and text assets now explicitly use UTF-8. Four regression cases simulate a CP1252 default for HTML, CSS, JavaScript and SVG and assert exact response text and bytes. All four failed before the fix and passed afterward; all 21 dashboard tests passed locally. Both native Windows CI jobs now pass, along with all Linux/macOS jobs. Codex itself remains unsupported on Windows.