Repository navigation
Commit 09e6020
dev agent
fix(core): only release a spawn when the session really ends
`onSessionEnded` treated every `failed` lifecycle as the end of a session.
`AcpClient.ensureSession` also emits `{outcome: 'failed', reason: undefined}`
when a *restore* throws (`resumeSession`/`loadSession`), and it does so between
minting the session's mcpServers and falling through to `newSession` with those
same servers — so the release killed the spawn the fresh session was about to
use. Every `zooid_*` call in that session then answered `binding not owned by
caller`, with the session cached and no way to re-mint.
Gate on `reason`, which only the idle/clear close paths set, and pin it with a
test that fires `{failed, recoveryMethod: 'resume'|'load'}` (must not release)
before `{failed, reason: 'idle'}` (must release). Red without the fix: that test
fails and nothing else changes.
Also record in the changeset that releasing per idle close mints a new spawn and
a new `zooid-context-<id>` per idle cycle until anomalyco/opencode#40978 lands —
this stops stale spawns acting, it does not remove them from the registry.
Verified: core 378 tests, cli build-registry.context 7, core+cli `tsc --noEmit`.1 parent bf1a7b7 commit 09e6020
3 files changed
Lines changed: 46 additions & 5 deletions
File tree
- .changeset
- packages/core/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
205 | 232 | | |
206 | 233 | | |
207 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
472 | 479 | | |
473 | 480 | | |
474 | 481 | | |
| |||
0 commit comments