Skip to content

fix: preserve reasoning lineage across interrupted retries - #48

Merged
dzianisv merged 2 commits into
mainfrom
issue-47-recover-reasoning-items
Mar 28, 2026
Merged

dzianisv merged 2 commits into
mainfrom
issue-47-recover-reasoning-items

Conversation

@dzianisv

Copy link
Copy Markdown
Owner

Summary

Fix the interrupted-replay bug that leaves history with a function_call but not its required reasoning item, which causes the next /responses request to fail and makes the session unusable.

Closes #47.

Changes

  • persist partial reasoning items from response.output_item.added into in-memory history immediately
  • upsert completed reasoning items by id so a completed reasoning item replaces its partial predecessor instead of duplicating it
  • always attach response item ids on /responses requests so reasoning/function-call lineage survives replay on the standard Responses wire path too
  • rebuild retry prompts from live session history before transport retries so same-turn retries include any reasoning/call/output items already recorded before the disconnect
  • add regression coverage for both user-interrupt follow-up replay and incomplete-stream retry replay

Testing

  • cargo test -p codex-core --lib context_manager::history::tests::record_items_replaces_reasoning_item_with_same_non_empty_id -- --exact
  • cargo test -p codex-core --test all suite::abort_tasks::interrupt_tool_records_history_entries -- --exact
  • cargo test -p codex-core --test all suite::stream_no_completed::retries_on_early_close -- --exact
  • cargo test -p codex-core --test all suite::cli_stream::responses_mode_stream_cli -- --exact

@dzianisv
dzianisv force-pushed the issue-47-recover-reasoning-items branch from 4cf0595 to 08eca3b Compare March 28, 2026 07:31
@dzianisv

Copy link
Copy Markdown
Owner Author

Rebased this branch onto the latest main after merging #46 and #51.

Local validation completed:

  • cargo test -p codex-core --lib context_manager::history::tests::record_items_replaces_reasoning_item_with_same_non_empty_id -- --exact
  • cargo test -p codex-core --test all suite::abort_tasks::interrupt_tool_records_history_entries -- --exact
  • cargo test -p codex-core --test all suite::stream_no_completed::retries_on_early_close -- --exact
  • cargo test -p codex-core --test all suite::cli_stream::responses_mode_stream_cli -- --exact

Current blockers are fork-wide CI issues rather than branch-local behavior:

@dzianisv
dzianisv merged commit 9965237 into main Mar 28, 2026
12 of 30 checks passed
@dzianisv
dzianisv deleted the issue-47-recover-reasoning-items branch March 28, 2026 16:02
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.

bug: of type 'function_call' was provided without its required

1 participant