I3293 — Usage is attributed to the session, task and issue it was spent on, from records the repository already keeps
Join a usage record's provider session id to the session record (ADR 0164), its active task and the task's issue and intent at read time, storing no join, and report unattributed usage as such.
BLOCKED wave 2 · p2 · implementation profile · parallel safe
Blocked. This issue cannot start until I3288 is done. The status is derived from that, not declared.
Objective
Join a usage record's provider session id to the session record (ADR 0164), its active task and the task's issue and intent at read time, storing no join, and report unattributed usage as such.
Why
Cost per accepted outcome (I0401) needs usage against work, and the owner asked for attribution to intent and issue; the session, task and plan records already carry every key. Events dropped while the receiver was down otherwise leave no record; the new capability owes its generated projections. It extends milestone execution-telemetry. Proposed in ADR 0213 (Usage is observed through each provider's official telemetry into one provider-neutral record, and reported, estimated and billed amounts are never merged) (proposed; it carries no authority until the owner accepts it). Sources: chatgpt-majordomus:c234#0, chatgpt-majordomus:c236#0, chatgpt-majordomus:c093#6.
Current state
Session records name their provider session; nothing reads usage against them.
Desired state
economics usage --by issue answers from the join, with an unattributed bucket.
Scope
- apps/majordomus-cli/src/economics
- apps/majordomus-cli/src/capability/builtin/economics.rs
- share/commands.yaml
Dependencies
What waits on this
- I3294BLOCKED /ui shows usage by provider, model, session, task and issue, and every figure opens its reported events
- I3295BLOCKED A task declared over its token budget is told so, and refused only where policy says refuse
- I3297BLOCKED A waste finding names its evidence and confidence and is never presented as a saving
- I3380BLOCKED A task's spend is the usage attributed to it, as reported tokens with their class, and money stays not observed until it is a separate field
Acceptance criteria
- A fixture session with an active task attributes its usage to the task's issue
- Usage outside any task is reported unattributed, never dropped
- A session span with episode records but no received usage events is recorded absent with reason receiver_unavailable (case)
- The economics usage capability is declared canonically and its share/commands.yaml and MCP/HTTP/OpenAPI projections are generated (majordomus generate --check)
Validation
- cargo test --manifest-path apps/majordomus-cli/Cargo.toml --test economics
- majordomus generate --check
Evidence required
- case_usage_is_attributed
Evidence
None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.
Timeline
- started
- —
- verified
- —
- completed
- —
Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.
Canonical record: .ai/repo/project/issues/I3293.yaml. Read it back with majordomus plan show I3293.