forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Epic: #46
Summary
Ensure provider options and accurate usage accounting flow through compaction to prevent miscount and API errors.
Problem
- Past reports show missing providerOptions in compaction path (BUG: @ai-sdk/openai 2.0.50 breaks OpenAI OAuth plugin requiring store: false (missing providerOptions in compaction) anomalyco/opencode#3118) and need for
includeUsage(I can not configure the limit for litellm anomalyco/opencode#2787) for accurate tokens/cost.
Proposal
- Audit compaction streamText options: headers, providerOptions, includeUsage forwarding.
- Verify usage reporting on
finish-stepmatches 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
Labels
No labels