Skip to content

v0.25.0

Latest

Choose a tag to compare

@wajihtba wajihtba released this 11 Nov 19:52
· 2 commits to main since this release

Changed (breaking)

  • thread: the key names the effect while its outcome is unknown (ADR 0032, the 2026-11-10 amendment). A call to a tool that is not ReplaySafe timed out, its handler ran on, a person skipped its recovery request — and when the model asked for the same tool with the same arguments again, the repeat sat in a new entry, got a new IdempotencyKey, and ran beside the still-running first handler: a deduplicating receiver could not tell it was the same effect, so ship or charge could happen twice. Now, once a call's outcome is unknown in a session (a recovery request, a skip, an OUTCOME_UNKNOWN result), a later call to the same tool with the same canonical arguments (keys sorted, numbers by value — 1 is 1.0) runs under the earlier call's key until a call under that key answers; a deliberate second order after an answer still gets a key of its own. The session records the inherited key before the call runs (an approval_audit entry with step key, new fields Entry, Tool, ArgsSHA256, Key), written with "v":7: a session that holds one is refused by a 0.24 reader (ErrNewerFormat). Migration: deploy readers before writers, as for format 6; nothing to change in code.
  • thread: the still-running gate. While an abandoned handler of a tool (not ReplaySafe) still runs in this process for a call the session holds, a new call to that tool parks for a person, whatever its arguments, reason an earlier call of this tool is still running: its handler was abandoned and has not returned; approve once it has returned, deny to skip this call — no grant or Approver is consulted. Decide now refuses approving or editing any of the session's own requests of a tool whose abandoned handler still runs with ErrStillRunning (it refused only the abandoned call's own recovery request). Migration: an application that approves on ErrStillRunning waits for thread.AbandonedHandler(r.RunID, r.CallID) of the earlier call's recovery request (or retries later), as it already does for recovery requests.
  • thread: Fork carries effect identity. A fork derived every copied call's key from its own session id, so a fork's RecoverTurn retried a cut-off ReplayKeyed call under a key the receiver never saw, asked Reconcile under it ("missing": the call reran), and a person's retry of a copied recovery request did the same — the effect twice, in the keyed case with no person deciding. Fork now appends a key record, with the origin's key, for each effect of unknown outcome open at the fork point and each copied call that may run again (cut off, parked for recovery, inherited). A call that never started keeps its own key in the fork. Migration: none; a fork written this way is format 7.
  • core: a BeforeDispatch gate whose error wraps ErrApprovalRequired parks the call (pending, handler never run) instead of failing it with ErrNotDispatched (ADR 0031, 2026-11-10). The core always matched it through the wrapped error; it is now the contract, pinned by TestBeforeDispatchParkParksTheCall.
  • thread/pool: a mirrored child request carries the child's key (ApprovalRequestEntry.IdempotencyKey, additive; Request.IdempotencyKey on the parent names it). The parent's own call to a tool whose child handler still runs parks behind the gate, and with the same arguments, once it has returned, runs under the child's key.

Security

  • thread/pool: ApproveAlways on a pool child's mirrored request minted a grant in the parent session, bound to the parent's own tool of the same name — another system — whose next matching call then ran unasked; the "always" the person meant never reached the next delegation. The parent now mints nothing for a mirror; the decision's Always wish replays into the child, which mints its own grant (TestApproveAlwaysOnAMirrorMintsNoParentGrant).
  • thread/sqlite (behaviour change): thread.Delete erases the session's bytes, not only its rows. The deleted conversation stayed readable on disk with a hex dump — the freed pages kept their cells, and the write-ahead log kept every frame that had ever held them (a test found the deleted text 275 times in the -wal while the Storage was open, 25 times in the main file after Close). Every connection now runs secure_delete=ON (deleted cells and freed pages are zeroed), and Delete runs PRAGMA wal_checkpoint(TRUNCATE) after its commit, so a nil return means none of the session's bytes are left in the database file or its log. A reader holding the log past the 30 s busy timeout (or ctx ending) makes Delete return an error wrapping the new sqlite.ErrErasureIncomplete — the session is deleted (Load answers ErrNotFound), its bytes may still be in the log — and the new sqlite.Checkpoint(ctx, st) finishes the erasure once the reader is gone. Cost: every delete in the database writes zeros over what it frees, and every Delete checkpoints and fsyncs the main file. Migration: a caller that treated any Delete error as "nothing deleted" checks errors.Is(err, sqlite.ErrErasureIncomplete) and calls sqlite.Checkpoint (a retried Delete answers ErrNotFound); a database written by an earlier build may still hold earlier deletes' bytes in its free pages — VACUUM it once. docs/thread-operations.md §12 says what Delete erases on each backend and what it cannot (backups, copies, the filesystem's blocks).

Fixed

  • core, anthropic, google: a provider's opaque signature goes back to that provider only. ReasoningPart.Signature and ToolCallPart.Signature did not say who issued them, so after a mid-session model switch the anthropic adapter sent a Gemini thought signature to Anthropic as a thinking block's signature, and the google adapter sent an Anthropic signature to Gemini as raw bytes (on a thought part or a function call) — a request the API most likely rejects (found by reading; not reproduced against the live APIs). ReasoningPart, ToolCallPart, ModelReasoningDelta and ModelToolCall gain Provider (json:"provider,omitempty", additive): the adapters set it to their provider id ("anthropic", "google") on every signature they yield, and send a signature back only when the tag is their own; a part tagged with another provider is treated as unsigned (the reasoning is dropped, the call goes without a signature). An untagged signature — a transcript recorded before this release — is sent as before, so a session that stayed on one provider keeps its reasoning; an untagged signature from another provider is still sent, as only a tagged one can be told apart. wefttest fixtures record the tag. A custom Model that yields signatures should set Provider on those events; one that does not gets the legacy rule (ADR 0001, amendment 2026-11-11; TestConvertSignatureProviderTag).

  • thread: thread records held past their bound (256, for a run that has not reported yet) were dropped with only a Debug line at Close, so a reader took the record stream as whole (R5). The first drop now logs a WARN, and Close's count is a WARN (TestHeldRecordOverflowIsWarned). The drop still does not reach otel.ErrRecordsLost: the records never reached the pipeline.

  • thread: a Fork taken while the origin's turn ran a call with effects copied the call as cut off, and the fork's RecoverTurn retried it (ReplayKeyed) or asked its Reconcile ("missing": it reran, ReplayNever) beside the origin's live handler. Fork now files the origin's running handlers of copied dispatched calls as still running: the fork parks the call for a person and refuses an approval until the handler returns (TestForkDuringARunningCallParksItForAPerson).

  • thread: a storage write that hung inside the dispatch gate (which holds the session's lock across the dispatch record's append and flush — a stalled fsync on a failing disk or NFS) made Close(ctx) ignore its context and block until the write returned (R12). Close now waits for the lock under ctx: it gives up when ctx ends and fells the turn once the write returns; a later Close finishes (TestCloseGivesUpWhileAStorageWriteHangs).

  • core: OutputDecoder.Feed did quadratic work in a streamed submission's length — every args delta re-closed and re-decoded the whole buffer (a 350 KB submission in 11-byte deltas read 5.6 GB). Past 4 KiB it now decodes a delta once the arguments have grown by an eighth since the last attempt, so the total is linear; small submissions still get a partial on every delta, partials still only grow, the whole-call ToolStart is always decoded (the last partial is the complete submission) and Result is unchanged. Nothing model-visible.

  • core, mcp: Agent.ServeCall (and so mcp.Serve) ignored the agent's ParkSource: a tool a breakpoint named ran over MCP, and a panicking source — which parks every call in a run — failed open. A served call now reads the sources once per call; a named call (any call but the Output answer, when a source panicked) is refused with the ErrApprovalRequired error a RequireApproval tool gets there, and does not run (ADR 0030, amendment 2026-11-10).

  • core (breaking): a panic in user code the loop calls on its own goroutine — a PrepareStep function, a ToolSource read, a StopWhen condition, a SteerFunc, a UseModel model's Info — killed the process under Stream (and so under every weft/thread turn): the run guard ended the span and re-panicked on the producer goroutine, where nothing could recover it. The run now fails instead, under Generate and Stream alike, with a *RunError wrapping the new *PanicError (Value, Stack) and the now exported ErrRunPanicked, the partial transcript on Result; the span still reads run_panicked. OnRunEnd now fires for such a run (it did not: "a crash is not an outcome"). Code that recovered a Generate panic should check errors.Is(err, weft.ErrRunPanicked) instead. A Subagent child whose loop panics now reads SUBAGENT_FAILED: … weft: run panicked: … to the parent's model instead of the handler-panic result (ADR 0016, amendment 2026-11-10).

  • thread (tests; no behaviour change): TestShutdownCauseOnTheTurnContext read Ready() the moment the cut-off turn's Wait returned, while the turn's runner was still alive — Ready is nil then, as its godoc says — and failed about one run in four under the race detector on two cores (CI's, on a 0.24.1 release commit). It waits for the session to be idle first (WaitIdle).

  • thread/pool (tests; no behaviour change): two tests of a cut-off delegation assumed an order nothing gives them, and failed on a machine with two cores — CI's, on the 0.24.1 and 0.24.2 release commits. TestCutOffDelegateRecoveredUnparkedResolvesTheParentCall let the held handler go and recovered at once: closing the hold only makes the handler's goroutine runnable, so the recovery still read it as running and parked the call for a person, as it must, and the test waited 15 s for a keyed retry that was never due. Its helper's release now returns once the handler has returned as the process sees it (thread.AbandonedHandler). TestCloseGiveUpSyncDelegationIsNotOfferedAsARetry shared one script among the child's runs, so the child asked for ship again once its mirror was denied — a new call under its own key — and that raced the test's own release ("2 ship handlers ran at once"); the child's model now asks once per conversation, so a second handler can only be a second delegation's or a retry. Recover's godoc said a handler the cut-off left running "is waited for by the child's own recovery"; it says what happens: the call parks for a person while the handler runs, and an approval waits for it.