picoclaw/pkg
Andy Lo-A-Foe cc7b4ca86b
fix(pico): deliver per-turn token usage to the streamer
Two bugs prevented the usage block from ever reaching the wire:

1. CallLLM read turnStateFromContext(ctx), but the raw ctx is not seeded
   with the turn state (only turnCtx is), so SetLastUsage/SetLastFinishReason
   were dropped — GetLastUsage() returned nil at finalize. Set them on the
   ts parameter directly, which is also what the streaming publisher reads.

2. The manager wraps the channel streamer in finalizeHookStreamer /
   splitMarkerStreamer, neither of which forwarded SetTurnUsage (it is not
   part of the bus.Streamer interface), so the type assertion in the
   publisher's Finalize failed silently. Mirror the existing SetModelName
   forwarding: add a turnUsageStreamer interface + setStreamerTurnUsage
   helper and SetTurnUsage methods on both wrappers (splitMarker also stores
   and re-applies usage to each freshly-begun part streamer).

Adds regression tests asserting both wrappers forward SetTurnUsage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 15:38:46 +02:00
..
agent fix(pico): deliver per-turn token usage to the streamer 2026-06-22 15:38:46 +02:00
audio Merge pull request #3129 from chengzhichao-xydt/codex/tts-close-error 2026-06-16 22:08:10 +02:00
auth
bus Merge pull request #2904 from SiYue-ZO/feature/fix-agent-loop-stability 2026-06-14 21:22:53 +02:00
channels fix(pico): deliver per-turn token usage to the streamer 2026-06-22 15:38:46 +02:00
commands fix(context): expose history tokens and remove leaked state files 2026-06-06 00:28:32 +08:00
config Merge pull request #2917 from PierreLeGuen/nearai-provider 2026-06-17 20:37:38 +02:00
constants
credential
cron feat(cron): add get and update actions to cron tool 2026-05-31 10:55:54 +08:00
devices
events fix: resolve golines lint issue in subscription.go 2026-06-16 00:53:18 +08:00
evolution fix(evolution): capture Close() error on write file in appendJSONLRecords 2026-06-14 23:42:44 +08:00
fileutil fix(fileutil): explicitly ignore Close() error on directory file descriptor 2026-06-15 20:25:04 +08:00
gateway fix: health check always returning not ready 2026-06-08 12:14:06 +02:00
health
heartbeat
identity
isolation fix: add ok checks for sync.Map LoadAndDelete/Load type assertions 2026-06-06 21:17:07 +08:00
logger
mcp fix: use %w instead of %v for error wrapping 2026-06-08 09:10:14 +08:00
media
memory fix(session): tighten main-session alias detection to exact 3-part format 2026-06-04 11:01:10 +08:00
migrate fix: check Close() error after io.Copy to writable files 2026-06-07 12:09:01 +08:00
netbind
pid fix(pid): verify process identity in singleton PID check 2026-06-04 20:04:51 +08:00
providers Merge pull request #3136 from ZOOWH/fix/3111-gemini-thought-signature 2026-06-17 20:40:13 +02:00
routing
seahorse fix(seahorse): handle json.Marshal errors in grep and expand tools 2026-06-15 20:31:34 +08:00
session fix(seahorse,session): preserve created_at across history bootstrap 2026-05-26 14:05:20 +08:00
skills feat: agent self evolution (#2847) 2026-05-11 16:13:27 +08:00
state refactor: replace log.Printf/fmt.Printf with structured logger 2026-06-08 09:18:02 +08:00
tokenizer
tools Merge pull request #3141 from jincheng-xydt/fix/3125-brave-search-logging 2026-06-18 08:16:14 +02:00
updater fix: check Close() errors in updater extraction functions 2026-06-06 21:34:24 +08:00
utils fix(onebot): tighten inbound media download handling 2026-06-17 17:00:24 +08:00
env.go