Skip to content

Retry Codex messages across turn boundaries - #2

Merged
algoflows merged 1 commit into
mainfrom
codex/correlate-native-queued-input
Jul 22, 2026
Merged

Retry Codex messages across turn boundaries#2
algoflows merged 1 commit into
mainfrom
codex/correlate-native-queued-input

Conversation

@algoflows

Copy link
Copy Markdown

Related issue

N/A

Summary

Fixes a timing race when someone sends a follow-up just as Codex finishes its previous answer. The runner could accept the follow-up while Codex was closing the old turn, then the app would show codex_input_not_accepted and ask the person to retry manually.

ELI5: the message arrived while one door was closing. Omnigent now waits for that door to close and automatically sends the same message through the next open door. The original pending bubble stays visible until Codex confirms receipt.

Before: follow-up -> closing turn -> retry error -> user sends again
After:  follow-up -> closing turn -> one automatic retry -> next Codex turn

The retry is capped at one attempt. Duplicate terminal notifications are idempotent, and if Codex genuinely cannot accept the retried message, Omnigent preserves it in history with a clear error instead of losing it.

Test Plan

  • python -m pytest tests/runtime/test_pending_inputs.py -q (17 passed)
  • python -m pytest tests/server/integration/test_sessions_endpoints.py -q (197 passed)
  • pre-commit run --files omnigent/runtime/pending_inputs.py omnigent/server/routes/sessions.py tests/runtime/test_pending_inputs.py tests/server/integration/test_sessions_endpoints.py
  • Added regression coverage for the queued-message/turn-completion race, bounded retries, duplicate terminal status delivery, and durable failure after retry exhaustion.

Demo

N/A — backend lifecycle fix with automated regression coverage.

Type of change

  • Bug fix
  • Feature
  • UI / frontend change
  • Refactor / chore
  • Docs
  • Test / CI
  • Breaking change

Test coverage

  • Unit tests added / updated
  • Integration tests added / updated
  • E2E tests added / updated
  • Manual verification completed
  • Existing tests cover this change
  • Not applicable

Coverage notes

The full sessions endpoint integration suite passed, covering message persistence, native transcript ownership, status publication, and runner forwarding around this path.

Changelog

Messages sent as a Codex reply finishes are now retried automatically instead of being rejected with a manual retry error.

@github-actions github-actions Bot added the size/L Pull request size: L label Jul 22, 2026
@algoflows
algoflows merged commit 7bedbc8 into main Jul 22, 2026
48 of 53 checks passed
@algoflows
algoflows deleted the codex/correlate-native-queued-input branch July 22, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Pull request size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant