What variant of Codex are you using?
CLI
What feature would you like to see?
Feature Description
We are integrating Codex into an automated R&D workflow system ([workflow-kit](https://github.com/quliugithub/workflow-kit)) governed by strict Quality Gates (Gate 1~4: Requirement confirmation,
OpenSpec plan review, test validation, and release audit).
In our architecture, an external daemon/controller (e.g., IM bot on Slack/Feishu/Telegram) triggers Codex tasks based on Jira issues, pauses execution at Quality Gates, sends interactive approval cards
to human reviewers via IM, and resumes/steers the ongoing Codex Thread upon receiving human feedback.
To make this headless, event-driven workflow seamless and cache-friendly, we would like to request first-class, stable support for **Thread Steering and Long-running Session Management**.
### Use Case & Scenario
1. **Automated Trigger**: A cron/daemon polls Jira, creates a Git Worktree, and initializes a Codex session for issue `OPS-123`.
2. **Gate Pause**: Codex completes the OpenSpec architecture proposal, outputting the plan and entering a waiting state (`awaiting_plan_gate`).
3. **External Approval**: An IM bot posts an interactive card to a Slack/Feishu channel. The user reviews the plan on their mobile phone and clicks "Approve (Strict Mode)".
4. **Thread Steering / Continuation**: The IM bot receives the webhook callback and needs to inject this approval decision back into the **exact same Codex Thread**, allowing Codex to continue execution
in the same context without losing KV Cache.
---
### Proposed Solution / Requested Capabilities
1. **Stable App-Server Protocol (JSON-RPC / stdio)**:
- Provide a versioned, documented, and stable `app-server` interface.
- Support `turn/start` or `turn/steer` to inject new user turns into an existing `thread_id` programmatically.
2. **Headless CLI Thread Resume Optimization**:
- Ensure `codex exec --thread <thread_id> "<message>"` guarantees 100% Prefix Invariance so that LLM Prompt Caching (KV Cache) hits at near 100% rates.
- Provide a clean way for CLI executions to output structured lifecycle events (e.g., JSON stream / webhook hooks when waiting for input).
3. **Status / Readiness Callback**:
- Expose explicit thread status (e.g., `idle`, `running`, `waiting_input`, `completed`) via API/CLI so external controllers can determine when to prompt the human reviewer.
---
### Additional Context
Currently, we rely on inspecting CLI outputs or using experimental `app-server` APIs. Standardizing these headless steering capabilities will significantly empower developers building autonomous agent
control planes, CI/CD pipelines, and IM-driven coding assistants.
Thank you for your incredible work on Codex!
Additional information
No response
What variant of Codex are you using?
CLI
What feature would you like to see?
Feature Description
OpenSpec plan review, test validation, and release audit).
to human reviewers via IM, and resumes/steers the ongoing Codex Thread upon receiving human feedback.
in the same context without losing KV Cache.
control planes, CI/CD pipelines, and IM-driven coding assistants.
Additional information
No response