Skip to content

fix: make codex send replays idempotent#131

Open
TheVortex8 wants to merge 5 commits intogetpaseo:mainfrom
TheVortex8:fix/codex-replay-stale-running
Open

fix: make codex send replays idempotent#131
TheVortex8 wants to merge 5 commits intogetpaseo:mainfrom
TheVortex8:fix/codex-replay-stale-running

Conversation

@TheVortex8
Copy link
Copy Markdown

Summary

  • make send_agent_message_request idempotent when the same client messageId is replayed
  • reject messageId reuse with different text instead of silently starting a new run
  • allow Codex terminal events to end a stream even if a fresh turn_started event was not observed first
  • add regressions for duplicate-send replay and terminal-before-start Codex behavior

Root cause

On reconnect/replay paths, the daemon could accept the same logical user message twice because messageId was only used for timeline recording, not run idempotency. That could start a second Codex run for the same message.

The Codex app-server provider also buffered all pre-turn_started events except permissions. If the replayed/resumed run surfaced only a terminal event (turn_completed, turn_failed, or turn_canceled), the provider ignored it and could leave the agent stuck in running.

Testing

  • npx vitest run src/server/agent/providers/codex-app-server-agent.test.ts
  • npx vitest run src/server/daemon-e2e/send-message-id-replay.e2e.test.ts --maxWorkers=1 --minWorkers=1
  • npm run typecheck --workspace=@getpaseo/server

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