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
@@ -29,6 +29,22 @@ Three cases this skill handles:
2. **tmux is alive but empty** — You started a session with `tmux-agent-orchestrate-create` but haven't sent a message yet (so no session id was assigned). The user can either send their first message (and the id is auto-assigned), or you can read the *workspace's* most recent conversation from `$HOME_DIR/.gemini/antigravity-cli/cache/last_conversations.json` (defaults to `~/.gemini/...`) for agy, or the latest `*.jsonl` in `$CLAUDE_PROJECT_DIR/<workspace-key>/` (defaults to `~/.claude/projects/`) for claude.
3. **tmux is alive AND the agent inside is already running** — Just attach. No re-spawn needed.
### Resuming a `stopped` session (`stopped → running`)
When a session was ended via `tmux-agent-orchestrate-delete --capture-id` (STOP
mode), its row is `status: stopped` with `resumable: true` and the conversation id
already recorded in `claude_session_id_own` / `agy_conversation_id_own`. This is the
ideal resume path:
- **tier-1, race-free**: because `--capture-id` wrote the id into the row at stop
time, `resolve_session_id.sh` resolves it via `find_workspace_uuid` tier-1 (the
per-row own id) — no reliance on the mtime-based disk scan, so a concurrent
session in another workspace can never shadow it.
- On resume, `update_yaml_resumed.sh` transitions `stopped → running` and **clears
the stop metadata** (`stopped_at`, `stopped_at_epoch`, `stop_reason`, `resumable`)
along with the usual `terminated_at*` / `termination_mode` / `archived_at`, so the
row reflects a clean running state with no stale end-of-session fields.
## UUID resolution order
`agent-sessions.yaml` is the *primary* source. The skill reads in this order: