Skip to content

fix(openai): preserve order in Responses API history#7500

Merged
jamadeo merged 1 commit intoblock:mainfrom
rabi:api_history_replay
Feb 26, 2026
Merged

fix(openai): preserve order in Responses API history#7500
jamadeo merged 1 commit intoblock:mainfrom
rabi:api_history_replay

Conversation

@rabi
Copy link
Copy Markdown
Contributor

@rabi rabi commented Feb 25, 2026

Summary

The Responses API history reconstruction sends all text messages, then all function calls and finally all function call outputs breaking their order. This causes models like gpt-5.2-codex to lose context and loop repeatedly doing things they had already done because the interleaved text/tool call/output were scrambled.

Let's keep the chronological order instact.

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Tested locally.

The Responses API history reconstruction sent all text messages first,
then all function calls, then all function call outputs — breaking
chronological order. This caused models like gpt-5.2-codex to lose
context and loop repeatedly doing things they had already done
because the interleaved text/tool call/output were scrambled.

Change-Id: I7c1b94f9ec234f43ad091d7e92312c671b2bcdec
Signed-off-by: rabi <[email protected]>
@jamadeo jamadeo added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@jamadeo jamadeo added this pull request to the merge queue Feb 26, 2026
Merged via the queue into block:main with commit 4082285 Feb 26, 2026
19 checks passed
zanesq added a commit that referenced this pull request Feb 26, 2026
…m-cache

* 'main' of github.com:block/goose:
  fix: replace unwrap() with graceful error in scheduler execute_job (#7436)
  fix: Dictation API error message shows incorrect limit (#7423)
  fix(acp): Use ACP schema types for session/list (#7409)
  fix(desktop): make bundle and updater asset naming configurable (#7337)
  fix(openai): preserve order in Responses API history (#7500)
  Use the correct Goose emoji 🪿 instead of Swan in README.md (#7485)
  feat(ui): implement fullscreen and pip display modes for MCP Apps (#7312)
  Disable tool pair summarization (#7481)
benthecarman pushed a commit to benthecarman/goose that referenced this pull request Feb 27, 2026
tlongwell-block added a commit that referenced this pull request Feb 27, 2026
…patible

* origin/main: (70 commits)
  feat: allow goose askai bot to search goose codebase (#7508)
  Revert "Reapply "fix: prevent crashes in long-running Electron sessions""
  Reapply "fix: prevent crashes in long-running Electron sessions"
  Revert "fix: prevent crashes in long-running Electron sessions"
  fix: replace unwrap() with graceful error in scheduler execute_job (#7436)
  fix: Dictation API error message shows incorrect limit (#7423)
  fix(acp): Use ACP schema types for session/list (#7409)
  fix(desktop): make bundle and updater asset naming configurable (#7337)
  fix(openai): preserve order in Responses API history (#7500)
  Use the correct Goose emoji 🪿 instead of Swan in README.md (#7485)
  feat(ui): implement fullscreen and pip display modes for MCP Apps (#7312)
  fix: prevent crashes in long-running Electron sessions
  Disable tool pair summarization (#7481)
  fix: New Recipe Warning does not close on cancel (#7524)
  The client is not the source of truth (#7438)
  feat: support Anthropic adaptive thinking (#7356)
  copilot instructions: reword no prerelease docs (#7101)
  fix(acp): don't fail session creation when model listing is unavailable (#7484)
  feat: simplify developer extension (#7466)
  feat: add goose-powered release notes generator workflow (#7503)
  ...

# Conflicts:
#	Cargo.lock
tlongwell-block added a commit that referenced this pull request Feb 27, 2026
…m-extension-pr

* origin/main:
  Update CODEOWNERS for team restructuring (#7574)
  Add snapshot test with platform extensions (#7573)
  Handle Bedrock 'prompt is too long' error (#7550)
  feat: make pctx/Code Mode an optional dependency via 'code-mode' feature (#7567)
  chore(release): release version 1.26.0 (minor) (#7512)
  feat: allow goose askai bot to search goose codebase (#7508)
  Revert "Reapply "fix: prevent crashes in long-running Electron sessions""
  Reapply "fix: prevent crashes in long-running Electron sessions"
  Revert "fix: prevent crashes in long-running Electron sessions"
  fix: replace unwrap() with graceful error in scheduler execute_job (#7436)
  fix: Dictation API error message shows incorrect limit (#7423)
  fix(acp): Use ACP schema types for session/list (#7409)
  fix(desktop): make bundle and updater asset naming configurable (#7337)
  fix(openai): preserve order in Responses API history (#7500)
  Use the correct Goose emoji 🪿 instead of Swan in README.md (#7485)
  fix: prevent crashes in long-running Electron sessions
craigwalkeruk pushed a commit to craigwalkeruk/custom-goose that referenced this pull request Mar 5, 2026
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.

3 participants