Skip to content

[codex] Drop duplicate tool results during message repair - #54594

Closed
enzo-adami wants to merge 1 commit into
NousResearch:mainfrom
enzo-adami:codex/repair-message-sequence
Closed

[codex] Drop duplicate tool results during message repair#54594
enzo-adami wants to merge 1 commit into
NousResearch:mainfrom
enzo-adami:codex/repair-message-sequence

Conversation

@enzo-adami

Copy link
Copy Markdown
Contributor

Summary

  • Track tool results already accepted for the current assistant tool-call group.
  • Drop duplicate tool messages with the same live tool_call_id.
  • Preserve distinct consecutive tool results from parallel tool calls.

Why

repair_message_sequence already drops tool messages whose tool_call_id does not belong to the most recent assistant tool-call group. It did not distinguish a valid first result from a duplicated result for the same call id, so a retry/replay artifact could leave two tool outputs for one tool call in history. Providers expect at most one tool result per tool call id.

Validation

  • uv run --extra dev pytest tests/run_agent/test_message_sequence_repair.py
  • uv run --extra dev ruff check agent/agent_runtime_helpers.py tests/run_agent/test_message_sequence_repair.py
  • git diff --check -- agent/agent_runtime_helpers.py tests/run_agent/test_message_sequence_repair.py

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint codex labels Jun 29, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. This is an automated hermes-sweeper review; current main already provides this exact guarantee and broader protection.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants