Skip to content

fix: resolve merge conflicts in codex-rs workspace (143 tests passing) - #559

Merged
KooshaPari merged 2 commits into
mainfrom
feat/journey-impl
May 2, 2026
Merged

fix: resolve merge conflicts in codex-rs workspace (143 tests passing)#559
KooshaPari merged 2 commits into
mainfrom
feat/journey-impl

Conversation

@KooshaPari

@KooshaPari KooshaPari commented May 1, 2026

Copy link
Copy Markdown
Owner

User description

Resolve 187 files with uncommitted merge conflict markers across the codex-rs workspace.

Key fixes:

  • Added serde TryFrom for MacOsAutomationPermission
  • Fixed execpolicy parameter signatures
  • Resolved core features/plugins module conflicts
  • Fixed OAuth and state migration imports

143 tests now passing in codex-protocol.

Changelog: fix


Note

High Risk
Touches core app-server request/notification wiring (protocol enums, outgoing request tracking, thread lifecycle) and cloud-requirements auth/error handling, so regressions could break client/server compatibility or startup behavior despite being largely conflict-resolution.

Overview
Resolves widespread merge-conflict fallout by reconciling codex-rs app-server protocol and server implementations with upstream changes.

This updates JSON-RPC surface area and event handling (new experimental thread elicitation endpoints, MCP elicitation/permissions approval, additional realtime notifications/fields like transcript updates, audio item_id, and SkillsChanged). It also refactors parts of request execution and thread lifecycle management (request context tracking, safer shutdown/unsubscribe behavior, listener/raw-event tracking) and aligns CLI/TUI entrypoints with remote/app-server mode and OAuth scope resolution.

Cloud requirements loading is hardened with structured error codes/metrics and improved auth recovery paths, and tests are adjusted to match the new behaviors and payloads.

Reviewed by Cursor Bugbot for commit c1788fa. Bugbot is set up for automated code reviews on this repo. Configure here.


CodeAnt-AI Description

Reconcile protocol and realtime changes across the app server and client

What Changed

  • Restores missing request, response, and notification types so the app server can handle newer thread, MCP, skills, and realtime events.
  • Realtime websocket handling now keeps transcript updates and session state in sync, and connects using the same custom certificate setup as other network traffic.
  • Fixes protocol type conversions and imports so thread and user-input data serialize and deserialize correctly again.
  • Updates the CLI guide name to match the current project name.

Impact

✅ Fewer client/server compatibility breaks
✅ Clearer realtime transcript updates
✅ Fewer startup and connection failures

🔄 Retrigger CodeAnt AI Review

Details

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

codex and others added 2 commits May 1, 2026 09:49
Resolved 187 files with uncommitted merge conflict markers across:
- codex-protocol (model types, approval types, execpolicy, network-proxy)
- codex-execpolicy (matches_for_command_with_options signature)
- codex-core (features/plugins modules, git_info_tests)
- codex-rmcp-client (OAuth launch_browser param, test imports)
- codex-state (runtime init, agent_jobs, migrations)
- codex-network-proxy (audit_endpoint_override param)
- app-server-protocol (common, v1, v2, thread_history)

Key fixes:
- protocol: models.rs — add `try_from = "MacOsAutomationPermissionDe"` to
  MacOsAutomationPermission to enable array-based JSON deserialization
  (143 tests passing, up from 140 with 3 failed)
- app-server-protocol: v1.rs — add missing imports (Uuid, ByteRange, TextElement,
  EventMsg) and fix CoreByteRange → ByteRange
- execpolicy: remove stale `heuristics_fallback` param from 3 call sites
- core: lib.rs — keep Phenotype features module, resolve plugins conflict
- state: runtime.rs — add LOGS_MIGRATOR and STATE_MIGRATOR imports

Strategy: keep HEAD (Phenotype) for most conflicts; accept upstream additions
where they add new fields/parameters not in HEAD.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 1, 2026 18:11
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented May 1, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:S This PR changes 10-29 lines, ignoring generated files label May 1, 2026
<<<<<<< HEAD
"samplesPerChannel": 512
=======
"samplesPerChannel": 512,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The expected JSON in this test contains the samplesPerChannel key twice, which means the first occurrence is overwritten when building the object and the assertion no longer validates a single, unambiguous payload shape. Keep only one samplesPerChannel entry so the test correctly guards serialization behavior. [logic error]

Severity Level: Major ⚠️
- ⚠️ Realtime audio delta serialization test less precise guard.
- ⚠️ Potential regressions in samples_per_channel may go undetected.
Steps of Reproduction ✅
1. From the repo root `/workspace/helios-cli`, run the app-server protocol tests (e.g.,
`cargo test -p app-server-protocol`), which executes
`codex-rs/app-server-protocol/src/protocol/common.rs` tests including
`serialize_thread_realtime_output_audio_delta_notification` at lines 1607–1639.

2. In that test (`common.rs:1608`), the expected JSON is built with `serde_json::json!({
... })`; inside the `"audio"` object at `common.rs:1627-1633`, the key
`"samplesPerChannel"` appears twice: once at `common.rs:1630` and again at
`common.rs:1631` (the line in question).

3. When this test runs, the `json!` macro creates a `serde_json::Value::Object` map;
inserting the same key twice causes the second insertion (`common.rs:1631`) to overwrite
the first (`common.rs:1630`), so the constructed expected value contains only one
`"samplesPerChannel"` entry even though the test source shows two.

4. Because both entries use the same literal value `512`, the test still passes even if
future changes accidentally alter or drop the `samples_per_channel` field
serialization—the duplicated key in the expectation means the assertion no longer clearly
validates a single, unambiguous payload shape for the realtime audio notification.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** codex-rs/app-server-protocol/src/protocol/common.rs
**Line:** 1631:1631
**Comment:**
	*Logic Error: The expected JSON in this test contains the `samplesPerChannel` key twice, which means the first occurrence is overwritten when building the object and the assertion no longer validates a single, unambiguous payload shape. Keep only one `samplesPerChannel` entry so the test correctly guards serialization behavior.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

use uuid::Uuid;
use codex_protocol::ThreadId;
use codex_protocol::user_input::ByteRange;
use codex_protocol::user_input::TextElement;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The new import brings TextElement into scope without the alias that the existing conversion impls use (CoreTextElement). Because the impl blocks below reference CoreTextElement, this change breaks name resolution for those conversions. Import it with the expected alias (or update the impl signatures to use the same name) so the type mapping remains valid. [type error]

Severity Level: Critical 🚨
- ❌ App-server-protocol crate fails to compile due to unresolved type.
- ⚠️ Blocks updating app-server JSON-RPC v1 protocol types.
Steps of Reproduction ✅
1. Build the workspace (e.g., `cargo check -p app-server-protocol`) which compiles
`codex-rs/app-server-protocol/src/protocol/v1.rs`.

2. During compilation, the Rust compiler reaches the conversion impls at
`codex-rs/app-server-protocol/src/protocol/v1.rs:326-337`:

   `impl From<CoreTextElement> for V1TextElement` and `impl From<V1TextElement> for
   CoreTextElement`.

3. Because the file only imports `codex_protocol::user_input::TextElement` (line 8) and
never defines or aliases `CoreTextElement`, the compiler reports an `unresolved name
'CoreTextElement'` error for these impls.

4. Compare with `codex-rs/app-server-protocol/src/protocol/v2.rs:86-90`, where
`codex_protocol::user_input::TextElement` is imported as `CoreTextElement`; this
establishes that v1 is missing the same alias, confirming the suggestion that
`TextElement` should be imported as `CoreTextElement` (or the impls updated to use
`TextElement` directly).

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** codex-rs/app-server-protocol/src/protocol/v1.rs
**Line:** 8:8
**Comment:**
	*Type Error: The new import brings `TextElement` into scope without the alias that the existing conversion impls use (`CoreTextElement`). Because the impl blocks below reference `CoreTextElement`, this change breaks name resolution for those conversions. Import it with the expected alias (or update the impl signatures to use the same name) so the type mapping remains valid.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines 478 to 497
@@ -504,25 +495,21 @@ impl RealtimeWebsocketClient {
)
.await
.map_err(|err| ApiError::Stream(format!("failed to connect realtime websocket: {err}")))?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Architect Review — HIGH

RealtimeWebsocketClient::connect() performs two sequential websocket connection attempts: it first calls connect_async_with_config using the default TLS connector and returns on failure, and only then builds and uses the optional custom-CA TLS connector via connect_async_tls_with_config. This both prevents custom-CA configuration from ever being applied on failing default-TLS handshakes (breaking environments that require a custom CA) and causes an unnecessary second connection attempt even when the first succeeds.

Suggestion: Remove the initial connect_async_with_config call and instead unconditionally use connect_async_tls_with_config with the optional custom-CA connector (following the pattern in responses_websocket.rs), so there is a single connection attempt that always honors the custom-CA policy.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs
**Line:** 478:497
**Comment:**
	*HIGH: RealtimeWebsocketClient::connect() performs two sequential websocket connection attempts: it first calls connect_async_with_config using the default TLS connector and returns on failure, and only then builds and uses the optional custom-CA TLS connector via connect_async_tls_with_config. This both prevents custom-CA configuration from ever being applied on failing default-TLS handshakes (breaking environments that require a custom CA) and causes an unnecessary second connection attempt even when the first succeeds.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix

@codeant-ai

codeant-ai Bot commented May 1, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@KooshaPari
KooshaPari merged commit eae259b into main May 2, 2026
17 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants