You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 356abaf
Browse filesBrowse the repository at this point in the historyBrowse files
If a Codex turn finishes just before `_session/steering` reaches it, the
adapter starts another turn and returns `startedNewTurn`. The client
never receives that new prompt's final response. If the original prompt
is still waiting for plan approval, steering waits too, which can block
clients that process steering and permission replies serially.
This adds the opt-in requested in agentclientprotocol#440:
```json
{"_meta":{"steering":{"idleBehavior":"promptRequired"}}}
```
Live turns still receive the input through native steering. When no turn
can accept it, the adapter returns `promptRequired` with `reason:
"noRunningTurn"`, leaving the input unconsumed and starting no new turn.
The client can answer any pending approval, wait for the original prompt
to finish, then send the input through a normal `session/prompt`. Calls
without the option behave as before.
This builds on @fontanierh's patch in agentclientprotocol#441, cherry-picked with the
original author and source reference preserved. I added regression tests
for pending plan approval, malformed metadata tests, and usage
documentation.
Fixesagentclientprotocol#440.
## Testing
- 33 targeted tests passed. The pending-plan-approval steering tests
timed out before the fix.
- Typecheck, build, and all six standalone binary targets passed.
- Tested idle, live-turn steering, and pending plan approval with real
Codex. Steering returned in 1 ms while approval was pending; rejecting
implementation completed the original prompt with its stop reason,
usage, and quota.
- Full suite on Windows: 1,205 passed, 19 failed, 36 skipped. All 19
failures reproduced on unmodified main at `4583cb3`, in history,
attachment, and path assertions.
The real Codex tests used temporary local runners, adapted for the
removed `authRequired()` call in the repository's test script.
Cancellation dispatch has unit coverage; the real test used the
reject-plan path.
For clients: `promptRequired` is a steering result, not completion of
the original prompt or its approval request. The existing
`_meta.steering.supported` flag also does not distinguish support for
this option, so clients need to check the adapter version.
---------
Co-authored-by: jim <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ Use [OpenAI Codex](https://github.com/openai/codex) from [Agent Client Protocol]
16
16
- Compact file changes through the negotiated [AIR diff patch extension](docs/air-extensions.md#diff-patch).
17
17
- For AIR, one tool call shape with each fact in one field, as the [tool call contract](docs/air-extensions.md#tool-call-contract) defines. Other clients keep the earlier fields.
18
18
-[Native ACP subagent sessions](docs/subagent-sessions.md) (after capability negotiation) with separate child histories and root-routed permissions; a legacy tool-call fallback otherwise.
19
+
- Mid-turn input through the [_session/steering extension](docs/steering.md), with an opt-in host-owned fallback when no turn can accept it.
19
20
-[Background terminal tasks](docs/air-extensions.md#async-tasks) in AIR, with task status and targeted stop support after capability negotiation.
20
21
- Session-scoped long-running goals in AIR through the [goal extension](docs/air-extensions.md#goal).
21
22
- Typed warnings and errors through the opt-in [AIR session failure extension](docs/air-extensions.md#session-failure).
Copy file name to clipboardExpand all lines: docs/air-extensions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ The adapter keeps them where they are.
243
243
|`mcp_output_delta`| tool call `_meta.mcp_output_delta = {data}`| MCP progress text to append, trimmed. AIR does not get it. |
244
244
|`is_mcp_tool_call`| tool call `_meta.is_mcp_tool_call: true`| The tool call is an MCP tool call. |
245
245
|`is_mcp_tool_approval`|`session/request_permission` request `_meta.is_mcp_tool_approval: true`| The permission request approves an MCP tool call. |
246
-
|`steering`|`initialize` response `_meta.steering = {supported: true}`| The agent accepts `_session/steering` for a running turn. |
246
+
|`steering`|`initialize` response `_meta.steering = {supported: true}`| The agent accepts `_session/steering` for a running turn; see [session steering](steering.md). |
247
247
|`quota`|`PromptResponse._meta.quota`| Token usage of the whole turn, the same counts as `PromptResponse.usage`: `token_count` and one `model_usage` entry for the current model, or `null` and `[]` when Codex reported no usage for the prompt, as for a prompt that started no turn. |
248
248
|`authStatus`|`initialize` response `agentCapabilities._meta.authStatus`| The agent pushes `_auth/status_update`. The object carries no payload. |
-`prompt` uses the same content blocks as `session/prompt`. Image blocks are rejected with
26
+
`invalidRequest` when the active model has no image input support.
27
+
-`_meta` is optional and may be `null`.
28
+
- An `idleBehavior` value other than `"promptRequired"` is rejected with `invalidParams`.
29
+
- Steers for one session are serialized in arrival order; steers for different sessions run
30
+
concurrently.
31
+
32
+
## Outcomes
33
+
34
+
| Outcome | Meaning |
35
+
| --- | --- |
36
+
|`injected`| The prompt joined the running turn. |
37
+
|`startedNewTurn`| No turn was running, and the adapter started one with the steer content. The response arrives once the turn is running; the turn's output follows the usual session updates, and its completion, usage, and failure reporting belong to that turn, not to this response. |
38
+
|`promptRequired`| Returned with `reason: "noRunningTurn"` when the client opted into `idleBehavior: "promptRequired"` and no turn can accept the input, including while the original prompt is waiting for plan approval. The input is not consumed and no turn is started. |
39
+
|`failed`| The steer could not be applied due to an unexpected error. Errors the protocol defines are thrown as JSON-RPC errors instead. |
40
+
41
+
## Host-owned idle fallback
42
+
43
+
Without the opt-in, a steer that finds no running turn falls back to `startedNewTurn`: the
44
+
adapter starts the turn itself. A client that wants to keep the normal prompt lifecycle
it('reports injected when the input joins the active turn',async()=>{
53
+
it.each([null,undefined,{steering: {idleBehavior: "promptRequired"}}])('reports injected when the input joins the active turn (metadata: %j)',async(_meta)=>{
0 commit comments