Skip to content

feat: run computer use on OpenAI-compatible AI providers - #31895

Merged
ethanndickson merged 11 commits into
mainfrom
mike/computer-use-openai-compat
Nov 9, 2026
Merged

ethanndickson merged 11 commits into
mainfrom
mike/computer-use-openai-compat

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Computer use only ran on Anthropic and OpenAI AI providers. Chatd derives the tool flavor from the AI provider type, and openai-compat had no flavor, so every self-hosted model was marked unavailable for type=computer_use, including the model a single-provider deployment already uses for chat.

Hosted computer tools are not an option on those servers: an OpenAI-compatible endpoint accepts a computer_20250124 tool over /v1/messages and a computer-use-preview tool over /v1/responses and then drops both, so the model never sees a way to act. Computer use is now declared as an ordinary function tool for those providers. The model sends one action per call and every call answers with a fresh screenshot, which is the shape these models already handle through the shared action runner. The tool omits zoom, which the agent desktop cannot perform. The desktop clamps a point outside the screen to its edge, so the tool rejects a coordinate outside the declared screenshot with an error that states the valid range, and a model that aims off the screen learns that it missed. Media tool results reach the model because the pinned fantasy fork promotes them to user-role messages, so no dependency changed.

Coder can't verify an arbitrary OpenAI-compatible model, so those models keep the unverified warning icon in the admin UI. The virtual desktop docs, the Coder Agents index, the chatd architecture doc, and the organization model settings copy now list OpenAI-compatible providers as supported, and the docs say what to check before using one.

Three shared behaviors needed fixing to make this usable. A coordinate of [0,0] is the top-left pixel and decoded as an omitted field, so the desktop rejected those clicks with a missing-coordinate error; coordinates now decode by key presence, which also keeps an absent coordinate absent. A scroll_amount of zero or less, or a key repeat of zero, was also forwarded as omitted, so the desktop scrolled its default of three clicks or pressed the key once; the runner now rejects both, and the function tool declares a minimum of 1 for each. And because a chat completions model sends one action per call, it plans every call of a step against one screen, so a failed action now halts the later calls of that step, as it already did for Anthropic. The hosted OpenAI flavor still differs here on purpose: it delivers an array of actions in one call. Halting would strand a mouse press whose release was planned for a later call, so the function tool offers left_click_drag instead of separate press and release actions, and rejects any action it does not declare.

Provider types that reuse the chat completions client without being OpenAI-compatible (Azure, Google, OpenRouter, Vercel, Copilot) stay unsupported until each is verified.

Note

coderd/apidoc/docs.go, coderd/apidoc/swagger.json, docs/reference/api/schemas.md and site/src/api/typesGenerated.ts are hand-edited to match the new enum value, because the environment that prepared this change had no pnpm to re-run the generators. The same environment had no node, so pnpm run typecheck, biome and prettier did not run locally; CI is the validator for the site/ change and the generated files.

Note

Prepared by Xum, Mike's coding agent, from the measurement that showed an OpenAI-compatible server dropping both hosted computer tools.

@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 13:53 — with GitHub Actions Inactive
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 13:53 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T05:43:01.323935Z a7cf3c4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3820beef47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
Comment thread coderd/x/chatd/ARCHITECTURE.md Resolved
Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 14:17 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 14:20 — with GitHub Actions Inactive
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: ddb224e4b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 14:45 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: c3d2495da8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike marked this pull request as ready for review November 7, 2026 18:05
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:05 — with GitHub Actions Inactive
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:10 — with GitHub Actions Inactive
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:10 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Note

Posted by Xum on Mike's behalf.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 833eea53f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:24 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Note

Posted by Xum on Mike's behalf.

@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:25 — with GitHub Actions Inactive

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7329d67ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:32 — with GitHub Actions Inactive
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Note

Posted by Xum on Mike's behalf.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d6e0c9e30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
Comment thread coderd/x/chatd/chattool/computeruse.go Resolved
Comment on lines +296 to +297
return DefaultComputerUseProvider(t.provider) == codersdk.ChatComputerUseProviderAnthropic &&
t.anthropicToolVersion == fantasyanthropic.ComputerUseToolset20260801

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Shed automatic screenshots during compaction

For OpenAI-compatible computer use, every successful action persists a fresh PNG tool result, and a model can emit several such calls in one step. If this screenshot-heavy history exceeds the compatible model or gateway's context/request-body limit, compaction cannot recover: its overflow retries truncate only text and error tool results, leaving every media result intact, so the chat terminates with the conversation-too-large error even though obsolete intermediate screenshots could be replaced by placeholders for summarization. Make the compaction fallback elide old automatic screenshot results, or otherwise provide a media-thinning retry.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not specific to the OpenAI-compatible flavor. On main, every flavor except the newest Anthropic toolset already stores a screenshot per action (computerUseAnswersWithText, and runOpenAIComputerUse ends with captureSharedScreenshot), and compaction only replaces tool media the compaction model cannot accept (replaceUnsupportedToolMedia). A media-thinning retry would be a compaction change outside this diff, so I'm leaving this open for Mike to decide whether to track it as a follow-up.

Note

Posted by Xum on Mike's behalf.

@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:45 — with GitHub Actions Inactive
@ibetitsmike
ibetitsmike temporarily deployed to main November 7, 2026 18:45 — with GitHub Actions Inactive
@coderagents

coderagents Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Check

Blocking

  • docs/coder-agents/platform-controls/virtual-desktop.md (open) - Reframe the OpenAI-compatible sentence on line 52 around what the reader observes, and keep the confirmation instruction covering both flavors.
Findings for agents
- id: audience-1
  persona: audience
  class: rule
  blocking: true
  file: docs/coder-agents/platform-controls/virtual-desktop.md
  line: 52
  quote: "An OpenAI-compatible AI provider has no computer use tool of its own, so Coder offers computer use to the model as an ordinary tool and returns a screenshot after every action."
  evidence:
    - docs/.style/content-guidelines.md#evidence-justifies-a-claim-and-does-not-belong-in-the-claim
  rule: docs/.style/content-guidelines.md#evidence-justifies-a-claim-and-does-not-belong-in-the-claim
  problem: The sentence describes how Coder implements computer use internally (the "chat completions API", "hosted computer tool", and "function tool" identifiers) rather than anything the organization admin types or receives while configuring computer use.
  fix: "Reframe around what the reader observes and must do, keeping the screenshot behavior."
  verified: true

Automated review via Coder Agents. Reply to a finding's thread with the reason if the finding is wrong.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Note

Posted by Xum on Mike's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: ba5f37df8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike temporarily deployed to main November 8, 2026 18:40 — with GitHub Actions Inactive
@ibetitsmike
ibetitsmike temporarily deployed to main November 8, 2026 18:40 — with GitHub Actions Inactive
@ethanndickson
ethanndickson temporarily deployed to main November 9, 2026 05:03 — with GitHub Actions Inactive
ibetitsmike and others added 11 commits November 9, 2026 05:10
Computer use only ran on Anthropic and OpenAI AI providers. Chatd derives the
tool flavor from the AI provider type, and `openai-compat` had no flavor, so any
self-hosted model, including the deployment default here, was marked
unavailable for `type=computer_use`.

Hosted computer tools are not an option on those servers: an OpenAI-compatible
endpoint accepts a `computer_20250124` tool over `/v1/messages` and a
`computer-use-preview` tool over `/v1/responses` and then drops both, so the
model never sees a way to act. Declare an ordinary function tool instead. The
model sends one action per call, and the runner answers every call with a fresh
screenshot, which is the shape these models handle through the shared action
runner. Media tool results already reach the model because fantasy promotes
them to user-role messages.

- `codersdk.ChatComputerUseProviderOpenAICompat` names the new flavor, and
  `chatprovider.ComputerUseProvider` returns it for `AIProviderTypeOpenaiCompat`.
  Provider types that reuse the chat completions client without being
  OpenAI-compatible (Azure, Google, OpenRouter, Vercel, Copilot) stay
  unsupported until each is verified.
- The new tool reuses the Anthropic input conventions (whole-second durations,
  capped key repeat) so one action runner serves both flavors, and it omits
  `zoom`, which the agent desktop cannot perform.
- `runActionPerCallComputerUse` now backs both the pre-2026 Anthropic toolsets
  and the new flavor. The Anthropic toolset keeps its text action results.
- A requested screenshot is still stored as a chat attachment; the screenshot
  that follows an action stays model-only.

Coder cannot verify an arbitrary OpenAI-compatible model, so those models keep
the unverified warning icon in the admin UI, and the docs say so.

No new dependency: `go.mod` and `go.sum` are unchanged.

Tests: the flavor selection, tool definition, action runner, and turn wiring are
covered, and the model-override API test now accepts an OpenAI-compatible model
while a Google model still proves the rejection path.

Docs: the supported-provider list in the virtual desktop page and the
architecture page now includes OpenAI-compatible providers.

Generated `coderd/apidoc/docs.go`, `coderd/apidoc/swagger.json`,
`docs/reference/api/schemas.md`, and `site/src/api/typesGenerated.ts` are
hand-edited to match the new enum value because this checkout has no pnpm.
Three surfaces still listed only Anthropic, OpenAI, and Bedrock as computer
use providers. Update the Coder Agents index and the organization model
settings copy. Leave a TODO in the chatd architecture document, because its
author writes that document's prose updates.
A computer action at the top-left pixel [0,0] decoded as an omitted
coordinate, so the agent rejected the action with a missing-coordinate
error. Coordinates now decode by key presence, which also keeps an absent
coordinate absent instead of clicking the corner.

An OpenAI-compatible model batches one action per call, so every call of a
step is planned against the same screen. The flavor was left out of the
halting gate, and a later click or type still ran after an earlier action of
the step failed. It now halts like the Anthropic flavor, which also sends one
action per call. The hosted OpenAI flavor sends an array of actions per call
and is unchanged.
markdown-table-formatter pads every row of a table to its widest cell, so the
longer computer use row in docs/coder-agents/architecture.md required re-padding
the whole table. Cell content is unchanged; fmt and lint-docs both check the
padding.

revive rejects a control-flag parameter, so runActionPerCallComputerUse no
longer takes textResult. computerUseAnswersWithText derives the answer shape
from the provider and tool version, which is the same rule, and the two
flavors that send one action per call now share one Run case.
… subagents

The computer_use model allowlist in the chatd architecture doc predates
OpenAI-compatible support. Add the provider and drop the TODO that
flagged the stale sentence.
A failed computer call halts the rest of its step, so an OpenAI-compatible
model that pressed the mouse with left_mouse_down and planned the release
for a later call could leave the button pressed. The function tool no
longer offers left_mouse_down or left_mouse_up (left_click_drag covers
drags in one call) and rejects any action it does not declare.

A scroll_amount of zero or less was forwarded as omitted, so the desktop
scrolled its default of three clicks. The runner now rejects it, and the
function tool declares a minimum of 1.
Coordinates are forwarded by key presence, which is safe only because
fantasy's ParseComputerUseInput rejects an array that is not exactly two
values; otherwise it would decode zero-filled into a top-left click. Pin
that with a test and say so in the comment.
A repeat of 0 read as an omitted repeat, so a key call asking for zero
presses pressed the key once. Detect repeat by key presence, like
scroll_amount, so 0 is rejected with the other out-of-range counts.
Drop the transport and tool-mechanism terms from the OpenAI-compatible
paragraph and move its confirmation step next to the general one, so
the check before saving covers both kinds of provider.
…AI-compatible models

The desktop clamps a point outside the screen to its edge, so a model that
aims off the screenshot sees an action land somewhere it did not ask for and
gets no signal that it missed. Reject such coordinates for the
OpenAI-compatible function tool with an error that states the valid range.
The Anthropic and OpenAI-compatible flavors share one action runner, but
only the OpenAI-compatible tool rejected undeclared actions and off-screen
coordinates. Decode the input into one struct and validate it against the
actions that the flavor declares, so both flavors get the same checks:

- An action that the flavor does not declare is rejected before it reaches
  the desktop. For Anthropic, this newly rejects key_down and key_up.
- A coordinate outside the screenshot is rejected with the valid range for
  Anthropic too, because the desktop clamps it to the screen edge.
- A null coordinate, start_coordinate, scroll_amount, or repeat counts as
  absent. Chat completions models often send null for unused fields, and
  the old parser rejected a null coordinate.

ComputerUseProvider now derives the openai-compat flavor from the client
switch, like the other flavors.
@ethanndickson
ethanndickson force-pushed the mike/computer-use-openai-compat branch from 6d8e191 to a7cf3c4 Compare November 9, 2026 05:10
@ethanndickson
ethanndickson temporarily deployed to main November 9, 2026 05:10 — with GitHub Actions Inactive
@ethanndickson

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: a7cf3c4057

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson merged commit 082668f into main Nov 9, 2026
49 of 53 checks passed
@ethanndickson
ethanndickson deleted the mike/computer-use-openai-compat branch November 9, 2026 06:26
@ethanndickson
ethanndickson temporarily deployed to main November 9, 2026 06:26 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 9, 2026

This branch was previously deployed

1 inactive deployment
main — a7cf3c40 Deployed Nov 9, 2026 by ethanndickson via cla #252288
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants