Skip to content

feat(usage): attribute every auxiliary LLM call in canonical token usage #1216

Open

Description

@jbeda

Goal

Audit every model/provider invocation outside the normal agent-run stream and ensure its input/output usage is recorded in the canonical durable Session.tokenUsage ledger under a purpose-specific usage kind and server-selected provider/model attribution.

The session-title generator is the first migrated auxiliary caller (session_title). Other LLM-backed operations may currently discard usage or fold it into the main run incorrectly.

Acceptance criteria

  • Inventory all composition/server/agent auxiliary LLM call sites, including their ownership, lifetime, session association, and current usage handling.
  • For every session-associated call, record usage in a closed, purpose-specific canonical usage kind; preserve Session.Usage, EvResult.Usage, and MaxRunTokens as main-run-only unless an explicitly documented policy says otherwise.
  • For calls that cannot be tied to a session, document the intentional accounting boundary rather than fabricating attribution.
  • Preserve provider neutrality: do not widen port.LLMRequest for accounting or provider-private controls.
  • Add offline coverage for every migrated call and update living architecture/implementation documentation.

Activity

  1. self-assigned this
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions