Repository navigation
v0.24.2
A review pass over the whole repository — correctness, reliability, security and cost — with every confirmed finding fixed and pinned by a test, and a faster local gate.
Security
- thread: a call whose arguments hold two keys differing only by case, or one key twice, is no longer decided by any grant — it parks for a person. A predicate read one key by its exact name while the tool's decoder (
encoding/jsonfolds case, last key wins) read the other:{"command":"go test ./...","Command":"rm -rf /"}satisfiedArgGlob("/command", "go test*")and ran the second value,StrictInputor not. - thread:
Forkcarries the origin's grant revocations that are off the copied path, so a fork can no longer bring a revoked grant back. It carries aMaxUsesgrant's uses recorded off the copied path too (as grant-use audit entries, outcomecarried), so a grant used up or partly used in the origin is not refreshed by forking. - thread: a
Branchonto a completed resume's own audit or dispatch entry no longer lets the boundary resume on the approval that resume already spent — the approved call ran a second time on one approval. The call reads pending and takes a new decision. - thread:
DecideSignedno longer answers a redelivered signature as applied while its request reads pending on the current line (after aBranchback before the decision); it returnsErrDecisionSpentand a fresh challenge decides. - mcp:
Toolsrefuses a listing of more than 10,000 tools instead of growing the import for as long as a server keeps paginating. - mcp (behaviour change):
Toolsskips, and reports in its*ImportError, a remote tool whose name — thePrefixincluded — no provider accepts as a function name (anything but ASCII letters, digits,_and-, or longer than 64 bytes). Such a tool used to import and then fail every model request of the agent that held it; the rest of the listing still imports.
Fixed
- core: a parked call's nest was never closed, so a
Subagentchild the loop had given up on (itsTimeout, underParkUnknown— what everyweft/threadturn runs with) wrote its usage intoRunResult.Steps[i].SubagentUsageand emittedNestedevents after the run had returned: a data race on a map the caller holds. The nest now closes with the park. - core: under
Stream, a cancellation landing while the producer waited on the consumer dropped an event the taps and the record had already seen — a successful run could endEvents()with neitherRunFinishnor an error (rule 4). A consumer still ranging now receives it. - core: a panic (or
runtime.Goexit,t.FailNow) in the body of afor range run.Events()loop leaked the run: its goroutine stayed parked, its context and span open, andWaitnever returned. Leaving the range for any reason now cancels the run.Run.Closealso releases a producer whose consumer is stuck in its loop body. - core: an error whose
Is/Aspanics only for a target the loop asks about late (ErrOutcomeUnknown) crashed the process from the tool goroutine; it is the tool's failure, as rule 1 says.Agent.CallTool's own reads are contained the same way. - core: a self-referential named slice or map input type (
type Tree map[string]Tree) overflowed the stack atTool/Outputconstruction; it derives a schema, unconstrained where it re-enters, as a recursive struct does. - core: closing truncated JSON (
mw.RepairJSON,OutputDecoder.Feed) was quadratic in nesting depth on bytes a model wrote — seconds and gigabytes of garbage for arguments that are a long run of[. It is linear. - anthropic: a gap in the stream's content-block indexes (a gateway numbering from one, or stripping a block) silently dropped every tool call after it — a
tool_usefinish with no call. Calls are emitted for the indexes the stream carried. - anthropic: a response body that ended cleanly before a stop reason or
message_stop(a proxy closing mid-stream) was reported as a normalend_turnover the partial text, a half-written tool call included. It is an error wrappingio.ErrUnexpectedEOF(rule 8). - google: a blocked prompt (
promptFeedback.blockReason, no candidate) read as an empty successful answer; the finish'sRawnow saysblocked:<reason>. - otel: records a slow (not failing) destination still had queued when
Shutdown's context ended were neither exported nor counted, andShutdowndid not returnErrRecordsLost. They are counted per destination; a record emitted after the chain shut down takes no queue place. - thread: a
Closethat gives up, anInterruptand aRollbacknow cancel the automatic compaction's summarizer call (before a run and between turns) instead of waiting it out; a hung summarizer no longer keeps a session from sealing and releasing its lease. - thread (behaviour change): a
Steersend whose receipt flush fails is dropped, not deferred — aSendthat returned an error never runs its message, as a queued send already behaved. - thread: decision, edit, always-grant and expiry entries vet their minted ids like every other append; a repeating
IDsfunction fails the write instead of writing a file that no longer opens. - thread: a newly parked request's
Argsare the bytes the session file stores andArgsSHA256hashes exactly those, so the hash matchesArgsbefore and after a reopen (it stopped matching whenever the model wrote a space or<,>,&).Request.Argsis therefore compact from the moment of parking; requests parked by earlier builds keep their recorded hash. - thread/pool: concurrent recoveries of one unsettled receipt (two
Recovercalls, orRecoverbeside aCancelof an orphan) settle or reattach it once; each used to write a settlement, and the child was billed twice inUsage.Delegated. - thread/pool: canceling a parked child whose resume was already queued now denies its pending calls in the child session, as canceling a parked child does.
- thread/jsonl: a
Watchthat had read the lines of an append that then failed and was cut back ends with an error saying the history was cut back, instead ofErrNotFound(a cut that removes every line the watcher had read still reads as a replacement; stated onWatch). - thread/jsonl:
Deletefsyncs the session directory, so a deleted session does not reappear after a power loss. - thread (tests):
TestFailedStepAppendFailsClosedrequired theReplaySafesibling of a refused call to run, but the refusal also ends the run and the two calls start side by side — it failed about one run in sixteen. It asserts what the gate promises: the refused call never runs, the sibling at most once. - scripts: the layering guard passed when
go listitself failed (layering: ok (0 packages…)); it fails closed, and lists each module's dependencies once instead of once per package.
Added
- thread/sqlite: the Storage returned by
Openimplementsio.Closer;Closereleases the database handle and its file descriptors (previously held for the life of the process). make check: the local gate in one command — vet, lint, layering, the race suite.
Changed
- thread: a turn deep-copies its path once instead of four times; read-only walks no longer clone the transcript (inline file bytes included) under the session lock.
- thread/pool: a resume waiting for its delegating call to park, and a
CancelorWaiton a child still being created, wait on a notification instead of polling; the pool no longer deep-copies the parent session's entries on a timer while a sibling call runs. - otel: a record that needs no redaction and is under the content cap is no longer decoded and re-encoded per destination.
- The gate is faster:
make build,vet,test,offlineandliverun every workspace module in onegoinvocation (CI calls the same targets), the store × policy test matrices and the independent slow tests run in parallel, and core's JSON-prefix property test spreads its checks over the processors —make testwent from about two and a half minutes to under one on a 16-thread workstation, with the same tests.