Skip to content

fix(codex): persist visible monitor delivery across restarts#366

Open
ryofukutani wants to merge 2 commits into
fujibee:mainfrom
ryofukutani:fix/263-codex-visible-monitor
Open

fix(codex): persist visible monitor delivery across restarts#366
ryofukutani wants to merge 2 commits into
fujibee:mainfrom
ryofukutani:fix/263-codex-visible-monitor

Conversation

@ryofukutani

Copy link
Copy Markdown

Summary

  • persist the last explicit Codex actas role and restore it from SessionStart
  • make Codex monitor mode install both SessionStart and the visible Stop-hook fallback
  • prefer visible app-server turns and keep headless codex exec resume opt-in only
  • inject a strict visible-work contract into delivered Codex turns
  • split unread peek from mark-read so collectors do not consume messages before visible handling completes
  • add monitor health, failure fallback, and complete app-monitor teardown

Why

A live headless worker can answer agmsg messages outside the visible Codex thread. Rewriting monitor mode to turn mode avoids hidden work but removes SessionStart, so the selected role is not restored after restart. This change keeps monitoring persistent while preserving visible ownership of message handling.

Verification

  • focused persistence/visibility tests: 5/5
  • focused bridge prompt/read ownership test: 1/1
  • messaging tests: 18/18
  • install tests: 45/45
  • Codex bridge/monitor/delivery/install/watch combined run: 212/213 on first run; the existing watcher self-clean race passed immediately when rerun alone
  • bash -n, node --check, git diff --check, npm smoke test: pass
  • shellcheck: pass with existing dynamic-source/platform exclusions
  • live local reinstall: mode=monitor, SessionStart+Stop hooks installed, last actas role restored, chat-visible fallback armed, no headless app monitor

Closes #365
Refs #263
Refs #361

Ryo FUKUTANI and others added 2 commits July 12, 2026 04:26
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>
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.

Codex monitor: persist actas role and require visible handling across restarts

1 participant