Decide the thread lifecycle for resume: clean-exit revoke versus reopenable threads #209

Closed AtlantisPleb opened this 2d ago 1 comment

Problem

The resume work (OpenAgentsInc/openagents#24) exposed a lifecycle tension: the CLI revokes its thread on clean exit (DELETEcancelled), and a terminal thread refuses both new events and re-minting (POST /api/v3/threads/{id}/grants, THREAD-001). So today --resume can only continue sessions that crashed or ran on another machine — a cleanly exited session is unresumable by design.

Options

  1. Stop revoking on clean exit. The thread stays open with no active grant; resume re-mints. Cost: open threads accumulate against the 8-open-per-account quota, so this needs either a higher quota, idle-thread expiry, or an explicit /done gesture that finishes the thread with a report.
  2. Allow reopening a cancelled thread. Resume transitions cancelled → open before re-minting. Cost: "terminal" stops meaning terminal; THREAD-001's fence semantics and the transcript-closed refusal both weaken.
  3. Keep it as is and document that resume serves crash recovery and cross-machine continuation only.

Option 1 with an idle-expiry sweep looks strongest — it keeps terminal honest and matches how Codex-style resume behaves — but the quota interaction needs a decision.

Related

The transcript is already durable either way; this decision is only about who may keep writing.

  1. AtlantisPleb opened this issue 2d ago
  2. A AtlantisPleb Author 2d ago

    Decided and implemented in eb8ea8f: option 1, stop revoking on clean exit. A thread is durable, so --resume works by construction and anything that touches a thread again — a delegated child still running, a second window, a resumed session — is no longer told it was revoked.

    The quota interaction the issue flagged was resolved by removing the cap rather than raising it: with threads durable, a count of open threads is a count of every session the account has ever run, so maximum_open_threads_per_account is now unbounded and what bounds an account is its credit — the same answer as the grant ceilings and the grant clock. Terminal stays honest.

  3. closed this as completed 2d ago
Sign in with GitHub to comment on this issue.