Skip to content

Refactor Codex adapter lifecycle helpers#1478

Merged
juliusmarminge merged 2 commits intomainfrom
feature/refactor-codex-adapter-lifecycle
Mar 28, 2026
Merged

Refactor Codex adapter lifecycle helpers#1478
juliusmarminge merged 2 commits intomainfrom
feature/refactor-codex-adapter-lifecycle

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Mar 28, 2026

  • Split adapter setup into named Effect.fn helpers
  • Keep listener registration and cleanup explicit

What Changed

Why

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Refactor-only change in the Codex provider adapter; primary risk is subtle lifecycle/cleanup differences around manager acquisition and event listener registration/shutdown.

Overview
Refactors apps/server/src/provider/Layers/CodexAdapter.ts to break makeCodexAdapter into named Effect.fn helpers, improving stack traces and making the lifecycle steps more explicit.

This extracts helpers for manager acquisition (acquireManager), attachment loading/encoding (resolveAttachment used by sendTurn), and event listener registration/cleanup (registerListener/unregisterListener plus writeNativeEvent), while keeping the adapter’s public operations and error mapping behavior the same.

Written by Cursor Bugbot for commit 9b9c9b3. This will update automatically on new commits. Configure here.

Note

Refactor CodexAdapter lifecycle helpers into named Effect.fn generators

Restructures CodexAdapter.ts to use named Effect.fn generators throughout, improving traceability in Effect traces.

  • Extracts acquireManager as a standalone helper that resolves an existing manager from options or constructs one via CodexAppServerManager
  • Adds resolveAttachment helper to consolidate inline file-reading logic from sendTurn, using Effect.forEach with concurrency 1
  • Extracts registerListener and unregisterListener as named helpers wired via Effect.acquireRelease, and adds writeNativeEvent to isolate native event logging
  • No behavioral changes; all handler logic (session management, turn sending, thread operations) is preserved as-is

Macroscope summarized 9b9c9b3.

- Split adapter setup into named Effect.fn helpers
- Keep listener registration and cleanup explicit
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 01f6268a-0e28-45cf-9b3a-843cfef2fb9e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor-codex-adapter-lifecycle

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

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 28, 2026
- Replace `sendTurn` parameter inference with `ProviderSendTurnInput`
- Keep attachment resolution aligned with shared contracts
@juliusmarminge juliusmarminge merged commit 23b3f0c into main Mar 28, 2026
11 checks passed
@juliusmarminge juliusmarminge deleted the feature/refactor-codex-adapter-lifecycle branch March 28, 2026 01:43
frittlechasm added a commit to frittlechasm/t3code that referenced this pull request Mar 28, 2026
Reverts all 10 commits pulled from upstream (add5f34 through 1ae20fa)
including our local classifySqliteError fix. Upstream introduced a
classifySqliteError import that does not exist in effect@4.0.0-beta.42.
Reverting until upstream resolves the version mismatch.

Reverted commits:
- 1ae20fa fix(persistence): revert classifySqliteError to SqlError({ cause, message })
- 23b3f0c Refactor Codex adapter lifecycle helpers (pingdotgg#1478)
- e08cea3 Improve drain semantics via STM in DrainableWorker (pingdotgg#1474)
- 83eb396 fix(threads): Keep active-turn runtime errors from ending sessions (pingdotgg#1261)
- 59a383e Add Effect.fn refactor checklist (pingdotgg#1476)
- fb72607 fix(claude): avoid resetting the Claude model on every turn (pingdotgg#1466)
- d8a485e Support gh pr checkout pull request references (pingdotgg#1457)
- 02989fe fix(web): improve chat header badge and title flex distribution (pingdotgg#1309)
- 648f067 Add VS Code Insiders and VSCodium to Open In editor picker (pingdotgg#1392)
- add5f34 Add Claude context window selection support (pingdotgg#1422)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). 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