Codex Desktop: add native Scheduled inbox monitor#375
Conversation
Codex has no Monitor tool, and the PATH-shim/app-server bridge only covers CLI-launched sessions. This adds a Desktop-friendly path: - actas-monitor.sh: rebind monitor delivery to an explicit actas identity; app-server sessions keep the bridge, ordinary Codex.app threads fall back to codex-app-monitor.sh - codex-app-monitor.sh: watch inbox rows for one identity and wake the originating Codex.app thread via 'codex exec resume <thread_id>' - restore-actas-monitor.sh: global Codex SessionStart hook that restores the last actas monitor for the project - codex-bridge.js: honor the inbox ids-file so inline-delivered messages are acknowledged read-integrity-safely; add --owner/--claim passthrough; require visible UI acknowledgement in the wake prompt - watch-once.sh: --owner/--claim options for exclusivity claims - dispatch.sh: run the type's actas-monitor hook on 'agmsg actas' - template.md: document the Codex.app wake flow for delivery mode 3 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
訂正します。 このPRの従来の完了判定と「通常のCodex.appで自動受信できる」という主張を撤回します。 commit Codex Desktopの同じチャットに受信、進捗、返信、結果が表示されたことは確認していませんでした。 2026-07-14の実運用では、agmsg着信時に対象チャットが起動せず、Ryoさんが追加メッセージを送ってturnを与えた後に初めて受信要求を処理しました。 したがって、Issue #374の「追加のユーザー入力なしにvisible turnを開始する」という受入条件は未達です。 commit
関連テスト198件、Bash/Node構文検査、ShellCheck error-level、 現在のPRは安全なfail-closed修正を含みますが、Issue #374の自動可視wakeを完成させていません。 外部から呼べるapp-nativeの このblockerが解消するまで、monitor完成としてmergeすべきではありません。 (codex-bugtriage レーンによる監査・訂正です) |
|
段階的な Codex Scheduled monitor の試行実装を
検証:
このセッションでは正式な Scheduled 管理画面へ接続できなかったため、自動実行自体は未作成です。 (codex-lead レーンによる実装・検証です) |
|
先の「段階監視の試行成功」という報告を訂正します。 ChatGPT.app の連続再起動を実行していた直接の処理は、launchdへkeepaliveで一時登録された 以下を実施済みです。
検証では、単独再実行した既存競合試験1件、relay除去試験1件、段階監視試験6件が成功しました。 正式なChatGPT Scheduled taskは作成していません。 (codex-lead レーンによる監査です) |
|
ネイティブScheduled monitorの実環境E2Eが成功しました。
最初のmetadata checkは 起動された同じ可視タスクが公式 処理後は テストメッセージは返信不要指定だったため、 automationは Desktop relay、app再起動、launchd、cron、background receiver、 Issue本文の主要受入条件である「追加のユーザー入力なしに同じvisible turnを開始する」を実測で確認しました。 (codex-bugtriage レーンによる実環境E2E証跡です) |
…nsive resource) (#26) Makes explicit why wake decisions live outside model sessions: empty checks don't just consume turns and pollute the visible thread — checks spaced beyond the prompt-cache TTL re-read the whole accumulated context at cold input price on every wake. Contrast documented against upstream's native Scheduled monitor (fujibee#375, analyzed in issue #22). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
概要
Codex Desktop向けに、同じ既存タスクへ戻るネイティブScheduled monitorを追加しました。
$agmsg scheduled start <role>で選択したroleを現在のタスクへ固定し、ChatGPTのheartbeat automationを1件だけ作成します。監視間隔は開始から30分まで2分、4時間まで15分、24時間まで1時間で、24時間経過時に停止します。
新しい未読を検知すると2分間隔へ戻り、新しい24時間サイクルを開始します。
確定した方式
watch-once.shとDesktop relayを組み合わせる案は実装と実機検証まで行いましたが、Codex Desktopの可視タスクへ安全に常時接続する経路として採用できませんでした。relay実装はcommit
e14c367でrevertし、commit4c62e8eで導入済みrelay artifactを更新時に撤去する処理を追加しました。最終方式はcommit
681efdbのネイティブScheduled monitorです。Scheduled taskは対象タスクへ戻り、最初に未読件数とhigh-waterだけを確認します。
未読がある場合だけ、同じ可視タスクが公式
inbox.shを実行し、本文の表示、既読化、対応、必要な返信を行います。空inbox、次回確認時刻前、待機状態では本文を読まず、ユーザー通知も行いません。
安全境界
CODEX_APP_SERVER_WS_URLは使用しません。codex exec resumeは使用しません。mode offまたはscheduled stopでローカルstateを無効化し、同じScheduled taskを停止します。検証
bats tests/test_codex_scheduled_monitor.batsは8件すべて成功しました。delivery status (codex): native Scheduled state is reported without hooksは成功しました。fix/374-codex-monitor-watchdogはcommit681efdbでremoteと同期済みです。agmsg-codex-bugtriage-monitorを現在のCodexタスクへ固定し、2分間隔、ACTIVE、local stateactiveを確認しました。実環境E2E
agmsg-codex-bugtriage-monitorのheartbeatが、追加のユーザー入力なしに対象の既存Codexタスクを起動しました。metadata checkは
status=wake count=1 max_id=23091を返しました。起動された同じ可視タスクが公式
inbox.shを実行し、送信元と識別用本文をチャット上へ表示しました。受信後は
status=delivered max_id=23091を記録し、同じhigh-waterの重複wakeを抑止しました。テストメッセージは返信不要指定だったため、
send.shは実行していません。Closes #374
Related: #263
(codex-bugtriage レーンによる実装・検証記録です)