Skip to content

fix(codex): retry a swallowed Enter when the prompt is taller than the screen - #1374

Open
RonenMars wants to merge 3 commits into
mainfrom
fix/codex-tall-prompt-retry
Open

RonenMars wants to merge 3 commits into
mainfrom
fix/codex-tall-prompt-retry

Conversation

@RonenMars

Copy link
Copy Markdown
Owner

Problem

A 14 KB prompt sent from the phone was written into Codex's compose box but never submitted.
/input answered 200, and the session settled as waiting_input with the prompt still unsent.

Cause

Codex turned the \r that followed the large write into a newline, which is the case retrySwallowedEnter exists for.
The retry only runs when codexComposeHoldsText finds the prompt in the compose box.
The PTY screen is 40 rows and the compose box was far taller, so its first line had scrolled off and the last › row showed a line from the middle of the prompt.
The function compared that row only with the prompt's first line, returned false, and the stale path settled the status without sending an Enter.

Change

codexComposeHoldsText now also matches any line of 12 or more characters.
The first line still matches at any length, as before.
Shorter lines are too weak a probe on their own.
The troubleshooting entry for the swallowed Enter gains the tall-prompt case and the recovery.

Verification

The new test uses the screen shape captured from the live session and failed on its first assertion before the fix.
__tests__/codex-pty-runner.test.ts passes 59 of 59, and tsc and biome are clean.
Loosening the length guard to 0 makes one test fail, so the guard is covered.
I did not run the full suite, since the only caller of the function is the Codex runner.

Notes

The deployed build (1.158.0) does not have this fix, so a prompt that tall still arrives unsent until it is released.

…e screen

A 14 KB prompt overflowed the 40-row PTY screen, so the compose box's first line scrolled off and its `›` row showed a line from the middle of the prompt.
codexComposeHoldsText only compared that row with the prompt's first line, so retrySwallowedEnter never fired and the prompt stayed unsent while the session settled as waiting_input.
It now also matches any line of 12+ characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant