Skip to content

fix(session): read Codex reasoning from its summary and content - #1203

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jayhemnani9910:fix/codex-reasoning-summary
Oct 18, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
jayhemnani9910:fix/codex-reasoning-summary

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Summary

The Codex reader takes reasoning text only from payload.rawContent (src/session-flow/adapters/codex.ts:569). Codex does not write that field. Its protocol type is { type: "reasoning", summary: Array<{ type: "summary_text", text }>, content?: Array<{ type: "reasoning_text" | "text", text }>, encrypted_content }, and the readable part is in summary. Every Codex reasoning item therefore reads back as an empty thinking block: Claude Code gets "thinking": "" and Cursor gets an empty <thinking> block.

This PR reads rawContent first (what writeSession emits, so Codex to Codex round trips do not change), then content, then summary, with summary parts separated by a blank line.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes (10796 pass; the same 6 tests fail on main here: two submodule-checkout cases that need git >= 2.54 (local 2.53), one hooks-reconcile-scope real-shell case, and three Cursor tests that need a sqlite3 CLI this machine does not have)
  • Added/updated tests for the change

New test in session-cmd.test.ts: one reasoning item with two summary_text parts and one with both summary and content must read back as the joined summary and as the content. On main both read back as "".

Real CLI with a throwaway HOME, migrating one of my Codex sessions with teamai session migrate <id> -s codex -t claude-code -y:

0.28.0-beta.5:  58 thinking blocks, 0 with text
this branch:    58 thinking blocks, 52 with text (the other 6 have an empty summary in the rollout)

Related Issues

Follow-up to #593.

Notes for Reviewers

Reasoning items with only encrypted_content and an empty summary still become an empty thinking block, as before.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

No findings in the specified diff.

The PR description includes sufficient testing: type checking, lint, unit tests, and a representative real-CLI Codex → Claude Code migration showing restored reasoning text. The remaining empty blocks are explained by empty summaries in the source session.

Review was read-only; I did not run, build, or install PR code.

@jeff-r2026
jeff-r2026 merged commit 208b97b into Tencent:main Oct 18, 2026
14 checks passed
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.

4 participants