Skip to content

feat(harness): Codex Elixir session feature parity - #4

Merged
ranvier2d2 merged 1 commit into
mainfrom
feat/codex-elixir-parity
Mar 24, 2026
Merged

ranvier2d2 merged 1 commit into
mainfrom
feat/codex-elixir-parity

Conversation

@ranvier2d2

@ranvier2d2 ranvier2d2 commented Mar 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements 7 missing features in the Elixir CodexSession GenServer for full parity with the Node codexAppServerManager.ts:

  1. Version checking — semver parse, minimum 0.37.0, user-friendly error messages
  2. Account/Spark model gating — account/read RPC, downgrade spark for free/go/plus plans
  3. Plan mode collaboration — build_collaboration_mode/3 with full developer instructions
  4. Binary path + CODEX_HOME — resolve_codex_binary/1, env var passed to Port.open
  5. Fast mode + reasoning effort — modelOptions.codex.fastMode → serviceTier, reasoningEffort mapping
  6. Thread resume fallback — detect recoverable errors, retry with thread/start
  7. Collab child suppression — track receiver threads, suppress 13 notification types

Init flow changed: spawn → initialize → account/read → start_thread

Test plan

  • mix compile — compiles clean, no warnings
  • Manual: start Codex session with custom binaryPath
  • Manual: verify spark model downgrade on free plan
  • E2E: Codex provider test still passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Codex adapter now enforces minimum version requirement and includes account-aware model selection based on plan type.
    • Added support for resuming Codex sessions across interactions.
    • Enhanced notification filtering for collaborative conversations.
  • Bug Fixes

    • Improved startup failure handling and error recovery for interrupted operations.
  • Chores

    • Updated .gitignore to exclude test result artifacts.

Implements 7 missing features in CodexSession GenServer:

1. Binary path + CODEX_HOME: resolve from providerOptions, pass env to Port
2. Version checking: semver parse + compare against minimum 0.37.0
3. Account/Spark gating: account/read RPC, downgrade spark for free/go/plus
4. Fast mode + effort: modelOptions.codex.fastMode → serviceTier, reasoningEffort
5. Plan mode: build collaborationMode with developer_instructions
6. Thread resume fallback: detect recoverable errors, retry with thread/start
7. Collab child suppression: track receiver threads, suppress 13 notification types

Init flow: spawn → initialize → account/read → start_thread

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@github-actions github-actions Bot added size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 24, 2026
@coderabbitai

coderabbitai Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The changes add .gitignore entries for E2E test artifacts, enhance the Codex adapter with CLI version enforcement and binary resolution, introduce account-based model selection and thread resume handling, update notification tracking for collaboration events, and add test run status files.

Changes

Cohort / File(s) Summary
Configuration
apps/harness/.gitignore
Added entries to ignore E2E test result directories (apps/web/e2e-results/ and test-results/).
Codex Adapter Enhancement
apps/harness/lib/harness/providers/codex_session.ex
Introduces Codex CLI version enforcement (minimum 0.37.0), binary path resolution, and CODEX_HOME environment injection. Adds account read gating during initialization and plan-based model selection. Implements thread resume flow with fallback to thread start on specific errors. Refactors state shape to track binary path, codex home, account snapshot, and collaboration receiver turns. Updates notification handling to suppress child conversation notifications from tracked receiver threads.
Test Artifacts
apps/web/e2e-results/.last-run.json, test-results/.last-run.json
Added test run status files recording execution results (one passed, one failed) with empty failed test arrays.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Codex as Codex Session
    participant CLI as Codex CLI
    participant Account as Account Service
    participant Thread as Thread Service
    participant Notify as Notification Handler

    Client->>Codex: Initialize
    Codex->>CLI: Execute --version (timeout)
    CLI-->>Codex: Version response
    alt Version mismatch
        Codex-->>Client: Startup failure
    else Version OK
        Codex->>Account: account/read (gating)
        Account-->>Codex: Account snapshot + plan type
        Codex->>Codex: Select model based on plan
        alt Thread resume flow
            Codex->>Thread: thread/resume
            alt Resume succeeds
                Thread-->>Codex: Resume response
            else Resume fails (specific errors)
                Codex->>Thread: thread/start (fallback)
                Thread-->>Codex: Start response
            end
        else First start
            Codex->>Thread: thread/start
            Thread-->>Codex: Start response
        end
        Codex->>Codex: Store state (binary_path, codex_home, account, collab_receiver_turns)
        Codex->>Notify: Track collab receiver threads
        Codex-->>Client: Ready
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Hops with glee through version checks,
Binary paths and home directives flex,
Account-aware models now choose the way,
Thread resume flows keep conversations at bay,
Notifications skip the child turns today! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: implementing Codex Elixir session feature parity, which is clearly the primary focus of this changeset.
Description check ✅ Passed The description comprehensively covers all required sections: what changed (7 features listed), why (achieving parity with Node implementation), init flow changes, and a test plan with specific items checked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/codex-elixir-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ranvier2d2
ranvier2d2 merged commit 9dcb48b into main Mar 24, 2026
7 of 8 checks passed
ranvier2d2 added a commit that referenced this pull request Mar 30, 2026
- Reply to ready_waiters in terminate/2 so callers get a meaningful
  error instead of bare {:EXIT, pid, :normal} during handshake crashes
- Clear pending session/prompt entry on interrupt_turn to prevent stale
  responses from completing the wrong turn after cancel + new turn
- Sanitize PII from test fixtures (real paths → /workspace/t3code-OTP,
  session UUIDs → deterministic test values)
- Fix task doc: pending map key type String.t() → integer(), stale
  authMethods path reference in Risk #4
- Add opencode.jsonc to .gitignore (contains API key)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant