Codex Desktop deletes heartbeat automation definition after restart when target thread is archived
Summary
Codex Desktop appears to have silently removed one heartbeat automation after restart. This was not only a sidebar display issue: the automation definition was missing from both $HOME/.codex/automations and the SQLite automations table, while archived automation run threads still existed.
This looks related to automation/session persistence issues such as #23895, but seems more severe because the automation definition itself disappeared.
Environment
- Codex Desktop:
26.519.41501 - Codex app bundle version:
3044 - Codex CLI:
codex-cli 0.130.0 - Platform:
Darwin 25.5.0 arm64 arm - Automation type: heartbeat automation attached to a thread
- Automation schedule: daily evening run
- Target thread state found later: archived
I have intentionally redacted local usernames, exact local thread ids, and account-specific prompt content from this report.
What Happened
Before restarting Codex Desktop, I had two active automations:
- a Gmail automation
- a GitHub automation
After restarting Codex Desktop, only the Gmail automation was visible in the Automations sidebar.
Local inspection matched the UI state:
$HOME/.codex/automations/gmail/automation.toml
The missing GitHub automation was absent from both persistence layers:
$HOME/.codex/automations/github/automation.toml # did not exist
$HOME/.codex/sqlite/codex-dev.db # automations table only contained gmail
However, archived session state still contained previous GitHub automation run threads. The latest matching archived thread had metadata like:
title: Automation: GitHub
Automation ID: github
cwd: <project path containing spaces>
archived: 1
Archived automation transcript text also referenced:
Automation: GitHub
Automation ID: github
Automation memory: $CODEX_HOME/automations/github/memory.md
Last run: <timestamp>
So the automation appears to have existed and run before restart, then disappeared as a definition while its archived run threads remained.
Expected Behavior
Restarting Codex Desktop should not silently remove a heartbeat automation definition from:
$HOME/.codex/automations/<automation-id>/automation.toml$HOME/.codex/sqlite/codex-dev.db, tableautomations
If the target thread has been archived, the automation should remain visible with a warning, keep running against that thread, or ask the user to choose a new target thread. It should not be removed without confirmation.
Actual Behavior
The GitHub heartbeat automation disappeared from:
- the Automations sidebar
$HOME/.codex/automations- the SQLite
automationstable
Archived automation run threads remained, which makes this look like an automation definition persistence, cleanup, or rehydration bug rather than an intentional deletion.
Recovery
I recreated the missing automation from Codex Desktop. After recreation, both persistence layers contained the automation again:
$HOME/.codex/automations/github/automation.toml
$HOME/.codex/automations/github/memory.md
codex-dev.db automations row: id=github, status=ACTIVE
Why This Is Not Exactly #23895
#23895 reports automation run history disappearing while definitions remain on disk.
In this case, the archived run history still existed, but the automation definition itself was missing from both the file-backed automation directory and the SQLite automations table.
Suggested Investigation Points
- Whether heartbeat automations whose
target_thread_idpoints at an archived thread are pruned on startup. - Whether a failed automation rehydration can delete the automation definition instead of only hiding it from the sidebar.
- Whether project-scoped automation threads under paths containing spaces are matched incorrectly after restart.
- Whether the Automations sidebar is rebuilt from
codex-dev.db,$HOME/.codex/automations,session_index.jsonl, or another cache, and whether those sources can diverge.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks for flagging #23895. I reviewed it, and I think this is related but not a duplicate.
Evidence for the distinction:
~/.codex/automations/*/automation.toml; the problem is that visible automation run history fails to rehydrate after restart.githubheartbeat automation definition was absent from both persistence layers after restart:~/.codex/automations/github/automation.tomldid not exist~/.codex/sqlite/codex-dev.dbautomationstable no longer contained thegithubrowAutomation: GitHub/Automation ID: githubrun threads, so this was not a never-created automation. It had existed and run, then the definition disappeared.automation.tomlwas present and the SQLiteautomationsrow existed withid=github,status=ACTIVE.So #23895 looks like a UI/run-history rehydration issue where definitions remain present. This issue looks like automation definition persistence/deletion across both the file-backed automation directory and SQLite state. I am keeping it open unless maintainers prefer to consolidate it intentionally.
Additional observation: I just saw a related but slightly different failure mode, this time without restarting Codex Desktop.
Previously reported failure mode in this issue:
githubheartbeat automation definition disappeared from both~/.codex/automations/github/automation.tomland the SQLiteautomationstable after restart.New failure mode observed now:
githubheartbeat automation definition still exists and is stillACTIVE.~/.codex/automations/github/automation.tomlstill contains:kind = "heartbeat"id = "github"status = "ACTIVE"target_thread_id = "019e55d6-0301-73e0-b7a8-12ade9105a96"automationsrow also still exists:id=githubname=GitHubstatus=ACTIVElast_run_at=2026-05-24 04:39:30 UTCnext_run_at=2026-05-24 13:01:32 UTCHowever, the target thread is no longer visible in the left sidebar. Locally, that target thread exists only under archived sessions:
and there is no corresponding active session file under
~/.codex/sessionsfor that target thread id.The file under
archived_sessionscontinued to be modified later (mtimearound 2026-05-24 12:53 local time), so this does not look like a stale leftover file only. It appears the heartbeat target thread can be archived/hidden while the automation definition remains active and still points at that archived thread.Visible symptom in Codex Desktop:
019e55d6-...) instead of resolving to the conversation name.GitHubconversation is missing from the left sidebar.This makes the issue look broader than definition deletion on restart. There may be two related lifecycle bugs:
Expected behavior: a conversation used as a heartbeat automation target should not be silently archived/hidden, or the automation should clearly ask the user to rebind it instead of continuing to point at a hidden archived thread id.
Additional update after re-running/restarting the heartbeat automation:
After manually starting the
githubheartbeat again, the previously missingGitHubconversation reappeared in the left sidebar with its previous history. The Automations UI still displayed the target as the raw thread id (019e55d6-...), and the UI showed a toast:Heartbeat thread is busy right now.Verified local state after this observation:
~/.codex/automations/github/automation.tomlstill exists and isACTIVE, withtarget_thread_id = "019e55d6-0301-73e0-b7a8-12ade9105a96".automationsrow is also stillACTIVE;last_run_atadvanced to2026-05-24 09:18:18 UTC.~/.codex/sessions.~/.codex/archived_sessions/rollout-2026-05-24T01-15-49-019e55d6-0301-73e0-b7a8-12ade9105a96.jsonl.May 24 17:20:22local time) and contains the heartbeat output through2026-05-24T09:20:02Z.automation_runshas no rows forautomation_id = 'github'or for that target thread id, while other heartbeat automations do have rows there.Current interpretation:
archived_sessions.automation_runspersistence for this heartbeat.Expected behavior: if a heartbeat target thread is archived/hidden, the app should consistently rehydrate/show/rebind it, or warn that the target is archived, instead of letting the sidebar hide it and then resurrect it only after a manual automation start.