Skip to content

v0.24.1

Choose a tag to compare

@wajihtba wajihtba released this 06 Nov 11:41
· 31 commits to main since this release

A patch: the bugs the architecture guide's examples found.

Added

  • thread/pool: ErrMixedPools (see Fixed) — the one new name of this patch, a sentinel to match the refusal with errors.Is.

Fixed

  • thread/pool: two Pool values at different levels of one delegation chain (the lead delegates through one pool, the child it runs through another) broke nested approvals: a decision at the top failed the top receipt with "nothing to resume: the child's resume did not survive a restart" while the lower pool ran the approved effect anyway and then could not record its settlement — the effect happened, the lead was told it failed. A delegation from a child session another pool runs — a wrapped tool of the second pool, or Submit from the child's run — is now refused with ErrMixedPools before any child exists; the model reads the refusal as the call's error. One Pool value per chain is the rule (ADR 0022 amendment 2026-11-06); several pools delegating from the top session are unchanged.
  • thread/pool: a wrapped tool called by a core.Subagent child running inside a session turn (or by any run started beneath the turn that is not the turn's own) delegated, writing a receipt into the session that named a call id only the child run held — the hazard ErrNestedDelegation already refused for Agent.CallTool. It is now refused with ErrNestedDelegation before any child exists.
  • thread: thread.RunOptions(core.BeforeDispatch(…)), core.AfterDispatch(…) and core.IdempotencyKeys(…) were accepted by Send and silently replaced by the session's own (the core keeps the last of each, and the session appends its gate, hook and keys after the caller's options) — a caller's gate never ran. Send now refuses them with core.ErrInvalidRunOption, nothing written, like the other session-owned options; a precondition of your own belongs in core.WrapTools middleware.
  • core: a handler abandoned at its Timeout (or the run's cancellation) could keep dispatching Agent.CallTool calls afterwards — an email sent after the model was told OUTCOME_UNKNOWN; under a session the gate refused them, on plain core nothing did. Once the loop has settled a call (timed out, canceled, or its handler returned), a CallTool whose outer call is that call fails closed with ErrNotDispatched and the inner handler never runs (ADR 0031 amendment 2026-11-06).
  • thread, thread/pool: a sync delegation cut off by a shutdown whose child then recovered on its own without parking (a keyed retry, a continuation) settled its receipt, but ResolveDelegation accepted only a call a mirror named: the pool logged "delegating call no longer pending; the outcome is on the receipt", the parent kept offering the delegating call as a plain pending call, a second Recover did not fix it, and approving it delegated again — the effect twice. The settlement now resolves that call with the child's answer (the text the sync path gives), whichever of pool.Recover and RecoverTurn runs first; Recover resolves one whose resolution a crash lost; until then the call is offered with the reason delegated: its thread/pool delegation settled and its answer is on the receipt; … and Decide refuses an approval or edit of it with ErrDelegated. A delegation ended canceled (what the child did is not known) is still a person's to decide, as before: neither ResolveDelegation nor Recover resolves it, and a call parked while its delegation was open is offered, once that delegation ends canceled, with cut off while it delegated: … (ADR 0032 amendment 2026-11-06).
  • thread: OnRequest never fired for a thread/pool child's request mirrored onto the session (InheritApprovals does not carry it, and the mirror's append notified nobody), so an inbox fed by OnRequest missed every nested approval — and it did fire for the delegating call the mirror parks under, which no decision can address (ErrDelegated). It now fires once per mirror, after the mirror is durable, on the pool's goroutine and holding no lock, and no longer for a delegating call nobody can approve — one a mirror names, or one parked while its delegation is open after the pool cut its child off (should that delegation end canceled, the call becomes a person's without a second notification; Pending lists it).
  • thread/pool: pool.Close under thread.ErrShutdown before a parent session whose turn was delegating left the parent running, and the parent's model read the raw thread: the process is shutting down: … as the delegating call's tool error and carried on ("shall I try again?") while the child's receipt stayed open and the next worker completed its effect. The cut-off delegation now answers its call with an unknown outcome (core.ErrOutcomeUnknown): under the session's ParkUnknown the call parks with the reason delegated: its thread/pool delegation is still open … (no keyed retry, no grant or Approver, an approval refused), and pool.Recover resolves it with the child's answer. Shutting sessions down first is still the cleaner order (docs/thread-operations.md §5).
  • thread: the live Approver (WithApprover) was handed a Request with no Metadata, though Pending and OnRequest report the parking run's; it now carries the same metadata.

Documented

  • thread: Session.Send — the run is a child of Send's ctx: canceling it cancels the turn (its end entries are still written); an HTTP handler whose request context ends on hang-up should pass context.WithoutCancel.
  • core: OnlyTools narrows away an Output[T] agent's submit_output unless it is named (ParkAllExcept never parks it), and a narrowed-away tool still passes through WrapTools middleware, so an mw.Allow refusal reads DENIED before NO_SUCH_TOOL (also on mw.Allow).
  • core: ModelToolCallDelta.Name must be set by an adapter on every delta of a call, not only the first — the loop forwards it as given and OutputDecoder.Feed skips a delta with no name (the first-party adapters do).
  • thread: thread.Memory() does not implement Watcher (on Memory and Watcher).
  • mcp: an unknown outcome loses its type after one MCP hop — a served OUTCOME_UNKNOWN arrives as ErrToolError with that text, not core.ErrOutcomeUnknown (on Tools, Serve, ADR 0032 amendment 2026-11-06).
  • thread: under OnReady, RecoverTurn (like Resume) still starts and returns the run it decides; the Approver is consulted only in a live turn's chain, never for recovery or mirrored requests.