Commit de21189
authored
feat: update codex adapter and migrate to base acp prxy for agent (#1480)
TLDR: upgraded codex acp bin and started moving over to similar proxy agent as claude agent sdk
## Problem
The Codex adapter was using a raw stream transformation approach that made it difficult to implement PostHog-specific features like session tracking, usage accumulation, and proper session resume/fork capabilities. This approach also lacked proper interception points for ACP protocol messages.
## Changes
**Upgraded codex-acp binary from v0.9.5 to v0.11.1** to get the latest features and bug fixes.
**Replaced raw stream transformation with proper ACP Agent implementation:**
- Created `CodexAcpAgent` class that implements the ACP Agent interface
- Added `CodexClient` to handle delegation between codex-acp subprocess and upstream PostHog Code client
- Implemented proper session state tracking with `CodexSessionState` and `CodexSettingsManager`
- Added support for session resume/fork operations (not natively supported by codex-acp)
**Enhanced PostHog integration:**
- Proper `_posthog/sdk_session` notification emission for session tracking
- Usage accumulation and `_posthog/usage_update` notifications
- Session metadata handling for task runs and persistence
**Improved architecture:**
- Moved from direct stream manipulation to proper ACP protocol handling
- Added consistent settings management interface shared with Claude adapter
- Better error handling and cleanup for subprocess management
- Proper terminal handle delegation for codex-acp terminal operations1 parent 354a624 commit de21189
File tree
7 files changed
+765
-337
lines changed- apps/code/scripts
- packages/agent/src/adapters
- codex
7 files changed
+765
-337
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
0 commit comments