Pārlūkot izejas kodu

docs: close comparable metrics todos

Problem: Todo 50 and its migration follow-up needed durable evidence and aggregation semantics before comparison closeout.

Risk: One existing Starlette/httpx deprecation warning remains outside this metrics scope.
zhenyu.hu 2 nedēļas atpakaļ
vecāks
revīzija
3f441335c4

+ 9 - 1
docs/plans/todo-50-comparable-model-tool-metrics.md

@@ -1,6 +1,6 @@
 # Todo 50 Comparable Model and Tool Metrics Plan
 
-**Status:** in_progress
+**Status:** done
 
 ## Goal
 
@@ -63,3 +63,11 @@ Make `dual_agent` and `chat_agent_tools` directly comparable without double-coun
 - `uv run pytest`
 - repeated legacy/concurrent SQLite migration test
 - `git diff --check`
+
+## Observe / Update
+
+- `/usage` now reports mode-aware ChatAgent, EventAgent fallback, and Event Kernel call rows while preserving its existing top-level structure.
+- Model token totals exclude tool rows; logical event results exclude deduplicated clones; turn/session wall time comes only from the monotonic turn record, not overlapping spans.
+- EventAgent consumes trailing usage and records fallback TTFT/elapsed; Event Kernel records handler latency; UI labels mode/agent/call kind and prefers wall time.
+- Review found one legacy duplicate-key migration issue, closed by Todo 50.1.
+- Final verification after the follow-up: `405 passed`, `node --check` and `git diff --check` pass; one existing Starlette deprecation warning remains.

+ 7 - 1
docs/plans/todo-50.1-metric-key-migration-dedup.md

@@ -1,6 +1,6 @@
 # Todo 50.1 Metric Key Migration Dedup Plan
 
-**Status:** in_progress
+**Status:** done
 
 ## Goal
 
@@ -24,3 +24,9 @@ Allow additive metrics migration to open an experimental database that already c
 - repeat concurrent migration test
 - `uv run pytest`
 - `git diff --check`
+
+## Observe / Update
+
+- Migration retains `MIN(id)` for each duplicate non-null `(session_id, metric_key)` and preserves all legacy `NULL` keys.
+- Cleanup and unique-index creation run inside the serialized `BEGIN IMMEDIATE` migration.
+- SQLite focused tests passed (`12 passed`), concurrent initialization passed 20 repeated runs, and the full suite passed (`405 passed`).

+ 2 - 2
docs/plans/todos.md

@@ -96,6 +96,6 @@
 | 49.1 | done | `docs/plans/todo-49.1-session-mode-and-atomic-transcript-safety.md` | Enforce persisted mode, atomically store direct tool rounds, repair incomplete legacy tails, serialize SQLite migration, and hide empty protocol bubbles. | Mode mismatches are rejected without config overwrite; disconnect cannot leave unresolved tool calls; concurrent migration succeeds; replay shows only visible assistant content. |
 | 49.2 | done | `docs/plans/todo-49.2-session-load-race-and-visible-repair.md` | Prevent stale session loads from overwriting the selected session and preserve visible text while stripping incomplete tool protocol. | Out-of-order loads cannot mutate the active session UI; whitespace-only protocol bubbles stay hidden; incomplete tool rounds retain provider-valid visible content. |
 | 49.3 | done | `docs/plans/todo-49.3-stale-replay-token-order.md` | Prevent a stale replay invocation from invalidating an already-running replay for the current session. | A late stale invocation exits before advancing the replay token; the current session still restores normally. |
-| 50 | in_progress | `docs/plans/todo-50-comparable-model-tool-metrics.md` | Record mode-aware model/tool spans and include EventAgent usage so both architectures can be compared fairly. | Persistence/API tests report agent, call kind, tokens, TTFT, tool latency, fallback usage, and total turn wall time without double counting. |
-| 50.1 | in_progress | `docs/plans/todo-50.1-metric-key-migration-dedup.md` | Deduplicate legacy metric keys before creating the idempotency index so existing experiment databases remain openable. | Migration keeps the earliest row for each duplicate non-null session/metric key, creates the unique index, and remains safe under concurrent initialization. |
+| 50 | done | `docs/plans/todo-50-comparable-model-tool-metrics.md` | Record mode-aware model/tool spans and include EventAgent usage so both architectures can be compared fairly. | Persistence/API tests report agent, call kind, tokens, TTFT, tool latency, fallback usage, and total turn wall time without double counting. |
+| 50.1 | done | `docs/plans/todo-50.1-metric-key-migration-dedup.md` | Deduplicate legacy metric keys before creating the idempotency index so existing experiment databases remain openable. | Migration keeps the earliest row for each duplicate non-null session/metric key, creates the unique index, and remains safe under concurrent initialization. |
 | 51 | pending | `docs/plans/todo-51-comparison-matrix-closeout.md` | Add repeatable comparison fixtures, update project documentation, and close the experimental implementation. | Both modes pass the same scenario matrix; full tests, JS syntax, app import, and documentation checks pass. |