claude-code driver: read-only Monitor liveness probe (already-alive / monitor-not-started / resume-without-monitor) gating dispatch

Open
#1,295 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
bash, shell, sqlite

Research direction

Start from the claude-code driver, SessionStart hook, and watch.sh as described: add a read-only probe that matches the current session id to the live watcher and returns already-alive, monitor-not-started, or resume-without-monitor without spawning, killing, or changing read_at. Gate dispatch in the hook and claude-code template until a fresh probe reports already-alive; keep it distinct from the unread-count notice in issue 1294. Done when the three local cases (stopped watcher, other session, healthy) return the three states and processes plus read state are untouched.

Written by the indexing model from the issue text.

Description

Context. agmsg v1.3.0 (3fc7d2b), Claude Code + Codex (resident Codex workers under systemd, Codex Desktop as a leader), one team of 5–6 seats across two machines (Linux headless + Windows). We carry this as a local patch on top of the release and re-apply it on every install.sh --update; filing it here so it can become an upstream contract instead. Happy to send a PR if the direction is welcome.

Problem. After a resume (--continue / /clear), the session's context still contains an old "Monitor started" line, so the agent assumes it is receiving while the watch.sh process is actually gone. Messages then queue silently until someone notices. The SessionStart hook cannot tell the agent whether this session's watcher is alive right now; it only re-emits the directive.

Proposal. A read-only liveness probe that matches the session id against the real watcher process and returns one of three states: already-alive, monitor-not-started, resume-without-monitor. The SessionStart hook (and the claude-code template) surface that state as a hard gate before any dispatch: "Dispatch is BLOCKED until the Monitor task is started and a fresh probe reports already-alive." The probe must not change read state, must not spawn or kill anything, and must be distinct from the unread-count notice (#1294).

Acceptance we use locally. Three cases — watcher stopped, watcher belonging to a different session, watcher healthy — return three different states; the probe leaves processes and read_at untouched.

Relation to the agmsgd RFC. Overlaps with the daemon's single diagnostic endpoint. Once the daemon exposes an equivalent answer for a session we would drop this; the ask is only that the state be queryable and gated on, whichever process answers.

Dominant language
Shell
Stars
1.5k
Forks
156
Avg merge
13h 56m
Merged PRs (30d)
186

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fujibee/agmsg

All issues in fujibee/agmsg

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.