Skip to content

feat(launchd): durable LaunchAgent for codex_session daemon#1

Merged
CondorCommodore merged 1 commit into
mainfrom
feature/launchd
May 29, 2026
Merged

feat(launchd): durable LaunchAgent for codex_session daemon#1
CondorCommodore merged 1 commit into
mainfrom
feature/launchd

Conversation

@CondorCommodore
Copy link
Copy Markdown
Owner

Summary

Brings the codex tab status signal producer under launchd supervision, mirroring the conductor-tick launchd pattern in ~/code/home-lab/launchd/.

Three new files in launchd/:

  • com.local.codex-tab-status.plist — template with __REPO_ROOT__ / __HOME__ / __PYTHON3__ placeholders
  • install-codex-tab-status-launchd.sh — resolves python3, expands template, launchctl bootstrap gui/$UID, verifies
  • uninstall-codex-tab-status-launchd.sh — idempotent bootout + plist rm
  • README.md — manage / status / why-KeepAlive-not-StartInterval

Why KeepAlive

codex_session.py --daemon is a long-running poll loop. KeepAlive=true (respawn on crash) is the right primitive. Compare conductor-tick which is one-shot per 120s and uses StartInterval=120 instead.

Test plan

  • Install script bootstraps cleanly from a fresh state
  • Plist template substitution produces a valid plist (parsed by launchctl)
  • Daemon respawns when killed (KeepAlive verified)
  • Signal files appear at ~/.cache/claude-tab-status/codex-*.json within seconds
  • Uninstall script is idempotent (safe to run when not installed)
  • Operator: confirm codex tab titles pick up ⚡ / 💤 indicators in iTerm2 after install

Mirrors the conductor-tick launchd pattern (home-lab launchd/):
- plist template with __REPO_ROOT__/__HOME__/__PYTHON3__ placeholders
- install script resolves python3, expands template, bootstrap/enable/verify
- uninstall script is idempotent bootout + plist removal
- README explains KeepAlive (long-running daemon) vs StartInterval
  (one-shot every N seconds) — codex_session is the former, conductor-
  tick is the latter

Smoke verified: install bootstraps cleanly, daemon respawns on kill,
signal files appear at ~/.cache/claude-tab-status/codex-*.json.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27e4b71a97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +43
-e "s|__REPO_ROOT__|${REPO_ROOT}|g" \
-e "s|__HOME__|${HOME}|g" \
-e "s|__PYTHON3__|${PYTHON3}|g" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape paths before substituting the plist template

When the checkout or home directory contains sed replacement metacharacters (for example a path like /Users/me/R&D/iterm2-tab-status or a volume/folder name containing |), these raw replacements either expand & back to the matched placeholder or break the sed expression, so the installed plist points at a non-existent script/log path or fails to bootstrap. Escape the replacement strings (and XML string content) before writing the LaunchAgent plist.

Useful? React with 👍 / 👎.

@CondorCommodore CondorCommodore merged commit cd6facb into main May 29, 2026
4 of 5 checks passed
@CondorCommodore CondorCommodore deleted the feature/launchd branch May 29, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant