qwen-code/packages
tanzhenxin b27cb81bb7
feat(cli): attribute /stats rows to the originating subagent (#3229)
* feat(cli): attribute /stats rows to the originating subagent

Thread subagent identity through telemetry via an AsyncLocalStorage
context so each API response knows which subagent (or main) emitted
it. Aggregate a per-source breakdown alongside the existing per-model
totals and render one row per (model, source) in /stats and /stats
model. Main-only sessions collapse to the existing single-row display.

Resolves #3215

* fix(cli): reserve `main` subagent name and stabilize /stats React keys

Two latent correctness issues found during self-review of PR #3229:

- A subagent named `main` would silently collide with the `MAIN_SOURCE`
  sentinel and be merged into the main bucket with no attribution. Add
  `main` to the reserved-names list so validation rejects it.
- `flattenModelsBySource` used the normalized display label (with `-001`
  stripped) as the React key, which could collapse distinct models
  `foo` and `foo-001` into duplicate keys. Split `ModelSourceEntry` into
  `{ key, label, metrics }` with `key` built from the raw model name
  (plus `::source` in the split case), and update both `StatsDisplay`
  and `ModelStatsDisplay` to key rows/columns off it.

Also surface invalid-subagent-file parse errors through the debug
logger instead of swallowing them entirely, so users running with
debug logging enabled can tell why a subagent failed to load.

Add a dedicated unit test file for `flattenModelsBySource` covering
the collapse rule, session-wide split, source order, the
`foo`/`foo-001` key-collision regression, and the empty-bySource
fallback. Extend the reserved-name test to include `main`.
2026-04-21 11:44:10 +08:00
..
channels fix(weixin): check full 4-byte PNG magic signature (#2970) 2026-04-18 09:32:58 +08:00
cli feat(cli): attribute /stats rows to the originating subagent (#3229) 2026-04-21 11:44:10 +08:00
core feat(cli): attribute /stats rows to the originating subagent (#3229) 2026-04-21 11:44:10 +08:00
sdk-java Fix typo in class name (#2189) 2026-04-18 11:59:36 +08:00
sdk-typescript fix(sdk): settle pending next() promise in Stream.return() to prevent hangs (#2981) 2026-04-18 09:46:56 +08:00
vscode-ide-companion fix(cli): pin /recap above input and align defaults with fastModel (#3478) 2026-04-20 23:58:19 +08:00
web-templates fix: display (#2766) 2026-04-19 15:25:29 +08:00
webui feat(vscode-ide-companion): support /insight command (#2593) 2026-04-20 10:02:18 +08:00
zed-extension chore(zed-extension): update package version to 0.10.0 2026-02-06 14:26:01 +08:00