Trial meter Upgrade never prefills below the agents
## Defect
The sidebar trial meter's **Upgrade** opens Change agents prefilled with a count BELOW what the org already pays for whenever the trial's peak is at or under the agents bought — so "Upgrade" proposes a downgrade.
Reproduction (dev, 2026-10-22, read-only): Customers → T8937 Trial Agents (`t8937-trial-agents`) → Act as (Owner seat). Rail shows `Agents 0 / 3 · Trial · 46d left · Upgrade`. Click Upgrade → dialog "Change agents" shows **1** in the count field ("1 or more agents"), although the org has 3. Review with that value would lower the count to 1.
Cause: `apps/web/src/components/TrialAgentsMeter.tsx:78` — `initialCount={Math.max(min, meter.max_agents === null ? peak : Math.min(peak, meter.max_agents))}` clamps the PEAK alone; with peak 0 (or any peak ≤ signed-up) it falls to `min_agents`. The architecture said `clamp(peak, min, max)`, which never considered peak ≤ signed-up. The existing tests (`TrialAgentsMeter.test.tsx:136,148`) only cover peak > signed-up.
## Fix (no new surface)
In `TrialAgentsMeter.tsx`, prefill `clamp(max(peak, signedUp + 1), min, max_agents)`: the peak when it overshoots, otherwise one more than bought; when that exceeds the plan max, the max (and if signed-up already equals the max, prefill signed-up — the dialog's own `submitDisabled` then holds it). Keep the existing peak > signed-up behaviour (8 / 3 → 8; clamped to max).
## Acceptance
1. peak 0, signed-up 3, max null → prefill 4. Oracle: Vitest in `TrialAgentsMeter.test.tsx`.
2. peak 3, signed-up 3 → prefill 4; peak 8, signed-up 3 → 8; peak 12, signed-up 3, max 9 → 9; signed-up 9, max 9, peak 2 → 9. Oracle: Vitest table.
3. Dev: act as T8937 Trial Agents, click Upgrade → field shows 4, not 1. Cancel; change nothing.
Out of scope: do NOT change `ChangeAgentsDialog`, the billing routes, the meter's figures/bar/warning, the API `TrialAgentsOut`, or the trial cap/peak logic. No new copy.
Done means:
- Vitest cases 1–2 pass; `./dc check quick` green; PR merged to develop and its Jaah Deploy succeeded.
- Dev check 3 observed and cited (screenshot of the dialog showing 4).
Outcome
Trial meter Upgrade now prefills max(peak, bought+1) clamped to plan max; Vitest table (5 cases) green, quick gate green, PR #6619 merged (69e9318a), Jaah Deploy succeeded. Dev check done: T8937 Upgrade shows 4 (was 1). Memory: none applied.
Artifacts
Activity
- Ready
- Runner started
- Runner ended (done)