hive-subagent-mcp: resume a subagent by session id, not by name
`continue`, and every later turn of a goal run, passed `--resume <name>`. claude 2.1.287 resolves a title across the project dirs of every git worktree of the repo and refuses when two sessions match, while `start` archives a prior session only in its own cwd's project dir. A name first started under one worktree and then started again under a sibling stayed live in both, and every resume of it failed with `--resume "<name>" matches 2 sessions`. That is the #5000 incident: build-4921a/b were first run under /home/atlas/wt/4901-build, then under their own worktrees. Both resume sites now look up the live session titled `name` in the config's own project dir (the same `SessionStore::find_by_title` lookup `start` archives with) and pass its id. The id comes off disk at each resume, so it survives a daemon restart. When that dir holds no session under the name, the name is passed as before and claude's answer stands. The test drives a fake claude that keeps sessions on disk and resolves titles across project dirs the way claude does. Its script is written by a child process, so no write fd on it exists in the test binary for a concurrent fork to inherit (the ETXTBSY of #4898).
This commit is contained in:
parent
40687ab4a5
commit
8f2069486d
2 changed files with 149 additions and 2 deletions
|
|
@ -65,6 +65,15 @@ record of a subagent's existence is claude's own on-disk session
|
|||
of the daemon's own lifetime — a restart loses the _in-flight turn_, not
|
||||
the subagent's history.
|
||||
|
||||
`continue`, and each later turn of a goal run, hands claude a session id,
|
||||
not the name: the id of the live session carrying that name in `dir`'s
|
||||
project directory, read off disk at every resume. claude looks a bare name
|
||||
up across every git worktree of the repo and refuses when two sessions
|
||||
match, and `start` archives a prior session only in its own directory, so
|
||||
a name reused under a sibling worktree would otherwise stop resuming. When
|
||||
`dir` holds no session under the name, the name goes to claude as-is and
|
||||
claude's answer stands — see below.
|
||||
|
||||
Because the remembered directory goes with the rest of it, a `continue`
|
||||
after a restart has to re-supply `dir` when the session lives anywhere
|
||||
other than the daemon's own working directory — and a restart is the
|
||||
|
|
|
|||
Loading…
Reference in a new issue