fix: improve macOS restart and mixed Responses relay handling#319
Open
ASH521 wants to merge 2 commits into
Open
fix: improve macOS restart and mixed Responses relay handling#319ASH521 wants to merge 2 commits into
ASH521 wants to merge 2 commits into
Conversation
(cherry picked from commit ab91f35f609300c03a06f0b638e5af0d59dc19f1)
(cherry picked from commit c58aa8592f5588f459f51d63f4643b3b7347f7df)
f8ccb3d to
6db866c
Compare
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
This PR fixes two issues that are still reproducible on the current upstream
main:The two fixes are related from a user workflow perspective: both affect the manager's ability to apply a working Codex/Codex++ runtime after switching between official API and relay configurations. I am happy to split this into two PRs if that is easier to review.
Problem 1: macOS restart reliability
Symptom
On macOS, clicking restart from the manager can leave the current Codex/Codex++ process running instead of closing it and starting a fresh instance. Manually quitting the app first, then launching again, works.
Cause
The restart path only stopped broad launcher/Codex process names. It did not consistently:
.appbundle before cleanup.That can make the relaunch race the previous app instance or fail because a required port is still busy.
Fix
This PR adds a macOS launch-preparation step used by both launch and restart:
The port cleanup is intentionally constrained to Codex-related processes to avoid killing unrelated local services.
Problem 2: mixed Responses relay with hosted image tools
Symptom
In mixed relay mode, a request to the local Responses endpoint can fail with a 502 like:
A relay may support
/v1/responsestext traffic but reject hosted image-generation tools. In that case the current request path can leave the user with a misleading local proxy error instead of a working text request.Cause
The protocol proxy was enabled only for Chat Completions relay mode. Mixed relay mode can also need the local proxy when the active protocol is Responses and the relay is using the official API-key mix.
In addition, the payload still carried hosted image-generation tool declarations and related response includes/tool choices. Some third-party Responses-compatible relays reject those fields even when the user is not trying to generate an image.
Fix
This PR updates the mixed Responses relay handling to:
/v1/responsesrequests through the proxy in that mixed case.image_generationimageGenerationtool_choiceincludeentries such asimage_generation_call.*This keeps text Responses traffic usable on relays that do not support hosted image generation, while avoiding an accidental fallback into an unsupported Chat Completions path.
Validation
Ran the focused Rust test set locally:
cargo test -p codex-plus-core --test launcher --test watcher --test protocol_proxy --test relay_configResult:
launcher: 39 passedwatcher: 8 passedprotocol_proxy: 17 passedrelay_config: 21 passedNotes
The PR also includes short hotfix notes documenting the investigation and behavior changes for each issue.