`history` doesn't work in headless mode

Resolved 💬 4 comments Opened May 16, 2025 by homanp Closed Aug 7, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.1.2505140839

Which model were you using?

gpt-4.1

What platform is your computer?

Linux 6.1.102 x86_64 x86_6

What steps can reproduce the bug?

  1. codex -a auto-edit -m "gpt-4.1" --quiet "My name is John"
  2. codex -a auto-edit -m "gpt-4.1" --quiet "What's my name?"
  3. Codex does not remember the

What is the expected behavior?

History should work in headless mode similar to interactive mode.

What do you see instead?

History not working, or at least agent not being able to access history.

Additional information

config.json

{
  "model": "gpt-4.1",
  "approvalMode": "auto-edit",
  "fullAutoErrorMode": "ask-user",
  "notify": true,
  "history": {
    "saveHistory": true,
  }
}

View original on GitHub ↗

4 Comments

homanp · 1 year ago

@bolinfest

I was expecting this to work in headless mode? https://github.com/openai/codex/pull/939
No history jsonl file is present in the config after turning history on.

bolinfest collaborator · 1 year ago

@homanp Note that #939 is related to the Rust version of Codex CLI, though you shared config.json, which only applies to the TypeScript version.

I was unsure of whether folks would be interested in the exec subcommand supporting history: is that what you are asking for?

homanp · 1 year ago
@homanp Note that #939 is related to the Rust version of Codex CLI, though you shared config.json, which only applies to the TypeScript version. I was unsure of whether folks would be interested in the exec subcommand supporting history: is that what you are asking for?

Ah got it now, basically I'm running codex in a micro-vm, so yes would would need history. Currently using the AGENTS.md as a scratchpad for history.

codex-maintainers · 1 year ago

Thanks for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, let us know.