Repository navigation
CLI/TUI session can restart during long tool-heavy turns after repeated 'Function call output is missing for call id' #14824
Description
Summary
Codex repeatedly restarts or loses turn continuity during long-running sessions with many tool calls,
especially while polling active exec_command sessions via repeated write_stdin calls.
The visible user symptom is that the agent "crashes after a while", the conversation resumes with
lost short-term continuity, and in some cases running command output retrieval gets aborted mid-flow.
Environment
- Codex client version:
0.114.0 - Observed on:
2026-03-16 - Host path with logs:
/home/drindt/.codex - Active thread during the most recent reproductions:
019cf764-6fc4-7cd3-81d3-3872977ee047
User-visible behavior
- Long-running task proceeds normally for several minutes.
- Agent polls running commands repeatedly with
write_stdin. - After a while the session appears to restart or lose continuity.
- The user sees repeated interruptions and has to say
Fortsetzen.multiple times.
Reproduction pattern
- Start a long-running terminal task with
exec_command, for example:
make gcp-development-vm-tunnel-up - Poll the running session repeatedly with
write_stdin. - Interleave further tool calls and file edits during the same long turn.
- After enough iterations, Codex loses continuity and the session is effectively restarted.
Strong indicators from local logs
Repeated internal normalization error
/home/drindt/.codex/log/codex-tui.log shows repeated entries like:
2026-03-16T17:45:09Z ... Function call output is missing for call id: call_8RF9wsbJahTQ8eOYUnuYLKYa- The same message repeats many times for the same thread.
- A second call id also appears later:
call_G7bB0oUZRjUNo8KOmxuv8oAU
This is visible both in codex-tui.log and in logs_1.sqlite.
Session restart / shutdown around the same time
The same log file shows session shutdown/re-init around the affected period:
2026-03-16T17:52:41Z ... codex_core::codex::handlers: Shutting down Codex instance- Shortly after:
2026-03-16T17:52:54Z ... Resumed rollout successfully from "/home/drindt/.codex/sessions/2026/03/16/rollout-2026-03-16T17-04-40-019cf764-6fc4-7cd3-81d3-3872977ee047.jsonl"
Related warnings seen in the same timeframe
- Shell snapshot deletion warnings:
Failed to delete shell snapshot ... No such file or directory - File watcher warning:
failed to unwatch /home/drindt/.codex/skills/.system: No watch was found - MCP process group cleanup warnings in earlier restarts:
Failed to kill MCP process group ... No such process
These warnings may be secondary, but they cluster around the restart events.
Concrete evidence query
The following query returns the relevant thread-local events:
select datetime(ts,'unixepoch','localtime'), level, target, substr(message,1,220)
from logs
where thread_id='019cf764-6fc4-7cd3-81d3-3872977ee047'
and ts >= strftime('%s','2026-03-16 17:40:00')
order by ts desc, ts_nanos desc
limit 120;Likely failure mode
Codex appears to enter an inconsistent internal state where tool-call bookkeeping loses the output for
one or more call ids (Function call output is missing for call id ...). After that, the session is
eventually shut down and resumed, which looks like a crash from the user perspective.
This does not currently look like a user-shell process crash in the target repo. It looks more
like an internal Codex session/state management bug during long tool-heavy turns.
Impact
- Long debugging sessions become unreliable.
- Operator trust drops because the agent appears to "randomly crash".
- The user must manually continue the session multiple times.
- Mid-flight reasoning context is partially lost even though rollout resume exists.
Requested investigation
- Investigate why
context_manager::normalizerepeatedly logs
Function call output is missing for call id .... - Check whether repeated
write_stdinpolling of long-runningexec_commandsessions can orphan or
desynchronize tool-call bookkeeping. - Check whether session shutdown/resume is being triggered as a recovery path for this state.
- Review the surrounding shell snapshot and file watcher warnings for causal relevance.
Relevant local files
/home/drindt/.codex/log/codex-tui.log/home/drindt/.codex/logs_1.sqlite/home/drindt/.codex/history.jsonl
Activity
github-actions commentedon Mar 16, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
feat(tg): orphan-tool-call auto-recovery + SIGTERM-safe shutdown
dogancanbaris commentedon Jul 10, 2026
I can provide a closely matching Windows Codex Desktop reproduction with local SQLite and rollout evidence. This also appears related to #26306 (dramatic quota/context regression) and #19571 (Pro 5-hour depletion).
Environment
26.707.3748.00.144.0-alpha.4codex-cli 0.144.0gpt-5.6-sol, reasoninghighExact affected identifiers
Primary affected thread:
019f4865-f699-7152-af0b-6c3ebc3b5923019f48b3-cc9f-7260-b045-28b1d0a3da2ccall_NNIPL5C4X9xpf17lvuWcjO0oOther independently active root threads showing the same context-replay amplification:
019f48ac-e788-7ff2-bbb1-692f809b9b70019f4885-b204-7de1-bcc2-3165e6d1ca1d019f4888-e012-7e12-a091-aa5fc3fb4fc7OpenAI should be able to correlate these IDs with server-side request and quota telemetry.
Exact failure
From
logs_2.sqlite, the primary thread logged this normalization/state error 198 times between approximately 2026-07-09 22:43:50 and 23:25:10 America/Toronto:The error target was
codex_core::utilduringrun_turn.prepare_sampling_request_input. The same call ID repeated while the thread's token counter continued advancing.Usage/context evidence
Primary thread
019f4865...at the diagnostic snapshot:execcontinuationswaitcontinuationsThe 318
waitcontinuations alone accounted for approximately 65.6M cumulative input tokens because each continuation carried/replayed a context averaging roughly 200k tokens.Corroborating roots:
019f48ac...: approximately 124.9M local tokens, 742 continuations, 96.4% cached, 5 compactions, 607exec+ 100wait. This rollout also retained about 88 MB of base64 image tool outputs and spawned five workers from a large parent context.019f4885...: approximately 76.7M local tokens, 421 continuations, 97.4% cached, 3 compactions, 363exec+ 43wait.019f4888...: approximately 170.5M local tokens, 909 continuations, 98.1% cached, including 305waitcontinuations accounting for about 58.1M input tokens.The cache itself appears to be working (96-98.5% hits). The pathological behavior is full-context replay across hundreds of small execution/polling continuations. The independent root counters total well over 600M cumulative input tokens, while uncached input across the four was only about 13M. Spawned-thread displayed totals were not naively added because they inherit parent history.
During one roughly four-minute observation window, the local
rate_limitstelemetry moved from about 20% to 23% used for the five-hour bucket and 22% to 23% used for the weekly bucket while the affected roots continued running.No active
agent_jobsrow or separate hidden Codex CLI worker explained the drain. No active background memory-generation sampling job was observed during this diagnostic. The dominant live sampling was attached to these long tool-heavy threads.Suspected combined failure mode
Custom tool call output is missing...repeats for the same call ID.Could maintainers investigate:
wait/poll continuations can orphan custom-tool outputs in code-mode/app-server;I can provide further sanitized SQL queries or event timestamps if useful, but have intentionally omitted repository contents, user prompts, local paths, and credentials.
ELUNIA-Aeon commentedon Jul 29, 2026
I observed a related persistence problem in Codex Desktop on Windows with bundled runtime
0.146.0-alpha.3.1.One quarantined thread contains 21 stable unmatched calls: 3
function_calland 18tool_search_callrecords without corresponding outputs. The gaps remained present across read-only inspections. The thread could complete later turns while already containing those gaps, but after a later reload/resume, new message submission failed before a new user message orturn/startedrecord was persisted.This may indicate that context reconstruction is where older incomplete call/output state becomes fatal, rather than necessarily at the moment the gap is first written. I did not modify the rollout or synthesize missing outputs.
Separately, I also observed the same
agent loop died unexpectedlyUI symptom in structurally complete threads, so incomplete call/output history appears to be one cause, not the only cause. Related desktop/subagent report: #23971.Requested regression coverage:
nemoriko commentedon Aug 12, 2026
Another reproduction on Windows with CLI 0.147.0 — three silent session deaths in one day, all matching the "function call output is missing" fingerprint.
Environment: codex-cli 0.147.0 (TUI), Windows 11 Pro (build 26200), PowerShell 7. Thread
019ff49e-b0b4-7830-8690-18cedaf5cecd, rolloutrollout-2026-08-12T15-17-48-*.jsonl.Pattern (all times UTC, 2026-08-12)
tools.shell_commandstarts an 11-file pytest run → "Script running with cell ID 308" after ~11s. 11:07:30 — model callswait(cell_id=308, yield_time_ms=60000). The rollout contains the waitfunction_callrecord but nofunction_call_outputever follows; nothing further is written. The 60s yield deadline passed silently — the session was dead within 60s of the wait.timeout_ms=10000) — the rollout records the tool call, then nothing. Long-running wait is therefore not a necessary condition.Counter-example: an identical wait at 11:05:19 returned normally in 27.6s (the script had exited early) and the session continued.
Local evidence: the internal log DB (
logs_2.sqlite) shows three different process UUIDs across the window; the dying processes leave no WARN/ERROR at the moment of death. No Windows Event Log (WER) entries and no crash dumps — silent at the OS level too. Separately, the post-resume process logged a ~941-message burst ofapp-server event consumer lagged/consumer queue is full; dropping in-process app-server eventwarnings within one second while handling a ~40KB truncated tool output (that process survived).The pytest suite in question is fully mocked unit tests (no real process spawning or killing). Happy to provide sanitized rollout excerpts or run
/feedbackfrom a repro session if useful.