[Thread API] read_thread omits completed response after context compaction
What version of the Codex App are you using?
Codex task-management API surface in Codex Desktop.
- Bundled runtime recorded by the affected session: codex-cli 0.150.0-alpha.8
- Current local CLI: codex-cli 0.149.1
- Platform: macOS Darwin 24.6.0 arm64
- Affected task source: vscode
- Model: not surfaced in the session metadata
What issue are you seeing?
After a target task performs context compaction, a cross-thread read can silently omit the target task's latest completed assistant response.
The task completes normally and the raw rollout JSONL contains the final assistant message. However, the thread-management API reports the latest turn as completed while returning an empty item list and no latest assistant message. This makes read-only cross-thread review and handoff retrieval fail even though the response is persisted locally.
The compaction correlation is evidence from one reproduction, not a confirmed causal mechanism.
Reproduction
- Use a sufficiently long-running Codex task that performs context compaction.
- From another task, send a read-only review request to that task.
- Wait for the target task to finish.
- Call
wait_threadsand thenread_threadfor the exact target thread ID. - Observe that the target turn is completed, but its retrievable items are empty.
- Inspect the local rollout JSONL and observe that the assistant response is present.
Affected task:
01a03fe0-2471-7ec2-a29f-6117f1f3f022
Observed local rollout evidence:
compactedrecord at ordinal 2015, timestamp 2026-08-26T21:26:58.831Z- assistant
response_itemat ordinal 2093 task_completeat ordinal 2095, with a non-emptylast_agent_messageread_thread/wait_threadsresult: latest turn completed, butitems: [],latestAssistantMessageId: null, andlatestAssistantMessage: null
The raw response remains in:
~/.codex/sessions/2026/08/26/rollout-2026-08-26T23-00-49-01a03fe0-2471-7ec2-a29f-6117f1f3f022.jsonl
Older assistant messages from the same task were retrievable, so this is not simply lack of access to the task.
Expected behavior
A completed target turn should expose its assistant response through read_thread, regardless of whether context compaction occurred. If transcript hydration fails, the API should return an explicit error or incomplete-state marker rather than a successful completed turn with an empty transcript.
Actual behavior
The status path correctly observes completion, but the transcript path silently drops the latest response. Repeated waiting does not restore it. Reading the raw rollout JSONL recovers the response, but that is an internal, unsupported fallback and is not available for remote tasks.
Related issues
- #38169: heavily compacted
thread/resumesilently drops newest turns - #37030: cross-thread delegation can lose model-visible thread history
- #28193: exact transcript access for the assistant
- #20493: blank thread views despite intact local JSONL transcripts
This report is narrower: the target task completes, local storage contains the assistant message, but the cross-thread read_thread result omits it after compaction.
Privacy
The raw transcript is not attached because it contains private project conversation and local paths. The rollout path, task ID, turn status, ordinals, and metadata above are sanitized evidence.
1 Comment
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action