Skip to content

feat(github-copilot): resolve any model ID dynamically#51325

Merged
obviyus merged 11 commits into
openclaw:mainfrom
fuller-stack-dev:feat/copilot-catchall-dynamic-model
Mar 21, 2026
Merged

feat(github-copilot): resolve any model ID dynamically#51325
obviyus merged 11 commits into
openclaw:mainfrom
fuller-stack-dev:feat/copilot-catchall-dynamic-model

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Contributor

Summary

  • Makes the GitHub Copilot extension's resolveDynamicModel handler a catch-all: any model ID not already in the Pi SDK registry gets a synthetic definition created automatically
  • New Copilot models (e.g. gpt-5.4-mini, claude-opus-4.6-fast) can now be used by adding them to agents.defaults.models in config — no code change or release required
  • Preserves the existing gpt-5.3-codexgpt-5.2-codex template cloning for backward compat (falls through to synthetic catch-all if template is missing)
  • Infers reasoning: true for o1/o3 model IDs via heuristic, matching the existing supportsXHighThinking pattern
  • The Copilot API is OpenAI-compatible and returns its own error if a model isn't available on the user's plan, so there's no risk of silent failures

Motivation

Currently, every time GitHub adds a new model to Copilot, users hit Unknown model: github-copilot/<new-model> until a code change adds it to the registry or a forward-compat resolver. This is unnecessary friction — the extension should accept any model ID and let the API validate availability.

Test plan

  • Unit tests for all branches in models.test.ts
  • Verify github-copilot/gpt-5.4-mini resolves without "Unknown model" error
  • Verify existing models (e.g. claude-sonnet-4.6, gpt-4o) still resolve via the registry path
  • Verify gpt-5.3-codex still uses the template cloning path
  • Verify an invalid model ID gets a clean API error from Copilot rather than a gateway crash

@greptile-apps

greptile-apps Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refactors the GitHub Copilot extension's resolveDynamicModel handler into a dedicated models.ts module and expands it into a proper catch-all: any model ID not already in the registry now gets a synthetic definition created on the fly, eliminating the "Unknown model" error when Copilot adds new models that haven't been explicitly coded into the registry.

Key changes:

  • resolveCopilotForwardCompatModel is extracted from index.ts into the new models.ts, making it independently testable and cleanly separating concerns.
  • The handler now returns undefined (delegates to the normal path) for any model that is already in the registry, using a correctly-normalized (lowercased) lookup.
  • The gpt-5.3-codexgpt-5.2-codex template-clone path is preserved for backward compatibility, falling through to the catch-all when the template is absent.
  • The synthetic catch-all uses api: "openai-responses", input: ["text", "image"] (optimistic multimodal, consistent with how the Copilot API behaves), and infers reasoning: true for model IDs matching /^o[13](\b|$)/ — anchored to the start of the string to avoid mid-string false positives.
  • All previously flagged issues (regex anchoring, unnecessary exports, input capability, casing normalization, test coverage for o3 and mid-string false positives) have been resolved across the series of fixup commits.

Confidence Score: 5/5

  • This PR is safe to merge — the changes are well-scoped, all previously flagged issues have been addressed, and the new code is covered by a thorough unit test suite.
  • All issues identified in prior review rounds have been fixed in subsequent commits (regex anchoring, casing normalization, export surface, input capabilities, and test coverage). The logic is straightforward — a simple guard-clause flow — and the optimistic ["text", "image"] choice is justified by the API's own error-return behavior for unsupported input types. No new critical issues were found.
  • No files require special attention.

Last reviewed commit: "fix(github-copilot):..."

Comment thread extensions/github-copilot/models.ts Outdated
Comment thread extensions/github-copilot/models.ts Outdated
Comment thread extensions/github-copilot/models.test.ts

@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: 74d09d4d55

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/github-copilot/models.ts

@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: 994648b9f9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/github-copilot/models.ts
Comment thread extensions/github-copilot/models.ts
@fuller-stack-dev

Copy link
Copy Markdown
Contributor Author

@greptileai another review please

Comment thread extensions/github-copilot/models.ts Outdated
@fuller-stack-dev

Copy link
Copy Markdown
Contributor Author

@greptileai another review please

Comment thread extensions/github-copilot/models.ts Outdated
Comment thread extensions/github-copilot/models.test.ts
@fuller-stack-dev

Copy link
Copy Markdown
Contributor Author

@greptileai another review please

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Mar 21, 2026
@obviyus obviyus self-assigned this Mar 21, 2026
@obviyus obviyus force-pushed the feat/copilot-catchall-dynamic-model branch from 8229a32 to fef3a8c Compare March 21, 2026 12:07
@obviyus obviyus merged commit 5137a51 into openclaw:main Mar 21, 2026
11 checks passed
@obviyus

obviyus commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Landed on main.

Thanks @fuller-stack-dev.

@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

provider: {
baseUrl,
models: [],
},

P2 Badge Publish forward-compat Copilot models into the model catalog

Returning an empty Copilot catalog here means the new runtime-only fallback never feeds loadModelCatalog(). In the common path this PR advertises—adding github-copilot/<new-id> under agents.defaults.modelsbuildAllowedModelSet() can only synthesize a bare {id,name,provider} entry, so resolveDefaultThinkingLevel() / resolveDefaultReasoningLevel() still treat models like github-copilot/gpt-5.4-mini as non-reasoning and default them to off. OpenAI/OpenAI-Codex pair their forward-compat resolver with catalog augmentation for exactly this reason; without the same step here, the “no code change required” flow ships incomplete behavior for every new Copilot model ID.

ℹ️ 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".

frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* feat(github-copilot): resolve any model ID dynamically instead of only known ones

* refactor(github-copilot): extract model resolution, add reasoning heuristic and tests

* fix(github-copilot): default synthetic models to text-only input

* ci: retrigger checks

* copilot: mark synthetic catch-all models as vision-capable

* fix(github-copilot): anchor reasoning regex, unexport internal constants, add mid-string test

* fix(github-copilot): default synthetic models to text-only input

* fix(github-copilot): restore image input for synthetic models with explanatory comment

* fix(github-copilot): normalize registry lookup casing, add bare o3 test case

* fix: preserve configured overrides for dynamic models

* fix: allow dynamic GitHub Copilot models (openclaw#51325) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants