Skip to content

Codex: Enter from Agent Code's composer can still append to a native draft the pane cannot classify #1327

Open

Description

@Juliusolsson05

Residual of #1319 (review round 2, finding A1). #1319 fixes the cases where Agent Code can SEE the native draft; this issue is the case where it cannot.

What happens

  1. A human types a draft directly into a Codex pane, in a layout the composer classifier cannot read (for example the 13-row draft probe from the fix(codex): see a native draft before writing into it; restart into an empty 0.157 composer (#800, #1313) #1319 review: the draft pushes the shortcuts hint off, so getComposerState() is unknown).
  2. Readiness correctly withdraws to { ready: false, reason: 'provider-not-ready' }. It does not latch composer-occupied, because nothing proves a draft is there.
  3. The user types in Agent Code's own composer and presses Enter. composerOccupied is false, so the new fix(codex): see a native draft before writing into it; restart into an empty 0.157 composer (#800, #1313) #1319 guard in useComposerKeybinds does not run. Codex's composer submit writes bracketed paste + \r, which appends to and submits the human's native draft.

The provider-owned delivery path (deliverCodexPrompt) already refuses this case. Only the pane's own Enter path lets it through.

Why #1319 did not refuse it

Refusing Enter on every provider-not-ready would also block the normal "queue a follow-up while Codex is working" flow, because a working pane also reports provider-not-ready. The readiness reason cannot tell apart "Codex is busy" and "the composer holds something we can't read".

Proposed fix

Add a separate readiness reason (for example composer-unreadable) for the case where Codex is idle but the composer rows are not provably empty. Publish it from publishNativeComposer in src/providers/codex/runtime/codexSession.ts, and let the pane's Enter guard refuse it the same way it refuses composer-occupied. provider-not-ready while Working stays queueable.

Evidence

  • temp/review-1319/round2-report-a.md finding 1 (renderer probe: inputReadinessReason: 'provider-not-ready', input Status?, send called with \x1b[200~Status?\x1b[201~\r).
  • Recorded fixture: packages/codex-headless/testing/fixtures/composer-0157/idle-draft-ctrlc.json.

Refs #1319

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    class:C1-prompt-deliveryPrompt delivery inferred from the terminal screenprovider:codexAffects Codex integrationsev:P2Real bug with a workaroundtype:bugSomething works wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions