Skip to content

fix(agents): submit-retry Enter for codex composer - #16689

Merged
AmethystLiang merged 1 commit into
mainfrom
sta-5379-submit-retry
Aug 27, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
sta-5379-submit-retry

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​200 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

Problem

Codex renders its composer UI before the initial Enter submission is processed, so the first Enter gets silently eaten without submitting the prompt.

Solution

Add a configurable submitRetryDelayMs per agent. When set (1200ms for codex), send one additional Enter after a delay following the initial submit. The retry is blind and best-effort—if the first Enter worked, the retry is harmless; if it was eaten, the retry will submit. Never downgrades the result of the first Enter.

Changes

  • Add submitRetryDelayMs field to TuiAgentConfig type
  • Implement retry logic in sendBracketedPasteToAgent: waits for the delay, sends a retry Enter in a guarded try-catch, treats retry failure as non-fatal
  • Set submitRetryDelayMs: 1200 for codex agent in config
  • Add comprehensive test suite verifying retry timing, transaction integrity across concurrent pastes, and failure handling
  • Update existing test to account for retry delay

Testing

  • New dedicated test file with 4 scenarios: retry timing, no-retry for other agents, transaction isolation, error resilience
  • Existing tests updated to reflect new timing

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d89aa251-026e-4987-89d1-263769f18e52

📥 Commits

Reviewing files that changed from the base of the PR and between 96565fe and 8b6a5fe7d30e7dc17e1647fa1b3802d718253097.

📒 Files selected for processing (4)
  • src/renderer/src/lib/agent-paste-draft-submit-retry.test.ts
  • src/renderer/src/lib/agent-paste-draft.test.ts
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/shared/tui-agent-config.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds an optional submitRetryDelayMs setting to TuiAgentConfig and configures Codex to retry submission after 1200 milliseconds. Paste submission passes the agent identifier to the submission helper. The helper sends one delayed, best-effort retry Enter while preserving the first submission result. New tests cover retry timing, agent-specific behavior, PTY serialization, retry rejection, and updated timer handling.

Merge Risk: ⚪ Minimal · up to 8b6a5

The PR adds a bounded delayed Enter retry for Codex submissions without changing the initial submission result; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, scope, and automated test coverage, but it does not follow the repository template. It omits the required Linked Issue, Visual Proof or an explicit N/A … Update the description to include all required template sections. Add a linked issue after "Fixes #"; provide before/after visual proof or state N/A with a reason; complete Testing with manual-test status and platforms; complete AI Disclosu…
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a submit-retry Enter behavior for Codex agents.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, scope, and automated test coverage, but it does not follow the repository template. It omits the required Linked Issue, Visual Proof or an explicit N/A rationale, AI Disclosure, Review, Agent skill upstream boundary, Notes, and checklist sections.

Resolution

Update the description to include all required template sections. Add a linked issue after "Fixes #"; provide before/after visual proof or state N/A with a reason; complete Testing with manual-test status and platforms; complete AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Codex silently discards Enter for ~75-150ms after its composer glyph first
renders, and the boundary widens with prompt size and machine load, so no
fixed first-Enter delay is provably safe on slow hosts. Submit success is not
verifiable from PTY output, but a redundant Enter is a measured no-op on codex
in both post-submit states, so send one blind retry after the first Enter.

- tui-agent-config: new optional submitRetryDelayMs knob, set to 1200 on codex
  only; every other agent is byte-identical to today.
- agent-paste-draft: after the post-paste '\r', wait the configured gap and
  send exactly one more '\r' inside the same PTY input transaction, so a
  concurrent paste cannot interleave. The retry is best-effort and never
  downgrades the first Enter's result.
- Retry tests live in a new file to keep agent-paste-draft.test.ts under the
  max-lines budget.

active-agent-note-send is deliberately exempt: its Enter rides the
terminal.send RPC (different transport, server-side sendable guard), has no
local agent identity to read the config from, and only fires on an
already-running agent, where the codex cold-boot submit gate cannot occur.
@AmethystLiang
AmethystLiang force-pushed the sta-5379-submit-retry branch from 8b6a5fe to b2e165e Compare August 27, 2026 04:10
@AmethystLiang
AmethystLiang merged commit 762fb05 into main Aug 27, 2026
48 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 30, 2026
…ai#16689)

Codex silently discards Enter for ~75-150ms after its composer glyph first
renders, and the boundary widens with prompt size and machine load, so no
fixed first-Enter delay is provably safe on slow hosts. Submit success is not
verifiable from PTY output, but a redundant Enter is a measured no-op on codex
in both post-submit states, so send one blind retry after the first Enter.

- tui-agent-config: new optional submitRetryDelayMs knob, set to 1200 on codex
  only; every other agent is byte-identical to today.
- agent-paste-draft: after the post-paste '\r', wait the configured gap and
  send exactly one more '\r' inside the same PTY input transaction, so a
  concurrent paste cannot interleave. The retry is best-effort and never
  downgrades the first Enter's result.
- Retry tests live in a new file to keep agent-paste-draft.test.ts under the
  max-lines budget.

active-agent-note-send is deliberately exempt: its Enter rides the
terminal.send RPC (different transport, server-side sendable guard), has no
local agent identity to read the config from, and only fires on an
already-running agent, where the codex cold-boot submit gate cannot occur.

(cherry picked from commit 762fb05)
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ai#16689)

Codex silently discards Enter for ~75-150ms after its composer glyph first
renders, and the boundary widens with prompt size and machine load, so no
fixed first-Enter delay is provably safe on slow hosts. Submit success is not
verifiable from PTY output, but a redundant Enter is a measured no-op on codex
in both post-submit states, so send one blind retry after the first Enter.

- tui-agent-config: new optional submitRetryDelayMs knob, set to 1200 on codex
  only; every other agent is byte-identical to today.
- agent-paste-draft: after the post-paste '\r', wait the configured gap and
  send exactly one more '\r' inside the same PTY input transaction, so a
  concurrent paste cannot interleave. The retry is best-effort and never
  downgrades the first Enter's result.
- Retry tests live in a new file to keep agent-paste-draft.test.ts under the
  max-lines budget.

active-agent-note-send is deliberately exempt: its Enter rides the
terminal.send RPC (different transport, server-side sendable guard), has no
local agent identity to read the config from, and only fires on an
already-running agent, where the codex cold-boot submit gate cannot occur.
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