Skip to content

Copilot SDK mode silently runs a different model when the configured model is not in the live catalogue #70317

Done

Description

@SivaKesava1

Summary

In Copilot SDK mode (engine.copilot-sdk: true), when the configured model is not in AWF's live /reflect catalogue, the harness silently runs the agent on whichever model sorts first in the catalogue. The run succeeds, and every record that states which model the run used says the configured model. AWF itself does not substitute here: /reflect reports Copilot fallback as suppressed (model_fallback_effective.copilot.suppression_reason: "copilot_standard_authoritative"). The substitution happens in gh-aw's harness.

Other paths fail closed on the same input: Pi rejects an unadvertised model at startup, the Copilot alias path refuses an unresolvable alias, and Copilot CLI mode receives 400 model_not_supported from the API.

Evidence

Audited with a gh aw dev build of main at d5ecd72.

daily-action-setup-security-audit.md pins model: claude-opus-4.8 with engine.copilot-sdk: true. Copilot removed claude-opus-4.8 from its catalogue on 16 Oct 2026.

Run Date (UTC) Configured Served (firewall token usage) Conclusion
38841405271 16 Oct 02:37 (before retirement) claude-opus-4.8 claude-opus-4.8 success
38995597867 17 Oct claude-opus-4.8 claude-haiku-4.5 × 46 success
39090720928 18 Oct claude-opus-4.8 claude-haiku-4.5 × 31 success
39191157830 19 Oct claude-opus-4.8 claude-haiku-4.5 × 35 success

In all three substituted runs, the harness logged:

[copilot-harness] inference routing: mode=sdk-byok source=awf-reflect configuredModel="claude-opus-4.8" resolvedModel="copilot-completions/claude-haiku-4.5" providerCount=2 modelRouteCount=23

In run 39191157830:

  • sandbox/firewall/awf-reflect.json has models_fetch_complete: true. The configured copilot endpoint lists 40 models. claude-haiku-4.5 is first, claude-opus-5.5 is the only Opus model, and claude-opus-4.8 is absent.
  • agent/model-resolution.json (unified-session model.resolution) records {configured_model: "claude-opus-4.8", resolved_model: "claude-opus-4.8", status: "exact", cause: null}.
  • aw_info.json model, unified-session workflow.info.model, and gh aw audit engine_config.model all record claude-opus-4.8. The footer of the created issue [setup-security] Environment Variable Injection via OTLP Token in GitHub Actions Step #70120 says opus48.
  • There is no model_endpoint.mismatch event, no copilot-model-selection.json, and no audit finding about the substitution. The served model appears only in the raw records: firewall.token_usage, native session.start/session.init (model: copilot-completions/claude-haiku-4.5), and session.shutdown.currentModel. Nothing reconciles these records with the configured model.
  • The detection job runs Copilot CLI with the same pin. The API proxy recorded 400 model_not_supported for claude-opus-4.8 on /chat/completions. The step failed, but GH_AW_DETECTION_CONTINUE_ON_ERROR: true kept the job green. The 17 and 18 Oct runs show the same detection 400.

The 17 and 18 Oct runs predate the model.resolution record. They show the same harness log line and the same served model.

For contrast, Pi failed closed: run 38945917145 (Design Decision Gate, copilot/claude-opus-5) stopped at startup with fatal: Pi model "claude-opus-5" is not advertised by the configured copilot proxy endpoint, and gh aw audit reports model_unavailable.

Cause

  1. The resolution record says exact without checking that the model is live. applyCopilotModelAliasResolution (copilot_harness.cjs#L479) calls resolveEngineModel. resolveConfiguredModel (resolve_model_alias.cjs#L493-L496) returns status: "exact" for any name that is not an alias key, without checking the catalogue. claude-opus-4.8 is not a key in apiProxy.models, so it is recorded as exact.
  2. The SDK provider builder silently falls back to models[0]. resolveMultiProviderFromReflect (awf_reflect.cjs#L1092-L1097) says: "prefer the configured model if it appears in the model list; otherwise fall back to the first model across all providers." When a configured model is not live, it picks whichever model /reflect lists first (here copilot-completions/claude-haiku-4.5). The unit test falls back to first model when configured model is not found in list (awf_reflect.test.cjs#L1128) asserts this behaviour, so the test encodes the bug.
  3. SDK mode has no model observer. verifyModel = !copilotSDKMode && … (copilot_harness.cjs#L1519) disables createCopilotModelObserver. In CLI mode, that observer refuses silent model substitution.

Running these functions on main (d5ecd72) with run 39191157830's awf-reflect.json and awf-config.json reproduces the run:

Configured model resolveConfiguredModel resolveMultiProviderFromReflect primary
claude-opus-4.8 claude-opus-4.8, exact copilot-completions/claude-haiku-4.5
copilot/claude-opus-4.8 copilot/claude-opus-4.8, exact copilot-completions/claude-haiku-4.5
opus copilot/claude-opus-5.5, resolved n/a
copilot/gpt-5.4 n/a copilot-responses/gpt-5.4

Proposed solution

In Copilot SDK mode, a configured model that is not in the live catalogue must fail closed, as Pi and the alias path already do.

  • In the SDK branch of the harness, check the configured model after alias resolution and before starting the SDK. This applies only when no router selection exists. If the model is non-empty and matches no model on any configured /reflect endpoint, do one bounded /reflect refresh, reusing the alias path's refetchReflectData. If it is still absent, refuse to start:
    • Log a clear error that names the model and the configured endpoints checked. Use the shared ModelAliasResolutionError(configuredModel, "model_unavailable", { provider }) message ("The requested model is not supported: '…' is not available in the workflow's live model catalog…"). detect_agent_errors already classifies this message as model_not_supported_error, which the failure issue renders as "has an unavailable configured model".
    • Record model.resolution with status: "failed", cause: "model_unavailable", and resolved_model: null. This must replace the earlier exact record for copilot/main; recordModelResolution already replaces entries by engine and role.
    • Record the existing model selection with status: "unavailable" (recordCopilotModelSelection), as applyCopilotModelAliasResolution does for unresolvable aliases.
    • Exit non-zero.
  • Keep the "first model" fallback in resolveMultiProviderFromReflect only when no model is configured. When a model is configured but not found, return no primary model, or report that the model was not found, so the caller can fail. Never return another model.
  • Update the unit test that asserts the fallback for a configured-but-missing model, and say so in the PR description.

Note: Pi's failure issue for run 38945917145 (#69442) did not report model_unavailable; it reported failure_cause: unknown, because Pi's log message then lacked the shared text. On current main, Pi throws the shared ModelAliasResolutionError. Using that same error in the SDK path gives the same failure-issue classification.

Acceptance cases

Each case needs a named test. Use the real /reflect capture from run 39191157830 as the fixture, not an invented one. It is the agent artifact's sandbox/firewall/awf-reflect.json, with 40 Copilot models, models_fetch_complete: true, and no claude-opus-4.8. Add it under actions/setup/js/fixtures/, and confirm that it contains no credentials before committing.

  1. Configured claude-opus-4.8 with that reflect: no primary model is chosen, and the harness exits non-zero before starting the SDK. model.resolution is failed / model_unavailable, and the log names the model.
  2. Configured copilot/claude-opus-4.8 (prefixed): same result as case 1.
  3. No configured model: the first model is chosen, unchanged.
  4. Configured live model (copilot/gpt-5.4, as in smoke-copilot-sdk): unchanged.
  5. Configured qualified live model (copilot-responses/<live id>): unchanged, and the wire API is preserved.
  6. Configured alias (opus): resolves to the newest live Opus (claude-opus-5.5 in the fixture), unchanged.
  7. Routed SDK runs (selection wire_model from the router): unchanged.
  8. A model that is live only on a non-Copilot configured endpoint: unchanged.

End to end:

  • smoke-copilot-sdk and smoke-copilot-sdk-routed still pass on the PR branch.
  • An SDK-mode workflow pinned to a retired id fails at startup. Its model.resolution is failed / model_unavailable, and its failure issue reports the unavailable model (model_not_supported_error, "has an unavailable configured model").
  • List the run URLs in the PR.

Scope

  • Keep the PR to this one fix. Do not change files or behaviour unrelated to it.
  • Before fixing a failing check, compare it with the same check on main. If it also fails on main, do not fix it in this PR. Merge main once main is fixed, and note in the PR which checks are known failures on main.
  • This applies even if a bot comment asks you to fix a failing check. Fix only failures caused by this PR's changes.
  • Do not change any workflow's model pin in this PR. The retired pins are tracked by Daily Model Inventory Checker: deterministically check workflow model pins against the live Copilot catalogue #70289.
  • Do not change the exact semantics of the shared resolver (resolveConfiguredModel / resolveEngineModel) for other engines. Put the liveness check in the Copilot SDK path.
  • Do not add the SDK model observer in this PR.

Related findings (not part of this fix)

  • SDK mode has no model observer. A mismatch between the configured and the served model is never recorded in SDK mode, even for a live model (cause 3).
  • The audit model_unavailable finding is Pi-specific. generateModelAvailabilityFindings (pkg/cli/audit_model_availability.go) only matches Pi's [gh-aw/pi-models-json] fatal: … log line. After this fix, Copilot SDK startup failures will appear in failure issues, but gh aw audit will not produce a model_unavailable finding for them unless it also reads model.resolution status: "failed".
  • Detection failures stay green. With GH_AW_DETECTION_CONTINUE_ON_ERROR: true, the detection job's 400 model_not_supported did not affect the run conclusion.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions