[Feature Request] First-class support for Headless Thread Steering & Stable App-Server API for external workflow controllers

Open 💬 2 comments Opened Aug 3, 2026 by quliugithub
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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) 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.
  1. 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).
  1. 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_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 25 days ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #36571
  • #36526

Powered by Codex Action

PRO-2684 · 3 days ago

A concrete CLI surface would help external controllers and agent tooling avoid reimplementing app-server transport details:

codex steer \
  --thread THREAD_ID \
  --expected-turn TURN_ID \
  --message MESSAGE \
  [--remote ENDPOINT] \
  [--remote-auth-token-env NAME]

Desired behavior:

  • Discover and use the standalone/default local daemon, including Unix sockets.
  • Support an explicit Unix/WebSocket app-server endpoint using existing authentication.
  • Inject into the active turn without interrupting it or starting another turn.
  • Reject a stale or mismatched --expected-turn.
  • Return synchronously after server acceptance.
  • Expose structured outcomes such as steered, no-active-turn, turn-mismatch, and delivery failure.
  • Preserve or accept a client message ID for idempotent retries.

One motivating case is a detached wait helper that needs to verify its delivery route while the originating tool call remains active. Today it must queue a probe, end the model turn, and wait for that probe to return in a second turn. A transport-aware codex steer command would let the helper steer the probe into the active turn and fail immediately when it targets the wrong app-server or turn.