Skip to content

fix(codex): keep app-server protocol decode current - #209

Merged
leoisadev1 merged 5 commits into
mainfrom
fix/codex-app-server-protocol-compat
Sep 11, 2026
Merged

fix(codex): keep app-server protocol decode current#209
leoisadev1 merged 5 commits into
mainfrom
fix/codex-app-server-protocol-compat

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

The retained Codex app-server client still concatenates every stdin chunk into one growing buffer, so large JSONL messages get scanned again and again. Newer Codex 0.150/0.151 values also fail decode: multi-agent tools and activity kinds, extra ChatGPT plan types, and persisted rateLimitExceeded / misalignmentPolicyViolation turn errors. After a recovered Codex session, answering an old approval card can return Unknown pending Codex approval request, which the reactor did not classify as the existing stale-approval failure.

Primary Codex, Kimi, and OpenCode Go turns use Mastra. This change does not switch that path. It keeps provider probes, generated schemas, and leftover app-server sessions from treating current Codex payloads as protocol errors.

Changes

  • Frame incoming JSONL from per-chunk fragments instead of quadratic current + chunk concatenation.
  • Widen generated 0.150 compatibility enums for collab tools, activity kinds, and account plans.
  • Accept historical rateLimitExceeded and misalignmentPolicyViolation on the thread read/resume/rollback/fork and turn/completed schemas without folding them into other.
  • Map the new Business, Enterprise, and Edu plan types onto the existing Codex subscription labels.
  • Classify Codex's missing-approval-callback string as the shared stale approval failure.
  • Keep the generator overrides so the next protocol refresh preserves these variants.

Adapted from T3 Code pingdotgg#8605, pingdotgg#8346, pingdotgg#8447, pingdotgg#8897, pingdotgg#10373, and pingdotgg#5195. Not a bulk cherry-pick. No Mastra turn-path change, no compaction, no restart continuation, and no question-lifecycle work.

Verification

  • vp test run packages/effect-codex-app-server/src/protocol.test.ts packages/effect-codex-app-server/src/schema.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts --maxWorkers=2: 89 passed, including fragmented 4MiB notifications, 1/7/1024-byte JSONL/UTF-8 framing, malformed final lines, 0.150 enums, plan types, historical error variants, and stale Codex approval recovery.
  • vp run --filter effect-codex-app-server typecheck and vp run --filter akeru-bot typecheck passed (existing Effect suggestions only).
  • Targeted lint and format on the changed files passed.

No live Codex CLI session or paid provider call was used. Browser and native clients are unchanged. Settings Codex account labels for the new plan types are covered by the schema decode tests and the exhaustiveness check on codexAccountAuthLabel.

Limitations

Codex chat turns still go through Mastra. App-server thread/resume decode now accepts the extra historical error values, but that only helps retained CodexAdapter/session-runtime consumers and provider probes. Other workers own compaction, restart continuation, and question lifecycle.

Implemented with Grok 4.6 High in Grok Build via Orca.

Large Codex app-server messages were re-scanned on every chunk, and newer 0.150/0.151 enum values failed decode on account probes and historical thread payloads. Stale Codex approval callbacks also missed the shared recovery classifier.

Adapt T3 Code pingdotgg#8605, pingdotgg#8346, pingdotgg#8447, pingdotgg#8897, pingdotgg#10373, and pingdotgg#5195 to the retained effect-codex-app-server client and ProviderCommandReactor. Primary Codex turns still use Mastra; this keeps probes, generated schemas, and leftover app-server sessions compatible.

Made with Grok 4.6 High in Grok Build via Orca.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
akeru-bot-landing Building Building Preview Sep 10, 2026 5:29pm UTC

Request Review

@github-actions github-actions Bot added type:provider Agent provider contribution. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

The PR extends Codex protocol compatibility handling for retained historical values, including thread-list responses, while preserving fragmented JSONL framing behavior and focused regression coverage.

Confidence Score: 5/5

Safe to merge.

The previously reported thread-list compatibility issue is resolved without explanation by greptile-apps[bot]. No outstanding findings remain.

Files Needing Attention: None.

Reviews (5): Last reviewed commit: "Merge branch 'main' into fix/codex-app-s..." | Re-trigger Greptile

Comment thread packages/effect-codex-app-server/scripts/generate.ts
thread/list still rejected persisted rateLimitExceeded and misalignmentPolicyViolation values after read/resume learned them. One historical failed turn could fail the whole list response.

Keep the same generator compatibility override and generated schema variants on V2ThreadListResponse.

Made with Grok 4.6 High in Grok Build via Orca.
@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent.

Greptile's 'Bound inventory refreshes' finding in apps/server/src/provider/opencodeRuntime.ts is valid: I traced loadInventoryFromCli through checkOpenCodeProviderStatus, OpenCodeDriver, and makeManagedServerProvider; the inventory path has no deadline, while the four-second timeout covers only the version probe. This was inherited from already merged #205. I requested a separate current-main repair with child cleanup and semaphore-release regression tests through the existing OpenCode worker, but execution is blocked by service 503 errors and exhausted weekly usage. This PR remains on hold; the defect is not dismissed as outside the diff.

@leoisadev1
leoisadev1 merged commit 9f93b84 into main Sep 11, 2026
11 checks passed
@leoisadev1
leoisadev1 deleted the fix/codex-app-server-protocol-compat branch September 11, 2026 12:23
@github-actions github-actions Bot mentioned this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL type:provider Agent provider contribution. 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