Skip to content

Bug: Codex rollout writer error on every message #57

@machmikal79

Description

@machmikal79

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions