Copilot auth now sets far too many requests as "user" consuming premium requests rapidly
Description
This, morning a request or two using Github Copilot's Opus 4.5 consumed half my monthly quota -- there were around 60 agent-initiated requests that should not have been counted as premium requests. In other words, they should have had the X-Initiator header set to "agent" as this is the way Copilot counts requests. Agent/tool initiated messages are flagged as "agent" and truly user-initated ("user" messages) are the ones that should consume premium requests.
This appears to be directly related to the opencode-copilot-auth version bump of recent commits, so I did create anomalyco/opencode-copilot-auth#11 there as well. The opencode-copilot-auth is recently, and rightly, trying to comply with Copilot's request consumption patterns so as not to provide an avenue for abuse. We are now seeking to ensure that all "user" requests consume premium tokens (with premium models, that is). That is good, but introduces an incompatibility with opencode's role classifying.
As far as I can tell, opencode creates synthetic "user" messages for tool attachments in the MessageV2.toModelMessage function in packages/opencode/src/session/message-v2.ts. So now that opencode-copilot-auth is more conservative in its use of the X-Initiator: agent header, we are in effect charging for every tool attachment message, which gets quite expensive, as I discovered this morning, sadly.
Workaround
For now, I would highly recommend to Copilot users that they keep OpenCode at version 1.1.12, and do your best to be honorable (and safe from being blocked or throttled by Github), starting new sessions often rather than "riding" the same session to avoid premium request consumption.
Plugins
OpenCode version
1.1.14
Steps to reproduce
Ask a copilot premium model such as Claude to investigate or solve a complex problem that involves reading, writing, and editing files.
Screenshot and/or share link
No response
Operating System
Linux, Windows
Terminal
Foot, and Windows Terminal