Skip to content

fix(storage): import Codex item_completed messages - #3520

Draft
sunrioa wants to merge 1 commit into
apache:mainfrom
sunrioa:codex/fix-codex-item-completed-import
Draft

fix(storage): import Codex item_completed messages#3520
sunrioa wants to merge 1 commit into
apache:mainfrom
sunrioa:codex/fix-codex-item-completed-import

Conversation

@sunrioa

@sunrioa sunrioa commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • Read Codex 0.149 event_msg.item_completed records for UserMessage, Reasoning, and AgentMessage.
  • Preserve message IDs, turn IDs, timestamps, and active model metadata.
  • Derive imported-session titles from completed user items while retaining support for the legacy user_message and agent_* event shapes.
  • Continue treating event_msg as the presentation-message source so that corresponding response_item mirrors are not imported twice.
  • Add a sanitized Codex 0.149 regression fixture covering title discovery, message conversion, terminal state, canonical decoding, and duplicate suppression.

Fixes #3516
Refs #2499

Verification

  • Focused codex-session-adapter suite: 9 passed.
  • NODE_NO_WARNINGS=1 npm --workspace @maka/storage run test:dist: 899 passed, 14 skipped.
  • npm run lint
  • npm run format:check
  • npm run build
  • npm run typecheck
  • npm run check:asf-headers
  • git diff --check
  • Real rollout conversion smoke test restored 1 user message, 2 assistant messages, and 1 terminal turn-state message without importing response mirrors twice.
  • Before-fix evidence and environment details are available in Codex Desktop 0.149 conversations import with an empty transcript #3516.

Without NODE_NO_WARNINGS=1, one unrelated managed-dependency environment test treats Node.js's experimental node:sqlite warning on child-process stderr as a failure. The full storage suite passes when that warning is disabled.

Review focus

The adapter keeps the legacy and Codex 0.149 presentation formats side by side. event_msg remains the authority for user, reasoning, and assistant presentation messages, while response_item remains responsible for tool calls and tool results. This preserves the existing duplicate-prevention boundary.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope:

OpenAI Codex assisted with the rollout-format investigation, implementation, regression tests, local verification, and drafting this description. I reproduced the issue and reviewed the final diff, regression coverage, and test results before submission.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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.

Codex Desktop 0.149 conversations import with an empty transcript

1 participant