Type to search by title, content, or category

Esc to close, Enter for all results

/ Coder

Updating Six CLI Tools Weekly with Codex: From Automation Setup to Execution Verification

How to configure a recurring Codex automation on macOS to update agy, grok, codex, claude, mole, and herdr in parallel, with exit code collection and Homebrew troubleshooting.

I wanted to consolidate updates for several CLI tools into Monday mornings: agy, grok, codex, claude, and later mole and herdr. The requirements were simple: execute locally on my Mac at 6:00 AM Singapore time every Monday, and report results back to the original Codex thread.

After completing configuration, I manually triggered a test run: 2 updated successfully, 2 were already up to date, and 2 failed. The failed agy update succeeded on a retry with the original command, while herdr required switching to brew upgrade herdr.

The most important takeaway: having update in help docs doesn't guarantee the self-updater works. Because Herdr was installed via Homebrew, running its internal self-updater failed by design. I revised the automation's command list and constraints accordingly.

Observed Test Results

ToolInitial Exit CodeFirst Run OutcomeFollow-up Outcome
agy1Detected 1.4.2 from 1.4.0, download interruptedSucceeded on retry, verified version 1.4.2
grok0Already latest: 1.0.62Unrecognized privacy config warning logged
codex0Updated successfullyVerified version 0.163.0, restart recommended
claude0Already latest: 2.1.302No re-run needed
mole01.56.1 → 1.61.0Verified version 1.61.0
herdr1Homebrew install disables self-updateSwitched to Homebrew: 0.9.3 → 0.9.5 verified

During the initial 6-way parallel run, one failure did not block other updates, and individual outputs and exit codes were collected. While the two failed tools were resolved manually, the full 6-tool suite now reflects verified commands.

This test executed on Sunday, October 18, 2026, at 21:35 Singapore time. It verified the execution pipeline end to end.

Defining "Configuration Complete"

Three distinct aspects must be verified:

  • Command Availability: Does the local install expose an update sub-command?
  • Task Configuration: Are schedules, command lists, working directory, and destination threads persisted accurately?
  • Process Outcomes: What stdout/stderr and exit codes did each subprocess produce?

A status of ACTIVE on the automation does not mean all tasks succeeded. In the initial execution, the parent orchestrator exited with code 0 while child tasks for agy and herdr exited with code 1. Health checks must inspect every subprocess.

Note: Scheduled automations execute on local macOS environments involving shell permissions and subprocess exit code collection. Validate individual update semantics before scheduling.

Step 1: Verify Command Paths and Entrypoints

Inspect command locations in the local terminal:

zsh -lc 'command -v agy grok codex claude mole herdr brew'

Resolve any missing paths or environment dependencies. Hardcoding absolute paths to a specific Node version ties the automation to that runtime directory; commands should be dynamically resolved via command -v.

Next, inspect help entries:

zsh -lc 'agy help update'
zsh -lc 'grok update --help'
zsh -lc 'codex update --help'
zsh -lc 'claude update --help'
zsh -lc 'mole --help'
zsh -lc 'herdr --help'

mole lists mo update in docs but executes cleanly via mole update. herdr lists herdr update but fails when installed through Homebrew. The final validated command list is:

agy update
grok update
codex update
claude update
mole update
brew upgrade herdr

Always align update commands with installation managers. Mole delegates to Homebrew internally; Codex invokes npm.

Step 2: Formulate Comprehensive Prompt Instructions

Scheduling an automation requires clear error-handling and environment bounds.

Here is the exact prompt configured in Codex:

请在当前聊天创建一个定时任务:每周一早上 06:00,时区 Asia/Singapore,
在当前这台本地 Mac 上更新以下六个已安装程序:
agy update
grok update
codex update
claude update
mole update
brew upgrade herdr

我授权这个定时任务执行以上六项更新。结果返回当前聊天。

每次使用本机 zsh 登录 shell,以我的主目录为工作目录,
先用 command -v 重新确认每个命令的位置,不固定写入 Node 版本路径。

六项更新并行执行,分别保留输出与退出码,并等待全部结束。
一项失败不影响其他项。拿到最终输出和退出码后,再判断各项结果。

Herdr 使用 brew upgrade herdr,其余五项使用各程序自带的 update。
不要再执行 herdr update。保留当前发布通道。
不使用 sudo,不修改 shell 配置或项目文件。
遇到缺少程序、网络失败、权限不足或需要人工输入,报告具体原因;
不自动确认未知提示,不更换安装方式。

有更新或异常时,用简体中文简要列出各项结果与失败原因。
全部已经是最新版本且没有异常时,保持安静。

The initial run verified parallel execution and fault isolation. The runner closes stdin and enforces a 20-minute execution timeout per tool.

Step 3: Verify Persistence and Modify in Place

After creating the automation, verify the returned task ID and ACTIVE state, then read back parameters to confirm schedules and target threads.

When adding mole and herdr later, amend the existing task rather than creating duplicate automations:

请把 <工具名> update 加入刚才的每周更新任务。
先核对本机命令和帮助信息,保持原有调度时间、目标聊天和执行要求。
修改后回读配置,确认完整命令清单。

When Herdr failed on self-update, the command was changed to brew upgrade herdr, and the prompt constraint "all use built-in update" was corrected.

Configuration Pitfall: Local Execution vs. Destination Thread

The initial creation failed with:

automation_update received invalid arguments: targetThreadId: Missing targetThreadId or destination=thread.

The tool expected destination: "thread" along with targetThreadId when routing notifications. Separating "runs locally on Mac" from "reports back to current thread" resolved the issue.

Troubleshooting Case Studies

Herdr: Packaging Decides the Upgrade Command

herdr update exited with code 1, reporting that Homebrew installations disable built-in updates. Retrying the same command was pointless.

I updated the automation and executed manually:

zsh -lc 'cd ~ && command -v brew && brew upgrade herdr' </dev/null
zsh -lc 'herdr --version'

Homebrew upgraded Herdr from 0.9.3 to 0.9.5 with exit code 0.

agy: Network Interruption on Download

agy initially reported Download interrupted: unexpected EOF prior to installation. A retry resolved the issue:

zsh -lc 'cd ~ && command -v agy && agy update' </dev/null
zsh -lc 'agy --version' </dev/null

The second attempt completed download, checksum validation, and installation cleanly with exit code 0, verifying version 1.4.2.

Verification Boundaries

This setup assumes the Mac is powered on, awake, and the Codex desktop client is active. Behavior following sleep, shutdown, or app exits was not benchmarked.

CLI binary versions were verified on disk; running daemon sessions or shells may require manual restarts to load new executables.