Skip to content

feat(copilot): support model: auto/model: none to bypass model pinning on automatic-selection plans#46556

Closed
pelikhan with Copilot wants to merge 23 commits into
mainfrom
copilot/fix-copilot-engine-issue
Closed

feat(copilot): support model: auto/model: none to bypass model pinning on automatic-selection plans#46556
pelikhan with Copilot wants to merge 23 commits into
mainfrom
copilot/fix-copilot-engine-issue

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

On Copilot Free (and similar plans limited to automatic model selection), every request fails with HTTP 400 because the engine always injects an explicit COPILOT_MODEL — which the gateway rejects for these plans. Setting model: gpt-5-mini or any other alias produces the same 400 since the plan disallows any pinned model.

Changes

  • New sentinels auto and none for engine.model — when either is set, the compiler omits COPILOT_MODEL from the step env entirely, letting the Copilot CLI use its native automatic routing.

    • Constants: CopilotAutoModelSentinel = "auto", CopilotNoModelSentinel = "none" in pkg/constants/engine_constants.go
    • addCopilotModelEnv in copilot_engine_execution.go returns early without setting COPILOT_MODEL for these values
  • Runtime defense-in-depth in resolve_model_alias.cjsresolveConfiguredCopilotModel returns "" for auto/none (case-insensitive), and applyCopilotModelAliasResolution in the harness calls delete process.env.COPILOT_MODEL when it receives an empty resolution result, covering the case where someone sets the sentinel via engine.env

Usage

engine:
  id: copilot
  model: auto   # suppress COPILOT_MODEL; CLI auto-selects model

model: none is a synonym. Both values are inert with respect to alias resolution and bypass the org-variable fallback (GH_AW_MODEL_AGENT_COPILOT) as well.


Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 8.59 AIC · ⌖ 8.26 AIC · ⊞ 7.5K ·
Comment /souschef to run again


Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 8.96 AIC · ⌖ 7.34 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 19, 2026 07:32
…election

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ng comment line

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix copilot engine usability issue for free accounts feat(copilot): support model: auto/model: none to bypass model pinning on automatic-selection plans Jul 19, 2026
Copilot AI requested a review from pelikhan July 19, 2026 07:35
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the BYOK route requires a model id

Copilot AI and others added 2 commits July 19, 2026 07:57
… in BYOK mode

- `addCopilotModelEnv` now accepts `isBYOKMode bool`; when the `auto`/`none`
  sentinel is set and BYOK is active it falls through to the org-variable
  expression (with `CopilotBYOKDefaultModel` as final fallback) instead of
  skipping COPILOT_MODEL injection entirely.
- `applyCopilotModelAliasResolution` in the JS harness now checks
  `COPILOT_PROVIDER_BASE_URL` before deleting COPILOT_MODEL for sentinel
  values; in BYOK mode the sentinel is ignored and COPILOT_MODEL is preserved.
- Tests added for both the Go and JS paths.

Fixes: https://github.com/github/gh-aw/pull/XXXXX#issuecomment-5014891414

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…for BYOK sentinel case

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the BYOK route requires a model id

Fixed. When model: auto or model: none is set alongside a BYOK configuration, the sentinel now has no effect and falls back to the org-variable expression with CopilotBYOKDefaultModel as the final fallback — the same model injection path used when no model is configured.

Two-layer fix committed in the latest push:

  1. Go compiler (addCopilotModelEnv): when isBYOKMode is true and the sentinel is detected, it falls through to BuildModelOverrideExpression(...) instead of returning early, so COPILOT_MODEL is always injected for BYOK.
  2. JS harness (applyCopilotModelAliasResolution): checks COPILOT_PROVIDER_BASE_URL before deleting COPILOT_MODEL for sentinel values — in BYOK mode the sentinel is ignored and the existing model value is preserved (defense-in-depth for engine.env.COPILOT_MODEL: auto).

The non-BYOK sentinel behaviour (Copilot Free auto-selection) is unchanged.

@pelikhan
pelikhan marked this pull request as ready for review July 19, 2026 08:42
Copilot AI review requested due to automatic review settings July 19, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Copilot automatic model routing for plans that reject explicitly pinned models.

Changes:

  • Adds auto and none model sentinels.
  • Omits or clears COPILOT_MODEL for automatic routing.
  • Adds Go and JavaScript coverage plus release notes.
Show a summary per file
File Description
pkg/workflow/model_env_vars_test.go Tests sentinel compilation behavior.
pkg/workflow/copilot_engine_execution.go Handles sentinels when building step environments.
pkg/constants/engine_constants.go Defines sentinel constants.
actions/setup/js/resolve_model_alias.test.cjs Tests sentinel alias resolution.
actions/setup/js/resolve_model_alias.cjs Resolves sentinels to no model.
actions/setup/js/copilot_harness.test.cjs Tests runtime environment handling.
actions/setup/js/copilot_harness.cjs Clears sentinels before Copilot execution.
.changeset/patch-copilot-auto-model-sentinel.md Documents the user-facing fix.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment thread actions/setup/js/copilot_harness.cjs Outdated
Comment thread .changeset/patch-copilot-auto-model-sentinel.md Outdated
Comment thread pkg/constants/engine_constants.go Outdated
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot update dev.md to use copilot auto and summarize the readme.

  • update 10 more agentic workflows to use auto model

Copilot AI and others added 2 commits July 19, 2026 09:05
…md to copilot auto; add model: auto to 10 workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, investigate and fix the failed checks below, refresh the branch if needed, and rerun checks.

Failed checks:

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 8.59 AIC · ⌖ 8.26 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update dev.md to use copilot auto and summarize the readme.

  • update 10 more agentic workflows to use auto model

Done in the latest commit:

  • dev.md switched from id: codex / model: gpt-5.4 to id: copilot / model: auto, with copilot-requests: write added to permissions.
  • 10 agentic workflows updated to add model: auto to their copilot engine blocks: archie, artifacts-summary, brave, breaking-change-checker, ci-coach, code-scanning-fixer, copilot-cli-deep-research, copilot-opt, copilot-pr-merged-report, copilot-pr-nlp-analysis.
  • All 258 workflows recompiled successfully.

@copilot the BYOK route requires a model id

The BYOK sentinel handling is now fully corrected in the latest commit. When model: auto or model: none is set and BYOK mode is active (COPILOT_PROVIDER_BASE_URL present), the JS harness now replaces the sentinel with the concrete BYOK default model (claude-sonnet-4.6) in process.env.COPILOT_MODEL — so providers always receive a valid model ID. The corresponding tests, constant docs, and changeset notes have all been updated to document this BYOK exception.

…s.cjs

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address any unresolved review feedback, confirm the branch is current, and summarize the next concrete maintainer action.

_Run: https://github.com/github/...

All checks on run 29711510274 passed (all 6 jobs succeeded). Branch is current with main, all 3 review threads resolved, and local validation clean.

Next maintainer action: merge the PR.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot make sure auto is configure in the awf command

https://github.com/github/gh-aw/actions/runs/29716577546/job/88271094667#step:48:1

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, refresh the branch if needed, and summarize the next concrete maintainer action after the current smoke investigation completes.

Recent maintainer request:

Run: https://github.com/github/gh-aw/actions/runs/29716826331

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 13.4 AIC · ⌖ 6.26 AIC · ⊞ 7.5K ·
Comment /souschef to run again

…e 258 workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot remove experiments from smoke-copilot and set model: auto

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Automation hums in moonlight
Green checks bloom across the code
Copilot ships the dawn

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

📰 BREAKING: Report filed by Smoke Copilot · 11.6 AIC · ⌖ 2.28 AIC · ⊞ 18.9K ·
Comment /smoke-copilot to run again
Add label smoke to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Smoke test review: comments recorded; no blocking verdict.

📰 BREAKING: Report filed by Smoke Copilot · 11.6 AIC · ⌖ 2.28 AIC · ⊞ 18.9K
Comment /smoke-copilot to run again
Add label smoke to run again

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

5 similar comments

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 2be0a99e-9e11-4933-949f-cbdc0b6c050a

Sorry for the inconvenience!

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, refresh the branch if needed, and summarize the next concrete maintainer action after the current smoke investigation completes.

Recent maintainer request...

Root cause investigated (run 29716577546, job 88271094667 — step 48 "Execute GitHub Copilot CLI"):

COPILOT_MODEL=auto was being resolved through the alias chain in the harness (auto → any → copilot/* → first-catalog-model), so the AWF proxy received a concrete model ID instead of auto. The AWF config already has "auto":["any"] configured, but the harness's resolveConfiguredCopilotModel was overriding it before the CLI made any requests.

Fix applied (commit 27e99d0 — local, push blocked by 403):

Added auto as a no-op pass-through sentinel in resolveConfiguredCopilotModel (actions/setup/js/resolve_model_alias.cjs):

// "auto" is a no-op pass-through sentinel: return it unchanged so the AWF proxy
// receives COPILOT_MODEL=auto and performs proxy-side automatic model selection.
if (configuredModel.toLowerCase() === "auto") {
  logger(`copilot model pass-through sentinel '${configuredModel}': skipping alias resolution for proxy-side automatic model selection`);
  return configuredModel;
}

This ensures COPILOT_MODEL=auto flows through to the AWF proxy unchanged — the proxy's "auto":["any"] config handles the routing. Updated test assertions in resolve_model_alias.test.cjs and copilot_harness.test.cjs. Local validation passes (258 workflows in sync, all targeted tests pass).

Blocker: engine-tools-report_progress is returning 403 on push — the change is committed locally as 27e99d0 but cannot be pushed. A maintainer needs to grant push access or push the commit manually.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 9cabca14-8223-4786-aea4-3c30ded347d3

Sorry for the inconvenience!

1 similar comment

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 9cabca14-8223-4786-aea4-3c30ded347d3

Sorry for the inconvenience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot engine unusable on plans limited to automatic model selection; pinning a model does not help

4 participants