qwen-code/packages/cli/src
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
..
acp-integration feat(cli): make ACP message rewrite timeout configurable (#3475) 2026-04-20 20:58:58 +08:00
commands feat(cli): add OAuth configuration flags to mcp add (#3442) 2026-04-20 14:12:17 +08:00
config fix(cli): pin /recap above input and align defaults with fastModel (#3478) 2026-04-20 23:58:19 +08:00
constants fix(cli): set qwen3.5-plus as default model for Coding Plan (#3193) 2026-04-13 17:11:50 +08:00
core test: add tests for confirmation-bus, prompt-registry, and cli/core modules (#2272) 2026-04-09 13:54:59 +08:00
dualOutput fix(cli): wait for dual output stream shutdown (#3416) 2026-04-18 18:11:19 +08:00
i18n fix: display (#2766) 2026-04-19 15:25:29 +08:00
nonInteractive refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
patches adh/bugfix/1563 (#4822) 2025-07-25 16:39:37 +00:00
remoteInput feat(cli): add dual-output sidecar mode for TUI (#3352) 2026-04-18 02:14:53 +08:00
services refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
test-utils fix(cli): pin /recap above input and align defaults with fastModel (#3478) 2026-04-20 23:58:19 +08:00
ui feat(cli): attribute /stats rows to the originating subagent (#3229) 2026-04-21 11:44:10 +08:00
utils feat(cli): attribute /stats rows to the originating subagent (#3229) 2026-04-21 11:44:10 +08:00
gemini.test.tsx feat(cli): add slashCommands.disabled setting to gate slash commands (#3445) 2026-04-20 11:06:26 +08:00
gemini.tsx feat(cli): add bare startup mode (#3448) 2026-04-20 10:01:59 +08:00
nonInteractiveCli.test.ts refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
nonInteractiveCli.ts feat(core): enhanced loop detection with stagnation + validation-retry checks (#3236) 2026-04-19 18:06:43 +08:00
nonInteractiveCliCommands.test.ts refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
nonInteractiveCliCommands.ts refactor(cli): replace slash command whitelist with capability-based filtering (Phase 1) (#3283) 2026-04-20 14:34:43 +08:00
validateNonInterActiveAuth.test.ts feat(auth): discontinue Qwen OAuth free tier (2026-04-15 cutoff) (#3291) 2026-04-15 22:30:20 +08:00
validateNonInterActiveAuth.ts Merge branch 'main' into feat/debug-logging-refactor 2026-02-01 20:47:38 +08:00