Skip to main content

Resume

cmd/crewship/cmd_resume.go continues a previous session by threading --chat <id> into the standard run flow against the agent that owns the chat. Four resolution paths: If the agent slug isn’t part of the resolved object, resume finds the agent that owns the chat by walking GET /api/v1/agents and reading each agent’s GET /api/v1/agents/{agentId}/chats. A chat is addressable only under its agent — the API registers no flat chat-detail route — so this walk is the lookup.

What the walk can and cannot see

Two bounds come with it, and both are visible in the errors rather than left to be discovered:
  • Each agent’s chat list returns its 100 most recent chats and takes no page parameter. A chat that has aged past its agent’s hundredth still exists and is still resumable — it just cannot be found by chat id, because the only listing that maps a chat to its owner no longer contains it. Resume it by run-id instead (crewship history shows both columns), or pass the agent explicitly to the underlying run.
  • It costs one request per agent. On a workspace with a few dozen agents that is a visible pause before the session opens. The run-id and PR forms carry their agent with them and skip the walk entirely.
An agent whose chat list cannot be read is skipped rather than aborting the walk, so a single denial cannot hide a chat somebody else owns. If every list fails, nothing was searched and resume says so — it reports the access failure, not a missing chat.
Before #2086, both resolution paths asked for flat chat routes the router does not register: a workspace-wide chat list for the picker, a chat-detail fetch for the agent lookup. The picker silently fell through to its /runs fallback; the agent lookup just failed, so crewship resume <chat-id> always reported could not determine agent.

crewship resume [chat-id | run-id | pr-url]

No flags of its own — all flags belong to crewship run (it’s the dispatch target). The two flags that get forced are --chat <id> and --interactive=true.

Examples

Common errors

  • interactive picker requires a TTY; pass a chat-id or run-id — running without a TTY but no argument.
  • run <id> has no associated chat to resume — the run pre-dates chat threading or was created without one.
  • could not determine agent for chat <id>: chat <id> not found in any agent's 100 most recent chats … — a real miss: wrong workspace, a typo, or a chat that has aged out of the listing (see the bound above). Exits ExitNotFound.
  • could not determine agent for chat <id>: could not read the chat list of any of the <n> agents … — the walk was blocked, not empty: every agent’s chat list returned an error, so zero chats were searched. The first failure is wrapped verbatim, and this does not exit as not-found — the chat id is not what is wrong.
  • … found in the 100 most recent chats of the <n> agents that could be read; <m> could not be read — a partial miss. The count says how much of the workspace was never searched, so “not found” can be read for what it is.
  • no agents in this workspace … — nothing owns any chat here; check the current workspace.
  • no recent sessions to resume — no run in the workspace’s recent history carries a chat id.
  • no session found for PR <owner/repo#n> — pass a chat-id directly — journal search came up empty; fall back to the chat-id form.
  • list recent sessions: <err> — the runs list the picker reads failed.

See also