feat(auto): receipts — record route bindings, rebinds, and sticky vs fresh routing source
- Dominant language
- Rust
- Stars
- 41k
- Forks
- 3.6k
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 299
Description
## Problem
The ledger cannot answer "which route actually served this session, and why did it change?" `AutoRouteReceipt` (`crates/tui/src/model_routing.rs:503`) records a per-decision receipt, and `RuntimeUsageRecord` (`crates/tui/src/cost_status.rs:821`) records per-route usage, but nothing links turns to a session-scoped route binding or records rebind events. Once sticky bindings exist (#6252), the receipt surface must make them auditable — and the same fields are the training-data labels for any future learned router.
## Change
1. Add `TurnRoutingSource::StickyBinding` beside the existing `ActiveFixedRoute / AutoProviderClassifier / AutoLocalHeuristic` (`crates/tui/src/turn_route_plan.rs:85-93`).
2. Extend `AutoRouteReceipt` and `RuntimeUsageRecord` with: binding id, routing source, and — on rebind — the previous binding id and rebind reason (`credential_lost`, `route_error`, `provider_retired`, `user_override`).
3. Emit a receipt event on binding creation and on every rebind, not only on classifier runs, so the journal (`session_manager.rs:1497-1554`) reconstructs the full binding history of a session.
## Acceptance
- Given a session id, the receipts journal answers: initial binding, every rebind with reason, and per-turn routing source — without consulting live state.
- `RoutedTurnUsage` events carry the binding id end to end.
- Existing receipts keep decoding (additive fields with serde defaults).
Contributor guide
Research direction
Read the routing types in crates/tui/src/turn_route_plan.rs, the receipt and usage records in crates/tui/src/model_routing.rs and crates/tui/src/cost_status.rs, then trace journal emission in session_manager.rs:1497-1554. Done means the journal reconstructs initial bindings, every rebind and reason, per-turn routing sources, and RoutedTurnUsage carries the binding id while existing receipts still decode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100