fix(opencode): correctly set x-initiator header for agent-initiated copilot requests#21167
fix(opencode): correctly set x-initiator header for agent-initiated copilot requests#21167aklajnert wants to merge 1 commit intoanomalyco:devfrom
Conversation
85f406b to
906d88d
Compare
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
a46067c to
15046e4
Compare
|
lookin |
f98329e to
e116780
Compare
|
@rekram1-node - I have removed unnecessary code changes, and confirmed the code still works as expected. This is ready for re-review. |
e116780 to
8fd0c52
Compare
|
Nice thanks! I have to do 1 more pass just to make sure that all the synthetic messages actually make sense to behave in this way I have to be rlly rlly careful here cause I cant have ppl getting incorrectly blocked if the billing starts being misconfigured. I've also been in a discussion w/ some members of copilot team and they recently asked about this stuff so I dont wanna step on their toes either. In any case this fixes at least 1 actual bug case so I will hopefully tmr be able to merge |
|
I traced this in code to answer the “4 pending bubbles” question.
Important part:
So: 4 pending bubbles = 4 user messages queued/persisted, but 1 active session run at a time. That means provider calls are not strictly 1:1 with pending bubble count while the run is in flight (it can process multiple newly queued user messages in a later step of the same run). |
|
For the last three days, I have been using exclusively the build from this PR. I plan to keep it until it is merged. Premium burning seems to be fixed. Thanks @aklajnert |
Are you using oh-my-openagent at the same time? I want to ask if it still works when using both tui and omo at the same time? |
|
So testing some things:
|
|
Reading images seems like an unrelated bug? Do you want me to act on it somehow? I feel like both cases are not related to the autocompaction header. |
|
Nah u can define a slash command like this: Anytime u invoke it, it will never result in any billing at all. (with ur changes)
Uh not unrelated, it is pre-existing bug but thats the primary mechanism that drains requests currently. |
|
Ok, now I understand. I did another approach in the latest commit. Tested against all known cases and it seems to work correctly. |
|
Now the llm cant read images at all in normal fashion and all subagent requests will eat your quota. |
|
Sorry, I think I've rushed too much. I'll try again tomorrow having in mind all that cases. |
|
We are also talking w/ the copilot team currently so all of this may change (ill keep this pr posted) I think they are already dealing with a lot of abuse as is. |
a91293e to
17e03a6
Compare
|
OK, I’ve tested a case with regular autocompaction, a command with a subtask, and subagents. It seems that everything works as it should. I think reading images should work as well, but I can’t test it. I’ve tried every model in Copilot, and they all either rejected the request with “model x not supported for vision” or, in Grok’s case, accepted it but responded that it can’t read pictures. I also tested this in the production OpenCode environment and observed the same behavior. Which model supports vision? Could it be blocked at the enterprise level? The CI failure seems to come from a flaky test. I can’t rerun it without another commit, so perhaps someone from the dev team can trigger CI again. |
a96ca17 to
2e52dbd
Compare
Gpt 5.3 codex, sonnet 4.5, opus 4.5, sonnet 4.6, opus 4.6, gpt 5.4, gpt 5.4 mini, gemini 3.1 pro, gemini 3 flash All supports images |
30464ed to
45073c5
Compare
Should I enable it in the configuration somehow? I can't find it anywhere. In VSC I can use images, but not in OpenCode. For the model that works in VSC, in OpenCode I get an error that the model doesn't support vision. I have tried to enable it in the config, but it didn't work for me. I'm checking the released OpenCode versions, not my branch. |
45073c5 to
0687ce3
Compare
Issue for this PR
Closes #8030
Type of change
What does this PR do?
Upstream commit 88226f3 (
tweak: ensure that compaction message is tracked as agent initiated) already handles the case where the parent user message contains acompaction-typed part. Two cases are still missing:"compaction", the call should immediately setx-initiator: agentwithout fetching the parent message (which won't have acompactionpart yet at that point)synthetic: true; this should also bex-initiator: agentAlso removed the remaining
throwOnError: truefromsdk.session.get().How did you verify your code works?
bun testinpackages/opencode)Screenshots / recordings
Not a UI change.
Checklist