microsoft / microsoft/vscode

Agent Host: Codex steering with attached context stays pending after consumption

Open
#335,546 0 comments 0 reactions 1 assignee Assigned to @Giuspepe View on GitHub
bug
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Codex can consume and answer a steering message while the message remains under **Steering** in the Agent Host chat UI when attached context expands its input text.

## Reproduction

1. Start a Codex Agent Host task and let it continue working.
2. Send a steering message with a text-bearing attachment, such as automatically attached browser context, a selected file, or an embedded text selection.
3. Observe Codex respond to that message while its pending steering entry remains visible.

Expected: the consumed input echo promotes the original steering message and clears its pending entry before the response is attributed to it.

Actual: the adapter fails to correlate the consumed input with the pending message. The response continues in the existing turn and the pending entry remains until later cleanup.

## Cause

In `codexAgent.ts`, `setPendingMessages` calls `resolveCodexInput(text, attachments)`, which appends textual context, but stores the original `PendingMessage`. `_takeMatchingPendingSteering` compares the SDK's echoed input with `msg.message.text` using exact equality.

For example, the original message `Review this page` is sent and echoed as `Review this page\n\nBrowser context`. The two values cannot match. Matching should retain the exact resolved input sent to Codex while preserving the original message for display.

This path is present in the untouched VS Code 1.137.0 (`645f29cc3176500b4b5762ba887cf2a7f0ffdf2c`) bundle and upstream source. The live observation was on a locally patched installation; comparison with its untouched backup confirms that the matcher, input resolver, and steering buffering code were unchanged by those local patches. The raw-text matcher was introduced in upstream commit https://github.com/microsoft/vscode/commit/5087b226497afa1f2fe1b5ccaa4537654d1eb445.

Codex 0.149.1 emits both started and completed events for consumed user input. A successful `turn/steer` response only acknowledges submission, so clearing pending state on that response would be premature.

Related tracking epic: #333174.

### Public source and backport

[Source patch and validation](https://github.com/RyanEwen/vscode-patches/blob/bb83e8c6c1b186919b58d1a8d45d02fb7eafc00a/docs/patches/vscode-335547.md) · [Installed-bundle fix](https://github.com/RyanEwen/vscode-patches/blob/bb83e8c6c1b186919b58d1a8d45d02fb7eafc00a/docs/fixes/codex-steering-resolved-input.md). These immutable links describe this proposal; publication to the collection's main branch is under review in [RyanEwen/vscode-patches#1](https://github.com/RyanEwen/vscode-patches/pull/1).

Fix proposed in #335547.

*AI disclosure: this comment and the related code were written with the assistance of AI.*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.