feat: Codex CLI Proxy (App-Server Architecture) — PROJECT-SPEC.md#1
Open
sterling-prog wants to merge 4 commits into
Open
feat: Codex CLI Proxy (App-Server Architecture) — PROJECT-SPEC.md#1sterling-prog wants to merge 4 commits into
sterling-prog wants to merge 4 commits into
Conversation
Bug 1: add return after triggerCleanup in emitDelta when accumulatedSize exceeds maxSize — without it, subsequent deltas still accumulate content after the error cleanup is triggered. Bug 2: call triggerCleanup after sendNonStreamingResponse in onTokenUsageUpdated grace period path — slot was never released, in-flight entry was never removed, archive never ran. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In onAgentMessageDelta, destructured turnId was never applied to inflight.turnId. Spec requires: delta notifications themselves carry turnId and must set inflight.turnId if not already set, triggering buffer replay. Without this, the race window where deltas arrive before both turn/start response and turn/started notification leaves the buffer unresolved until turn/started eventually arrives. Fix: if !inflight.turnId && turnId, set inflight.turnId = turnId and call flushDeltaBuffer before falling through to emit current delta. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Complete TypeScript implementation of the Codex CLI App-Server proxy (P120).
Modules
src/client/app-server.ts— AppServerClient: WebSocket JSON-RPC client, thread/turn lifecycle,cleanupDoneguard, concurrency+queue, orphan sweep, auth/backend degradation, reconnect with backoffsrc/adapter/request.ts— Chat Completions → ThreadStartParams/TurnStartParams, multi-turn transcript, injection mitigation (ZWS), model validation against cachesrc/adapter/response.ts— SSE helpers, error dispatch, keepalive, Retry-Aftersrc/server/routes.ts+standalone.ts— Express server, global rate limit, bearer auth, health endpoints (/healthz /readyz), env validation, graceful 30s drain, /tmp/codex-proxy mkdirecosystem.config.js— PM2 config for codex-app-server + codex-proxy, kill_timeout: 35000, wait_readyscripts/codex-auth-check.sh— JWT exp decode, 48h Discord alert to #infra-agent-swarmBuild
npm run build— tsc, zero errorsSpec
/home/gpu1/.openclaw/workspace-scope/specs/codex-proxy/PROJECT-SPEC.md