Session economics: stable session/task attribution + per-session token/cost analytics #97

Open
opened 2026-09-20 01:19:24 +00:00 by nsaspy · 0 comments
Owner

Extends #13 and #96.

Goal

Make session identity a first-class durable accounting dimension, not the current generic proxy placeholder.

Ingest

Capture trusted local attribution for:

  • session_id
  • task_id / parent_task_id
  • client/harness
  • worker/agent
  • correlation/causation IDs

Strip internal attribution headers before upstream egress as already required by #96. Untrusted external callers cannot forge privileged attribution.

Durable model

Persist stable edges:

  • session -> request
  • session -> task/subtask
  • task -> request/attempt
  • request -> usage observation
  • usage -> immutable pricing snapshot
  • cost assertion -> usage + pricing rule/version

Unknown pricing stays unknown.

Analytics

Every applicable analytics/query/export surface must support session as a filter/grouping dimension:

  • request/token totals
  • exact cost state + currency
  • provider/model/client/classification/outcome
  • retry/failure economics
  • child task rollups
  • time range
  • top sessions/tasks by token/cost without loading all rows

Add bounded indexed operations for session summary, session timeline and session task tree.

Acceptance

A fixture with multiple sessions, tasks, retries and models produces exact non-double-counted rollups before and after expert restart/backfill.

Extends #13 and #96. ## Goal Make session identity a first-class durable accounting dimension, not the current generic proxy placeholder. ## Ingest Capture trusted local attribution for: - session_id - task_id / parent_task_id - client/harness - worker/agent - correlation/causation IDs Strip internal attribution headers before upstream egress as already required by #96. Untrusted external callers cannot forge privileged attribution. ## Durable model Persist stable edges: - session -> request - session -> task/subtask - task -> request/attempt - request -> usage observation - usage -> immutable pricing snapshot - cost assertion -> usage + pricing rule/version Unknown pricing stays unknown. ## Analytics Every applicable analytics/query/export surface must support session as a filter/grouping dimension: - request/token totals - exact cost state + currency - provider/model/client/classification/outcome - retry/failure economics - child task rollups - time range - top sessions/tasks by token/cost without loading all rows Add bounded indexed operations for session summary, session timeline and session task tree. ## Acceptance A fixture with multiple sessions, tasks, retries and models produces exact non-double-counted rollups before and after expert restart/backfill.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/llm-log#97
No description provided.