Skip to content

feat: integrate OpenAI Codex mode for reasoning tasks#11149

Closed
Anurag13075 wants to merge 1 commit into
stackblitz:mainfrom
Anurag13075:feature/codex-integration
Closed

feat: integrate OpenAI Codex mode for reasoning tasks#11149
Anurag13075 wants to merge 1 commit into
stackblitz:mainfrom
Anurag13075:feature/codex-integration

Conversation

@Anurag13075
Copy link
Copy Markdown

OpenAI Codex Integration 🤖✨
Description
This PR introduces an end-to-end integration of the OpenAI Codex (codex-mini-latest) reasoning model into Bolt.new. The Codex model provides a completely different paradigm for AI coding—rather than a conversational streaming loop, it uses the OpenAI Responses API to deeply reason through complex software tasks and generate structured, comprehensive file tree mutations.

This feature is built as a non-destructive, additive layer that operates seamlessly alongside the existing conversational flow.

Key Features & Changes
🔑 Settings Panel / API Key Config: Added a new robust Settings overlay (accessible via the sidebar menu) to safely store and manage the OPENAI_API_KEY. It persists to a cookie to seamlessly pipe into the server action, or falls back to Cloudflare env bindings.
🎛️ Codex Toggle Switch: Added a "Codex / Instant" badge toggle directly into the chat toolbar. It enables users to explicitly opt into deep reasoning mode.
⏳ Live Execution Tracker: Implemented a responsive CodexProgress UI widget that gives users live feedback on the reasoning process (e.g., "Planning file changes...", "Writing implementation..."), along with an elapsed timer to mitigate UX friction during longer reasoning loops (30-120s).
⚙️ Remix API Action (api.codex.ts): Built a robust backend passthrough for the OpenAI Responses API that validates the API Key, safely compiles the current file tree context from the WebContainer, sets the 16k output tokens max, and feeds the resulting string straight back into the client pipeline.
⚡ Zero-Regression Architecture: Integrated directly into workbenchStore and the existing StreamingMessageParser. This ensures that Codex's structured files trace exactly the same execution path as normal chat without interfering with the standard streaming infrastructure.
🔧 Bug Fixes: Lazily loaded the workbenchStore inside BaseChat.tsx to fix a path-browserify SSR reference error that leaked into the Vite node environment.
Visuals
(Feel free to add screenshots or screen recordings of the feature here!)

Testing Checklist
Configured OPENAI_API_KEY in worker-configuration.d.ts and wrangler.toml
Verified Settings UI successfully saves the API Key to local cookies.
Tested the Codex toggle UX and chat placeholder updates.
Submitted a prompt in Codex mode, verifying the CodexProgress state rotates and handles elapsed time properly.
Verified the api.codex.ts endpoint successfully fetches and parses the response.
Verified the generated code executes and updates the WebContainer accurately.
Ensured standard Instant mode operates without interference or regressions.
Notes
The codex-mini-latest endpoint relies on the v1/responses API format and requires native fetch capabilities to maintain package leanness. No heavy SDKs were installed.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@Anurag13075 Anurag13075 closed this by deleting the head repository May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant