2 Commits
Author SHA1 Message Date
Willie 10466f2d53 fix(server): report one target per tied sync budget warning
When several targets tied for the worst context cost, the warning joined
their names but listed top offenders from whichever target was seen
first, so the offenders could belong to a different target than the
one a reader looks at. Map iteration order also made that choice
random.

Ties now resolve to the alphabetically first target, and the warning
carries that target's own offenders. The test gives each tied target a
different skill so a mismatch between target and offenders shows up.
2026-09-30 00:24:51 +08:00
Willie 8962ed9416 fix(server): name the target in sync budget warnings
Context-cost warnings in the Web API's sync response never carried a
target name: the warning struct tracked the worst token totals across
targets but dropped which target hit them. The CLI's sync --json and
the dashboard's ContextCostWarning both include target, so the
dashboard's i18n string rendered its {target} placeholder verbatim
instead of the target's name.

computeContextCost now records the names behind the worst always-loaded
and on-demand totals, joining ties with a comma, and reports them as
the warning's target. Regression tests cover both the tied case and a
worst-offender that only one target receives.
2026-09-29 23:30:21 +08:00