Bug: Codex rollout writer error on every message
When using the Codex agent in lil-agents, every response produces this error in the popover:
ERROR codex_core::session: failed to record rollout items: thread <uuid> not found
The error does NOT appear when running codex directly in Terminal.app with the same auth and the same Codex CLI version, so it seems specific to how CodexSession.swift invokes the CLI.
Likely cause
CodexSession.send(message:) spawns a fresh codex exec --json --full-auto ... process for every user turn, passing the full prior history as a synthetic prompt. This appears to conflict with recent versions of Codex CLI, where the rollout/session lifecycle now expects a longer-lived thread. Related upstream issues:
The code comment says // Current Codex CLI: only "codex exec [OPTIONS] <PROMPT>" (resume/--last removed). — but Codex now exposes a JSON-RPC app-server with thread/start and thread/resume, which would be the correct long-lived integration.
Impact
- Visual noise (red error on every turn)
- Token waste: full history is re-sent in every prompt
Suggested fix
Either (a) filter the known-cosmetic stderr lines so they don't surface to the user, or (b) migrate CodexSession to use codex app-server (JSON-RPC over stdio) with a single long-lived process per session.
Happy to test fixes. Thanks for the project!
Bug: Codex rollout writer error on every message
When using the Codex agent in lil-agents, every response produces this error in the popover:
The error does NOT appear when running
codexdirectly in Terminal.app with the same auth and the same Codex CLI version, so it seems specific to howCodexSession.swiftinvokes the CLI.Likely cause
CodexSession.send(message:)spawns a freshcodex exec --json --full-auto ...process for every user turn, passing the full prior history as a synthetic prompt. This appears to conflict with recent versions of Codex CLI, where the rollout/session lifecycle now expects a longer-lived thread. Related upstream issues:The code comment says
// Current Codex CLI: only "codex exec [OPTIONS] <PROMPT>" (resume/--last removed).— but Codex now exposes a JSON-RPCapp-serverwiththread/startandthread/resume, which would be the correct long-lived integration.Impact
Suggested fix
Either (a) filter the known-cosmetic stderr lines so they don't surface to the user, or (b) migrate
CodexSessionto usecodex app-server(JSON-RPC over stdio) with a single long-lived process per session.Happy to test fixes. Thanks for the project!