fix(monitor,resume): honor stopped status + clear stop metadata on resume

Implements user choice Option B: the two follow-ups to 0de0f23, in one patch.

Changes:
- skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh:
  - drift-A skip-set extended: ('terminated', 'archived', 'stopped')
  - prevents the monitor from overwriting a tmux-dead 'stopped' row with
    'terminated (auto-detected)', which would lose resumable + captured id
- skills/tmux-agent-orchestrate-resume/scripts/update_yaml_resumed.sh:
  - pop stopped_at, stopped_at_epoch, stop_reason, resumable on resume
    (alongside the existing terminated_at*/termination_mode/archived_at) so a
    resumed row has no stale end-of-session metadata
- skills/tmux-agent-orchestrate-monitor/SKILL.md: documented 'stopped' in the
  drift class list + a skip-set note on drift class A
- skills/tmux-agent-orchestrate-resume/SKILL.md: documented stopped -> running
  transition + tier-1 race-free resume path

5-route surface preserved (no new directory). delete_session.sh untouched.

Verified on isolated server -L claude-followup-test (kill-server after):
- syntax PASS
- E2E A: stop -> tmux dead -> reconcile --once -> status stays 'stopped'
- E2E B: resume -> stopped_at/stopped_at_epoch/stop_reason/resumable all gone
- E2E C: plain delete -> terminated, reconcile leaves it (no regression)
- Real YAML + main canary untouched

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 15:32:02 +00:00
parent 0de0f236b2
commit a2d4f80608
4 changed files with 32 additions and 2 deletions
@@ -30,7 +30,7 @@ Dispatch a **Kanban worker** (in `goal_mode`) that:
- `~/.gemini/antigravity-cli/conversations/<uuid>.db` mtime (agy)
2. Compares the live state to `agent-sessions.yaml`
3. Detects 4 classes of drift:
- **yaml-only terminated**: tmux dead, YAML says `terminated` → OK
- **yaml-only terminated/archived/stopped**: tmux dead, YAML says `terminated`, `archived`, or `stopped` → OK, left untouched (deliberate end states)
- **yaml-only running, tmux dead**: YAML says `running`, tmux is gone → mark `terminated` with timestamp
- **tmux-only running, not in YAML**: tmux session exists with `<workspace>-creator-*` naming but YAML doesn't know about it → register as a new entry
- **stale UUID**: YAML has a UUID, but the on-disk artifact is gone → flag in comment
@@ -120,6 +120,13 @@ tmux: no session
→ comment: "lab-landing-page-creator-claude: tmux gone (was pane 201132, cmd claude). Marked terminated."
```
**Skip-set**: the auto-terminate only fires for sessions whose status is `running`.
Rows already in a deliberate end state — `terminated`, `archived`, or **`stopped`**
(set by `tmux-agent-orchestrate-delete --capture-id/--reason/--graceful`) — are
left untouched. This is critical: a `stopped` row keeps its `resumable: true` and
captured `*_session_id_own`, so the monitor must **not** overwrite it with
`terminated ("auto-detected")` when its tmux is (expectedly) gone.
### B. tmux alive, not in YAML → auto-register
```