Repository navigation
Description
What happened?
extensions/codex/src/app-server/session-history.test.ts fails 3 of 4 tests on a pristine origin/main checkout on macOS, while main CI (Linux) is green. This makes the scripts/pr local prepare-gates lane (full pnpm test) unpassable on affected machines for any PR, regardless of its diff.
Failing tests (readCodexMirroredSessionHistoryMessages):
- replays only the branch selected by a leaf control
- keeps visible history when continuation rows use a disjoint append cursor
- keeps visible history when a continuation references the leaf marker
Assertion shape: the reader returns assistant content as structured parts where the test expects a plain string:
- "content": "active answer",
+ "content": [ { "text": "active answer", "type": "text" } ],
Reproduction / environment matrix
node scripts/run-vitest.mjs extensions/codex/src/app-server/session-history.test.ts on detached origin/main @ cafbd745c1b (2026-07-04), macOS 15 (arm64):
- Node 25.8.1 → 3 failed
- Node 24.16.0 → 3 failed
- Node 24.16.0 with scratch
HOME→ 3 failed (not user-state leakage)
Same failures appeared inside a fresh scripts/pr prep worktree during a PR landing attempt, so it is not checkout-specific either. git log shows the test and reader last changed in #89518 (plugin transcript mirrors migration, 2026-06-23); no changes since, so this looks like a mac-vs-CI divergence (dependency resolution or platform-dependent path in the mirrored-history reader) rather than a fresh main regression.
What did you expect?
The extension-codex-app-server-support suite passes on a clean checkout of main on macOS, so local full-suite gates (scripts/pr prepare-gates) can go green.
Impact
Maintainer landing lane: local prepare-gates cannot pass on affected macOS hosts; PRs must fall back to hosted CI evidence (documented in #99830 (comment)).
Additional information
Root-causing needs the Codex dependency gate (inspect the mirrored transcript writer/reader contract against ../codex), which is why this is filed rather than patched alongside the unrelated PR that surfaced it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 4, 2026, 2:46 AM ET / 06:46 UTC.
Summary
Keep open: this is a protected maintainer-labeled bug with live issue evidence and current-main source still matching the reported Codex mirrored-history assertion mismatch; no merged fix or canonical replacement issue owns it yet.
Reproducibility: yes. source-level. The reporter supplied a concrete macOS command, and current-main source still has tests expecting string assistant content while session ingest normalizes those assistant strings into structured text parts.
Next step
Protected
maintainerlabel and the need for macOS/Codex-contract confirmation make this a human-handled issue, not an automated cleanup close or repair dispatch.Review details
Best possible solution:
Align the Codex mirrored-history test/runtime expectation with canonical structured assistant content, then prove the focused suite on macOS Node 24/25 and Linux without weakening branch-selection coverage.
Do we have a high-confidence way to reproduce the issue?
Yes, source-level. The reporter supplied a concrete macOS command, and current-main source still has tests expecting string assistant content while session ingest normalizes those assistant strings into structured text parts.
Is this the best way to solve the issue?
Unclear at final code-shape level. The likely fix is narrow, but it should be chosen after confirming whether tests should expect structured content or the reader should intentionally post-process only a Codex-facing projection.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 03fafe236494.
Label changes
Label changes:
P2: The issue blocks a maintainer local gate on affected macOS machines but has a hosted-CI fallback and a bounded Codex session-history surface.impact:session-state: The affected surface is Codex mirrored session-history replay and transcript content normalization.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.Label justifications:
P2: The issue blocks a maintainer local gate on affected macOS machines but has a hosted-CI fallback and a bounded Codex session-history surface.impact:session-state: The affected surface is Codex mirrored session-history replay and transcript content normalization.Evidence reviewed
What I checked:
maintainerlabel and Codex dependency-inspection rule apply to this review. (AGENTS.md:1, 03fafe236494)bugand protectedmaintainerlabels, one ClawSweeper status comment, and no closing pull request references.readCodexMirroredSessionHistoryMessagesparses the session file, migrates entries, then returnsbuildSessionContext(sessionEntries).messages, so parser normalization affects the test output shape. (extensions/codex/src/app-server/session-history.ts:27, 03fafe236494)contentas a plain string rather than the structured text block array shown in the issue body. (extensions/codex/src/app-server/session-history.test.ts:86, 03fafe236494)[{ type: "text", text: ... }], which explains the reported mismatch without needing to infer from logs alone. (src/agents/sessions/session-manager.ts:956, 03fafe236494)AssistantMessagetype requires assistant content to be an array of text/thinking/tool-call parts, while user content may still be string or content blocks. (packages/llm-core/src/types.ts:279, 03fafe236494)Likely related people:
extensions/codex/src/app-server/session-history.ts,extensions/codex/src/app-server/session-history.test.ts)session-manager.tsshows the assistant string normalization was folded into transcript ingest, the behavior that makes the current tests return structured parts. (role: recent adjacent contributor; confidence: high; commits: a5bf55d690e7, e095dc840933; files:src/agents/sessions/session-manager.ts)src/config/sessions/transcript-tree.ts,src/agents/sessions/session-manager.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.test(codex): expect canonical assistant text blocks in mirrored history
steipete commentedon Jul 4, 2026
Fixed on
mainin 55d0d037bfdd6cf10b56a83f6b7e77c743f0dea1 (test-only, +6/−3 inextensions/codex/src/app-server/session-history.test.ts).Root cause
The tests were stale, not the reader or the mirror writer. #98908 (
a5bf55d690e, 2026-07-01) folded assistant string normalization into session-transcript ingest:parseSessionEntries→normalizeLoadedFileEntry(src/agents/sessions/session-manager.ts:956) now rewrites legacy assistant string content into[{ type: "text", text }]blocks at load time, matching the canonicalAssistantMessageblock-array contract (packages/llm-core/src/types.ts). That PR updated the core analog test (src/agents/cli-runner/session-history.test.ts) but missed this extension file — the only other consumer of that ingest path (verified by sweep). The Codex mirror writer already emits block arrays (createAssistantMessageinextensions/codex/src/app-server/event-projector.ts), so string fixtures only exist as legacy ingest input; the fix updates the three assistant expectations to the canonical block shape, exactly mirroring the #98908 core-test update, and keeps the string fixtures to preserve legacy-ingest coverage.Codex dependency gate
Inspected sibling
openai/codex@db887d03e1before the verdict:codex-rs/app-server-protocol/src/protocol/v2/thread.rs:324—ThreadResumeParamsresumes bythread_idfrom codex-side rollout persistence; thehistoryparam is marked[UNSTABLE] FOR CODEX CLOUD - DO NOT USE, andpathpoints at codex's own rollout JSONL.codex-rs/app-server-protocol/src/protocol/thread_history.rs—build_turns_from_rollout_itemsrebuilds resumed thread history from codex-persistedRolloutItems.So the mirrored OpenClaw session file never crosses the app-server protocol boundary (
extensions/codex/src/app-server/run-attempt.tskeepscodexModelInputHistoryMessagesempty by design — codex threads own conversation continuity; the mirror feeds OpenClaw harness hooks and prompt projections only). The mirror's message shape is therefore governed by OpenClaw's canonical session contract, which is the block-array form.Why Linux CI stayed green (it is not a platform difference)
scripts/lib/ci-node-test-plan.mjsexcludestest/vitest/vitest.full-extensions.config.tsfrom theci.ymlLinux node-test shards (EXCLUDED_FULL_SUITE_SHARDS)..github/workflows/plugin-prerelease.yml, which isworkflow_dispatch-only.pnpm test(whatscripts/prprepare-gates runs) includes the extensions shard, so any full local run failed on any OS while push/PR CI never executed the file.cbx_38693d0e2fa8, runrun_1825965cd014, c7a.8xlarge), the pre-fix file fails identically — 3 failed / 1 passed with the same[{ "text": ..., "type": "text" }]vs string assertion diffs — and the fixed file passes 4/4. No dependency-resolution or platform path is involved.Proof
cccc856b82f:node scripts/run-vitest.mjs extensions/codex/src/app-server/session-history.test.ts→ 3 failed / 1 passed (matches this report).cbx_38693d0e2fa8): pre-fix 3 failed / 1 passed, post-fix 4 passed,command_phases=postfix-expect-green:8.6s,prefix-expect-red:6.5s.oxfmtclean; structured autoreview (Codex,gpt-5.5) clean — "no accepted/actionable findings".scripts/prlocal prepare-gates on macOS should pass this suite again from55d0d037bfd. Closing as completed.test(codex): expect canonical assistant text blocks in mirrored history