Skip to content

Compaction: Provider options flow and accurate usage accounting #51

@riatzukiza

Description

@riatzukiza

Epic: #46

Summary

Ensure provider options and accurate usage accounting flow through compaction to prevent miscount and API errors.

Problem

Proposal

  • Audit compaction streamText options: headers, providerOptions, includeUsage forwarding.
  • Verify usage reporting on finish-step matches regular prompt path.

Code Refs

  • packages/opencode/src/session/compaction.ts:147-179 (streamText options)
  • packages/opencode/src/session/compaction.ts:211-220 (usage aggregation)
  • packages/opencode/src/provider/transform.ts (ProviderTransform.providerOptions)

Tasks

  • Add tests for usage accounting consistency in compaction
  • Ensure includeUsage=true where applicable
  • Cross-check headers/options equality with prompt path

Acceptance Criteria

  • Usage tokens/cost in compaction match those from equivalent non-compaction flows.
  • No API errors due to missing options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions