Commit afd2bea
Fix /sessions resume: keep the pane and un-suppress the status fallback (#713)
* Keep a resumed pane bound to the session the user resumed
`/sessions` resume creates the pane and binds it through
`ResumePaneAssigned` before the agent CLI starts, so that pane belongs to
exactly one session id. Copilot's `--resume` boots a throwaway bootstrap
session first and only switches to the requested one seconds later, so its
deferred SessionStart hook reports the bootstrap id together with the resumed
pane's GUID. Master's `active_by_pane` handoff took that at face value and
demoted the resumed row to Ended; terminal-state rows refuse resurrection, so
the row stayed Ended for the rest of the CLI's life while the hookless watcher's
status events were silently dropped.
Mark a WTA-established pane binding `born_bound_pane` and refuse the handoff
when the pane's current owner is a live born-bound row with a different key. The
incoming session is still recorded, it just gets no pane binding. The flag
clears itself when the row gives up the pane (SessionStopped, PaneClosed,
end_entry) or once a SessionStarted for the same key claims it, so a genuinely
new session typed into that pane still takes over and no timer is involved.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd1be30e-1a90-4c72-af2e-1b138a6cc866
* Drop a stale hook_owned claim when a session is born-bound again
`hook_owned` was sticky: once a session id landed there it stayed for the
lifetime of the master process. Resuming a session that had already run once in
the same process therefore added `born_bound` while the old claim remained, and
because `apply_watcher_event` checks `hook_owned` first, every watcher status
event for the resumed row was dropped. The row sat at Idle for its whole life
even though the CLI was working and its transcript kept growing.
That combination is easy to hit now that Copilot's `--resume` bootstrap session
consumes the SessionStart hook: the resumed id itself never emits another hook,
so the watcher is the only remaining status producer -- and it was suppressed.
Observed: cd195d64 got real hooks at 04:05, was resumed at 06:05 in the same
master process (started 03:01), and master then broadcast zero sessions/changed
while events.jsonl grew to 209 KB.
Restore the documented disjointness by removing the id from `hook_owned` on the
binding-only path. A born-bound event means WTA has just relaunched that id, so
the previous generation's claim is over, and a real hook re-claims ownership on
its very next event.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd1be30e-1a90-4c72-af2e-1b138a6cc866
* Name the pane's current owner `owner` in the born-bound guard
The three closures in the guard's chain bound the same name to three different
things: two `&SessionId` for the pane's current owner, then `&SessionInfo`
for that owner's row. `prev` also read as "the previous value of sid", which is
the opposite of what it holds -- `sid` is the incoming event's session id, the
one attempting to claim the pane, while the chain resolves whoever already owns
it. `owner_sid` / `owner` matches the comment right above, which already
calls it "the pane's born-bound owner".
Rename only; no behavior change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd1be30e-1a90-4c72-af2e-1b138a6cc866
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd1be30e-1a90-4c72-af2e-1b138a6cc8661 parent aef879b commit afd2bea
4 files changed
Lines changed: 334 additions & 4 deletions
File tree
- doc/specs
- tools/wta/src
- master
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
159 | 169 | | |
160 | 170 | | |
161 | 171 | | |
| |||
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
198 | 223 | | |
199 | 224 | | |
200 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6149 | 6149 | | |
6150 | 6150 | | |
6151 | 6151 | | |
6152 | | - | |
| 6152 | + | |
| 6153 | + | |
| 6154 | + | |
| 6155 | + | |
| 6156 | + | |
| 6157 | + | |
| 6158 | + | |
| 6159 | + | |
| 6160 | + | |
6153 | 6161 | | |
6154 | 6162 | | |
6155 | 6163 | | |
6156 | 6164 | | |
6157 | 6165 | | |
6158 | 6166 | | |
6159 | 6167 | | |
| 6168 | + | |
6160 | 6169 | | |
6161 | 6170 | | |
6162 | 6171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10395 | 10395 | | |
10396 | 10396 | | |
10397 | 10397 | | |
| 10398 | + | |
| 10399 | + | |
| 10400 | + | |
| 10401 | + | |
| 10402 | + | |
| 10403 | + | |
| 10404 | + | |
| 10405 | + | |
| 10406 | + | |
| 10407 | + | |
| 10408 | + | |
| 10409 | + | |
| 10410 | + | |
| 10411 | + | |
| 10412 | + | |
| 10413 | + | |
| 10414 | + | |
| 10415 | + | |
| 10416 | + | |
| 10417 | + | |
| 10418 | + | |
| 10419 | + | |
| 10420 | + | |
| 10421 | + | |
| 10422 | + | |
| 10423 | + | |
| 10424 | + | |
| 10425 | + | |
| 10426 | + | |
| 10427 | + | |
| 10428 | + | |
| 10429 | + | |
| 10430 | + | |
| 10431 | + | |
| 10432 | + | |
| 10433 | + | |
| 10434 | + | |
| 10435 | + | |
| 10436 | + | |
| 10437 | + | |
| 10438 | + | |
| 10439 | + | |
| 10440 | + | |
| 10441 | + | |
| 10442 | + | |
| 10443 | + | |
| 10444 | + | |
| 10445 | + | |
| 10446 | + | |
| 10447 | + | |
| 10448 | + | |
| 10449 | + | |
| 10450 | + | |
| 10451 | + | |
| 10452 | + | |
| 10453 | + | |
| 10454 | + | |
| 10455 | + | |
| 10456 | + | |
| 10457 | + | |
| 10458 | + | |
| 10459 | + | |
| 10460 | + | |
| 10461 | + | |
| 10462 | + | |
| 10463 | + | |
| 10464 | + | |
| 10465 | + | |
| 10466 | + | |
| 10467 | + | |
| 10468 | + | |
| 10469 | + | |
| 10470 | + | |
0 commit comments