diff options
| author | Adam Malczewski <[email protected]> | 2026-06-28 15:26:40 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-28 15:26:40 +0900 |
| commit | c48b8739fbb66b34d0b882a6d39cdd4fb4aaf2e2 (patch) | |
| tree | a4dbfda1ed278c2c59360da292a502481fa4fb6d /backend-handoff.md | |
| parent | 85a4e3f022397cdfb6221151e1b4f843d41ff360 (diff) | |
| parent | 69655416908768c4805ad20de8a3fdd8b2ed8291 (diff) | |
| download | dispatch-web-c48b8739fbb66b34d0b882a6d39cdd4fb4aaf2e2.tar.gz dispatch-web-c48b8739fbb66b34d0b882a6d39cdd4fb4aaf2e2.zip | |
Merge branch 'feature/step-context-update' into predev
Diffstat (limited to 'backend-handoff.md')
| -rw-r--r-- | backend-handoff.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/backend-handoff.md b/backend-handoff.md index 5b41741..952a04f 100644 --- a/backend-handoff.md +++ b/backend-handoff.md @@ -1030,6 +1030,33 @@ conversation → confirm the persisted image renders from the `/images/…` endp --- +## 2k. Step-level context-window usage (progressive) → **FE BUILT; no backend change** + +The context-window usage indicator at the bottom of the screen (Composer status +bar) now updates **after each step** during a multi-step turn, instead of only +when the turn seals. Pure FE change — consumes wire events the backend ALREADY +sends (`usage` per step + `step-complete` + `done.contextSize`); no contract +change, re-pin, or re-mirror needed. + +- `selectCurrentContextSize` (`core/metrics/reducer.ts`) now, for an IN-FLIGHT + (not-done) turn, returns the most recent step WITH USAGE's + `inputTokens + outputTokens` as the live context occupancy. Per the wire + contract each step's input already includes all prior context (the prompt is + re-prefilled every step), so the last step's input+output is the true occupancy + — the same definition `TurnDoneEvent.contextSize` stamps at turn end. +- A finalized turn (`done` / durable) still wins with its authoritative + `contextSize`; durable still wins over live for a shared `turnId`. An in-flight + turn with no step usage yet falls back to the next older finalized turn (never + `0`). +- New helper `liveTurnContextSize`; updated doc on `ChatStore.currentContextSize` + + the Composer `contextSize` prop. 7 new reducer tests (35 total), 1026 green. + +### FE summary (this slice) +No backend ask. The backend already emits per-step `usage` (token counts, may +arrive mid-stream) and `step-complete` (timing) joined by `stepId`, plus +`done.contextSize` (final step's input+output) — the FE just wasn't reading the +per-step usage for the live indicator. Now it does. + ## 3. Likely NEXT backend asks (heads-up, not yet requested) - **Model max context-window LIMIT** → **CONSUMED ✅** — `GET /models` now returns |
