Unofficial Windows startup gate for Codex Desktop automations.
Safe Start for Codex is a small Python utility for users who run many Codex Desktop automations and want to avoid a startup surge after opening the app. It temporarily pauses currently active local automations, launches Codex Desktop, then releases the paused automations in a controlled sequence.
This project is not affiliated with, endorsed by, or maintained by OpenAI.
- Scans local Codex automation TOML files under
CODEX_HOMEor~/.codex. - Pauses automations that were
ACTIVEat tool start. - Starts Codex Desktop on Windows.
- Releases a small first batch whose next schedule is safely in the future.
- Releases the remaining automations gradually.
- Restores only automations that this tool paused.
- Optionally removes stale Codex startup leftovers on Windows, such as old main processes without a renderer and stale lockfiles.
- Can generate a read-only catch-up plan for rare automations that appear to have missed a scheduled run.
It does not activate automations that were already paused before the run. It does not call Codex Desktop's manual "Run now" action.
This is a workaround around local Codex Desktop automation behavior. It edits files in ~/.codex/automations/*/automation.toml, creates snapshots under ~/.codex/automation-safe-start, and may terminate stale Codex-related Windows processes during startup cleanup.
Run a dry run first:
safe-start-for-codex dry-runCreate a backup before first real use:
safe-start-for-codex backupFrom a clone:
python -m pip install -e .For the optional tray mode:
python -m pip install -e ".[tray]"Dry run:
safe-start-for-codex dry-runStart Codex and gate automations in the foreground:
safe-start-for-codex startRun as a tray app:
safe-start-for-codex trayShow current status:
safe-start-for-codex statusCreate a default config:
safe-start-for-codex config-initShow the resolved config:
safe-start-for-codex config-showShow a read-only catch-up plan for rare missed automations:
safe-start-for-codex catchup-planRestore the latest tool-paused automations:
safe-start-for-codex restore-latestBy default, Safe Start reads:
~/.codex/automation-safe-start/config.json
Example:
{
"initial_release": 3,
"interval_minutes": 5,
"startup_delay_seconds": 45,
"min_future_lead_minutes": 2,
"launch": true,
"cleanup": true,
"catchup_enabled": false,
"catchup_lookback_days": 30,
"catchup_max_per_start": 1,
"catchup_min_period_hours": 24
}initial_release, interval_minutes, and startup_delay_seconds control how many automations are re-enabled at startup, how long Safe Start waits between later releases, and how long it waits after launching Codex. Command-line flags override the JSON config for that run.
When catchup_enabled is true, Safe Start creates a best-effort catch-up report and prioritizes up to catchup_max_per_start rare missed automations for early release. The threshold is controlled by catchup_min_period_hours; the default only considers schedules rarer than daily. The feature is intentionally conservative: it reads schedule metadata and thread titles/timestamps, but it does not trigger Codex's manual run action.
The workaround exists because the underlying behavior is better solved inside Codex itself. See:
In short: Codex Desktop could include a native startup catch-up policy, a rate-limited automation release gate, clearer run-state semantics, and safer startup cleanup for stale app processes.
Safe Start for Codex ist ein inoffizieller Windows-Workaround gegen Automations-Nachholwellen beim Start von Codex Desktop. Bitte zuerst dry-run ausführen und beachten, dass das Tool lokale Automationsdateien unter ~/.codex verändert.
python -m pip install -e ".[dev]"
pytestBuild the windowed tray EXE:
.\build_exe.batMIT License. See LICENSE.