Codex Memories stage1 succeeds but global consolidation remains pending and no summary artifact is generated on Windows
Summary
Codex Memories appears to be enabled and stage1 extraction is working, but global consolidation does not produce a summary artifact.
This may be related to #21884, but my local state is slightly different: stage1_outputs is not empty and raw memory files are being generated. The issue appears to be in the global consolidation / summary artifact step.
Environment
- OS: Windows
- Codex CLI: 0.130.0
- Auth mode: ChatGPT
- Memories feature: enabled
Config:
[features]
memories = true
[memories]
generate_memories = true
use_memories = true
Observed behavior
The following files/directories exist and are populated:
~/.codex/memories/raw_memories.md~/.codex/memories/rollout_summaries/
The local state database also shows memory extraction output:
stage1_outputs: 24 rows- multiple
memory_stage1jobs aredone
However, the following summary artifacts are not present:
~/.codex/memories/MEMORY.md~/.codex/memories/memory_summary.md
The jobs table shows:
memory_consolidate_globalwithjob_key = global- status:
pending last_success_watermarkappears to be set- no generated summary artifact appears in
~/.codex/memories/
Some memory_stage1 jobs failed with:
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
Expected behavior
If stage1 memory extraction succeeds, Codex should either:
- generate/update the summary artifact used by future sessions, or
- surface a clear error explaining why global consolidation cannot complete.
Actual behavior
Raw memory files and rollout summaries are created, but the global summary artifact does not appear to be generated. The settings indicate Memories are enabled, but it is unclear whether future sessions can actually use the extracted memories.
Notes
This looks different from a complete memory extraction failure because stage1_outputs contains rows and raw_memories.md is populated. The problem seems to be at or after memory_consolidate_global.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I’m seeing a very similar issue on Linux / remote CLI, so this may not be Windows-specific.
Environment:
0.142.5gpt-5.5~/.codex/config.tomlhas:Observed behavior:
~/.codex/memories/raw_memories.mdwas updated recently.~/.codex/memories/rollout_summaries/also received new summary files at the same timestamp.~/.codex/memories/MEMORY.mdand~/.codex/memories/memory_summary.mdremain stale and have not been updated since an older date.Example state:
So stage/thread-level extraction appears to be working, but the global consolidation / summary artifacts are not being refreshed.
This looks closely related to the issue described here: raw memory artifacts are generated, but
MEMORY.md/memory_summary.mddo not get updated. Happy to provide more logs or inspect local state if there is a recommended diagnostic command.I'm experiencing the exact same thing as you @dufu1483 and I am on Ubuntu 24.04 Linux
My skills and rollout_summaries have not updated since June 18 but that's fine. However, MEMORY.md and memory_summary.md have not updated since June 18 either, even though raw_memories.md updated just fine today, and
~/.codex/memories/extensions/ad_hoc/notes/updated just fine today with 4 new .md files too.Still present on 0.145.0 (Windows 11), and I think I found the root cause for the missing summary artifact. Sharing analysis + reproduction + a fix outline per CONTRIBUTING.
TL;DR
Global consolidation runs a sub-agent that needs 1–2 minutes to finish.
codex exectears the process down as soon as its own turn ends, so the agent is cut off mid-work and the job is recorded asfailed_agent. Giving the process enough lifetime makes the whole pipeline complete and produce both artifacts.What I observed (0.145.0, Windows, ChatGPT auth)
Phase 1 works fine —
memory_stage1reachesdoneandraw_memories.mdgets real content:But
memory_consolidate_globalends asfailed_agent, and noMEMORY.md/memory_summary.mdis written. Logs show the consolidation agent starting and issuingshell_commandcalls inside the memories root — it just never reaches a final status.Ruled out by measurement, each tested separately: missing raw material,
[windows] sandbox = "elevated", an explicitmemories.consolidation_model, a stale lease blocking the job, and turn lengths of 20–30 s.The deciding experiment
Same setup, but the main turn was made long enough for the background task to finish (a single shell call sleeping ~150 s):
A new session then answered a question that was only ever stated in the earlier, consolidated session — and answered
unknownwithuse_memories = false. So the full chain works; it is a lifetime problem, not a defect in extraction or consolidation logic.This also explains the two different error codes:
|
last_error| meaning || --- | --- |
|
failed_agent| sub-agent never reached a final status (loop_agenthitssession_terminationand returnsAgentStatus::Errored) ||
failed_invalid_artifacts| agent finished, butvalidate_consolidation_artifactsfailed — it requiresMEMORY.mdandmemory_summary.mdwhose first line is exactlyv1|I saw
failed_invalid_artifactsin an interactive TUI run where phase 1 had produced nothing, i.e. the agent had no material to consolidate.Why reproducing this is harder than it looks
Three additional conditions are silent — no log line, only a
skipped_no_candidatesmetric — and they made this take a while to isolate:push_thread_filtersrestricts candidates tothreads.source IN ('cli','vscode')(INTERACTIVE_SESSION_SOURCES). Acodex execsession writessource = 'exec'and is never eligible, so memories can only originate from interactive sessions.min_rollout_idle_hoursis.clamp(1, 48)-ed on load. Setting0in config.toml silently becomes1, and the default is 6 — checking right after a session always finds nothing.runningwith a futurelease_untiland a deadworker_id, blocking further attempts until it expires. (This may be what thependingrow in the original report is about, though I could not verify that on 0.130.0.)Fix outline
In increasing order of effort:
loop_agentbreaks because ofsession_termination, the job could be released back topendinginstead of being markedfailed_agent. As it stands, a normalcodex execrun burns a retry attempt and puts the job into backoff for an hour, even though nothing actually went wrong.codex exec(deterministic completion point) would make this workable in automation — this overlaps with the request in #29430.skipped_no_candidates, themin_rollout_idle_hoursclamp, and thesourcerestriction are currently invisible at every log level; a singleinfo!/warn!on each would have turned a multi-hour investigation into a two-minute one.Not verified
I did not test on 0.130.0, so I cannot confirm that the
pendingstate in the original report has the same cause. I also did not check macOS or Linux — the lifetime issue should be platform-independent, but the sandbox interactions may not be.Reproduced on Windows 10 Home Single Language (build 19045) + Codex 0.146.0 stable (standalone installer via
chatgpt.com/codex/install.ps1, install method =standalone, NOT AppX; previous alpha0.146.0-alpha.3.1had the same bug).Concrete evidence on disk:
~/.codex/memories_1.sqlite(memories DB, integrity OK):jobstable has 1 row,kind='memory_consolidate_global',status='done',started_at=1784906285,finished_at=1784906335,input_watermark=0,last_success_watermark=0,last_error=null. Job ran ~50 s, marked itself done with zero watermarks -- no rollouts were actually consumed.stage1_outputstable: 0 rows.~/.codex/sessions/2026/07/30/contains 12 active rollout JSONL files (~6.0 MB) + 5 archived.state_5.sqlite.threadshas 17 rows. So source data exists but is never fed into stage1.codex features listconfirmsmemories stable true. No override on/off mismatch. 31 stable+enabled feature flags.codex doctorreports17 ok/1 idle/0 warn/0 fail-- nothing hints at the broken pipeline.codex memory,codex features memory,codex recall,codex consolidate-- none exist in 0.146.0. So even with full awareness, an end user cannot force the pipeline to run.A new
in_app_updatesfeature flag (stable, true) shipped in 0.146.0 -- not sure if it touches the sub-agent lifecycle, but it appears new vs 0.145.0.Lining up with @reze83's analysis: ~50-second wall-clock for the consolidate-global job matches a sub-agent being cut off mid-flight. Our job's
donestatus with zero watermarks is exactly the symptom of the sub-agent returning early without writing tostage1_outputs.Environment: