Repository navigation
fix(transcript): disable OpenAI tool-use pairing repair - #61337
VictorJeon wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c8c258c50
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return { | ||
| sanitizeToolCallIds: true, | ||
| toolCallIdMode: "strict", | ||
| repairToolUseResultPairing: false, |
There was a problem hiding this comment.
Disable repair in OpenAI-owned replay policy
Setting repairToolUseResultPairing: false here does not affect the OpenAI/OpenAI-Codex providers that the change is targeting, because those providers build replay policy via buildOpenAIReplayPolicy in extensions/openai/replay-policy.ts (which still omits this field), and resolveTranscriptPolicy then falls back to DEFAULT_TRANSCRIPT_POLICY.repairToolUseResultPairing === true. In practice, OpenAI response sessions will still run pairing repair and can still synthesize the problematic tool results after resume/replay, so the fix is not applied where intended.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR disables The change correctly updates
Confidence Score: 1/5Do not merge — the stated regression for openai and openai-codex providers is not fixed by this PR; the production replay policy for those providers was not updated. The fix lands in the wrong function.
|
| it("disables tool-use/result pairing repair for OpenAI-compatible replay", () => { | ||
| const openAiResponsesPolicy = resolveTranscriptPolicy({ | ||
| provider: "openai", | ||
| modelId: "gpt-5.4", | ||
| modelApi: "openai-responses", | ||
| }); | ||
| const codexResponsesPolicy = resolveTranscriptPolicy({ | ||
| provider: "openai-codex", | ||
| modelId: "gpt-5.4", | ||
| modelApi: "openai-codex-responses", | ||
| }); | ||
|
|
||
| expect(openAiResponsesPolicy.repairToolUseResultPairing).toBe(false); | ||
| expect(openAiResponsesPolicy.allowSyntheticToolResults).toBe(false); | ||
| expect(codexResponsesPolicy.repairToolUseResultPairing).toBe(false); | ||
| expect(codexResponsesPolicy.allowSyntheticToolResults).toBe(false); | ||
| }); |
There was a problem hiding this comment.
Test mock diverges from the real production
buildOpenAIReplayPolicy
This test passes because the mock at the top of the file hardcodes repairToolUseResultPairing: false for the openai/openai-codex cases. However, the actual production buildOpenAIReplayPolicy in extensions/openai/replay-policy.ts does not set this field — confirmed by the unmodified contract test in extensions/openai/openai-provider.test.ts (lines 300-312) which asserts the returned policy contains no repairToolUseResultPairing key.
This test validates resolveTranscriptPolicy's merge behavior correctly given the right plugin input, but it masks the fact that the real plugin does not produce repairToolUseResultPairing: false. The production regression therefore goes undetected.
A more robust approach would be to add an assertion directly to the existing replay-policy contract test in extensions/openai/openai-provider.test.ts so it locks the real buildOpenAIReplayPolicy output and catches this gap.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/transcript-policy.test.ts
Line: 231-247
Comment:
**Test mock diverges from the real production `buildOpenAIReplayPolicy`**
This test passes because the mock at the top of the file hardcodes `repairToolUseResultPairing: false` for the `openai`/`openai-codex` cases. However, the actual production `buildOpenAIReplayPolicy` in `extensions/openai/replay-policy.ts` does **not** set this field — confirmed by the unmodified contract test in `extensions/openai/openai-provider.test.ts` (lines 300-312) which asserts the returned policy contains no `repairToolUseResultPairing` key.
This test validates `resolveTranscriptPolicy`'s merge behavior correctly given the right plugin input, but it masks the fact that the real plugin does not produce `repairToolUseResultPairing: false`. The production regression therefore goes undetected.
A more robust approach would be to add an assertion directly to the existing replay-policy contract test in `extensions/openai/openai-provider.test.ts` so it locks the real `buildOpenAIReplayPolicy` output and catches this gap.
How can I resolve this? If you propose a fix, please make it concise.|
Closing this as superseded by #61556. The review on this branch is correct: it disables pairing repair on the wrong replay helper and does not actually touch the production OpenAI / OpenAI Codex replay policy. The canonical path is #61556, which fixes the real transport/replay ownership seam instead of partially changing the shared compat helper. Thanks for chasing the transcript issue here. |
Summary
repairToolUseResultPairingfor OpenAI-compatible replay policyallowSyntheticToolResultsfalse for OpenAI-compatible modelsopenai-responsesandopenai-codex-responsesWhy
For OpenAI/Codex response sessions, replay-time tool-use/result pairing repair can synthesize missing tool results into the transcript. In the harness flow this poisoned resumed sessions after gateway restart/turn interruption and broke checkpoint recovery with synthetic error tool results.
Observed live symptom locally before the fix:
harness_executeresumed flows were getting replay-poisoned by synthetic missing tool resultsVerification
pnpm exec vitest run --config vitest.config.ts --project agents src/agents/transcript-policy.test.tsharness_executereturnedRun: resumed from checkpointfor a recoverable checkpoint smoke in an OpenAI sessionScope
This change is intentionally narrow: