Repository navigation
fix(session): keep the text of a Codex tool output given as a list - #1202
Merged
jeff-r2026 merged 1 commit intoOct 19, 2026
Merged
Conversation
|
No findings in the specified diff. The change preserves string outputs and joins text items from list outputs, with a regression test covering mixed text/image content. The PR description includes sufficient testing: a representative real-CLI migration reports 0 of 52 corrupted tool results on this branch, versus 52 of 52 previously. Review was read-only; I did not run, build, or install PR code. |
jeff-r2026
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Codex writes a tool output either as a string or as a list of content items (
FunctionCallOutputBody = string | Array<FunctionCallOutputContentItem>in its protocol types). The list form shows up for tools that return images and for the JS REPL (exec):[{"type":"input_text","text":"..."},{"type":"input_image","image_url":"data:..."}]. The Codex reader doesString(payload.output ?? '')(src/session-flow/adapters/codex.ts:559), so every list output becomes[object Object],[object Object]after migration or archiving.This PR joins the
input_textparts with\n, the same way the Claude Code reader flattens atool_resultarray. String outputs are unchanged.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses (10796 pass; the same 6 tests fail onmainhere: twosubmodule-checkoutcases that need git >= 2.54 (local 2.53), onehooks-reconcile-scopereal-shell case, and three Cursor tests that need asqlite3CLI this machine does not have)New test in
session-cmd.test.ts: a Codex rollout whosefunction_call_outputis a list of twoinput_textitems and oneinput_imagemust read back asOutput:\ndone. Onmainit reads back as[object Object],[object Object],[object Object].Real CLI with a throwaway HOME, migrating one of my Codex sessions (codex-cli 0.163.0, 52 tool outputs, all lists) with
teamai session migrate <id> -s codex -t claude-code -y:Related Issues
Follow-up to #593.
Notes for Reviewers
Images in a list output are dropped, as the Claude Code reader drops them from
tool_resultarrays. An image-only output (view_image) reads back as an empty string. If you would rather keep a marker such as[image]for eachinput_image, I can add it.