Repository navigation
Fix Copilot SDK model routing and cross-family sub-agents - #67509
Conversation
|
@copilot Scope for this PR (#67507):
We'll test the PR in our sandbox with gh-aw's stock SDK driver (no |
Understood. I’ll keep changes limited to the Copilot SDK mode fix and leave CLI wire API selection out of scope. I’ll only address checks that fail because of this PR after comparing them with |
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.
|
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
There was a problem hiding this comment.
🟡 Changes recommended
Relative engine paths are misresolved, and smoke validation rejects valid token-usage records lacking a status field.
3 open findings
What changed in this PR
Routes Copilot SDK sessions and sub-agents through provider-qualified BYOK endpoints while improving attribution and delegation evidence.
Changes:
- Splits Copilot Responses and Chat Completions routing.
- Loads declared custom agents with qualified models.
- Captures model-selection evidence and strengthens smoke validation.
Security review found no permission or supply-chain regression; scanners were not run in this environment.
| File | Description |
|---|---|
pkg/cli/token_usage_subagent_session_test.go |
Tests cross-family attribution. |
pkg/cli/testdata/subagent_attribution/copilot-qualified-cross-family/aw_session.jsonl |
Adds attribution fixture. |
pkg/cli/model_identity.go |
Normalizes qualified model identities. |
pkg/cli/model_identity_test.go |
Tests identity normalization. |
docs/src/content/docs/reference/engines.md |
Documents SDK routing and agents. |
actions/setup/js/unified_session_payload.test.cjs |
Tests final-result persistence. |
actions/setup/js/unified_session_payload.cjs |
Scopes final model events. |
actions/setup/js/smoke_copilot_sub_agents.test.cjs |
Tests smoke evidence checks. |
actions/setup/js/extract_inline_sub_agents.test.cjs |
Tests custom-agent loading. |
actions/setup/js/extract_inline_sub_agents.cjs |
Loads repository and inline agents. |
actions/setup/js/copilot_workflow_events.test.cjs |
Tests selection-event projection. |
actions/setup/js/copilot_workflow_events.cjs |
Adds sub-agent selection fields. |
actions/setup/js/copilot_sdk_session.test.cjs |
Tests SDK session qualification. |
actions/setup/js/copilot_sdk_session.cjs |
Configures models and custom agents. |
actions/setup/js/copilot_sdk_multi_provider.test.cjs |
Tests provider qualification. |
actions/setup/js/copilot_sdk_multi_provider.cjs |
Resolves qualified model IDs. |
actions/setup/js/copilot_sdk_driver.test.cjs |
Tests driver routing and events. |
actions/setup/js/copilot_sdk_driver.cjs |
Passes qualified SDK configuration. |
actions/setup/js/copilot_harness.test.cjs |
Tests routed child environment. |
actions/setup/js/copilot_harness.cjs |
Builds split-provider environment. |
actions/setup/js/awf_reflect.test.cjs |
Tests endpoint-aware reflection. |
actions/setup/js/awf_reflect.cjs |
Splits Copilot providers by API. |
.github/workflows/smoke-copilot-sub-agents.md |
Adds delegation evidence assertions. |
.github/workflows/smoke-copilot-sub-agents.lock.yml |
Regenerates compiled workflow. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (163 new lines in business-logic directories, >100 threshold) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 Evidence used
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
|
@copilot Tested
The same routed workflow on Two attribution issues in
Please keep these within this PR's scope (SDK mode and its attribution). The PR is still marked [WIP]; mark it ready when you're done and we'll re-run both cases. |
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Verdict
Requesting changes: the new routing path still has blocking edge cases that can send a model to an unsupported wire API, abort SDK runs on malformed sidecar args, and silently pick the wrong provider when model ids are duplicated.
### Blocking themes
- unsupported
COPILOT_PROVIDER_WIRE_APIoverrides can bypass reflect capability data and reproduce 400s at runtime GH_AW_COPILOT_SDK_SERVER_ARGSis now parsed as fatal in the SDK path even though the harness treats it as recoverable- multi-provider qualification still picks the first duplicate model id instead of forcing an explicit provider
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 80.2 AIC · ⌖ 7.49 AIC · ⊞ 19.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /codebase-design to the model-routing and cross-family sub-agent logic. No blocking issues; left two observations.
📋 Key Themes & Highlights
Key Themes
- Inconsistent failure mode for unqualifiable models: session-level model qualification now throws (
copilot_sdk_session.cjs,copilot_sdk_driver.cjs,copilot_harness.cjs), but sub-agent-level qualification only logs a warning and silently falls back to the session model. This re-introduces a softer version of the "declared sub-agents were ignored" bug the PR title calls out. - Duplicated Copilot-provider-name matching: the Copilot-family provider-name pattern is independently encoded in
awf_reflect.cjs(list literal),copilot_sdk_multi_provider.cjs(regex), andpkg/cli/model_identity.go(regex). Low risk today, but a future wire-API addition needs synchronized edits in three places.
Positive Highlights
- ✅ Excellent test coverage: new unit tests for
qualifyModelForMultiProvider,resolveMultiProviderFromReflect's responses/completions split, cross-family custom-agent qualification incopilot_sdk_driver.test.cjs, and Go-sidenormalizeModelProvider/attribution merging all pass (go test ./pkg/cli/...verified green). - ✅ The smoke workflow's new post-step assertions require real evidence (proxy request logs with model/endpoint/status) rather than trusting model-name replies — a solid anti-flakiness design per
/diagnosing-bugsprinciples. - ✅ Backward-compatible model-string handling (
copilot/<model>legacy prefix, bare model ids, fully-qualifiedprovider/model) is deliberately preserved and tested.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 98.4 AIC · ⌖ 13.7 AIC · ⊞ 10.3K
Comment /matt to run again
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Fixed in All 111 focused SDK tests, targeted Go attribution tests, and the final lint/impacted-test gate passed. Secret scanning and a separate read-only review passed. Automated review was unavailable, and CodeQL skipped analysis due to database size. PR #67509 is already non-draft and ready for your sandbox rerun. |
|
@copilot /pr-finisher Re-tested
Before finishing, please handle the eight open review threads. Reply on each thread with what you changed (we'll resolve them). Our decision per thread:
Also:
|
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Addressed all eight threads in 5d71db9 / 369ae80 and replied individually; left resolution to you. SDK-only fixes cover cwd anchoring, startup endpoint mismatch, best-effort args with headless defaults, visible unavailable-model fallback, ambiguity errors, shared provider-name helper, and fixture status. Also corrected the SDK display-name assertion causing this PR’s JS failure; CLI wire selection is unchanged. 647 focused JS tests, focused Go audit tests, final validation gate, secret scan, and separate read-only review passed. Automated review was unavailable; CodeQL reported no alerts with Go analysis skipped as unchanged. ADR is Proposed with gh-aw maintainers as deciders and records decisions 2/4. Remaining blocker: the progress tool does not edit the PR body, and no authorized PR-body editor is available here. Please add this link: https://github.com/github/gh-aw/blob/copilot/fix-copilot-sdk-issues/docs/adr/67509-split-copilot-sdk-providers-by-wire-api.md PR is already non-draft. Doc Build - Deploy remains a known main failure: the same drive-memory → cache-memory broken link appears in main run 38072203191 and PR run 38087467140; left unchanged. Final CI on the new HEAD is unverified. Human thread resolution/approval and the ADR body link remain before merge. |
|
Verified
Scope: SDK mode only ( |


Routed SDK sessions passed bare models, bypassing BYOK inference under org billing. Declared sub-agents were ignored, and one provider-wide wire API prevented GPT and Claude agents from sharing a session. - Model routing - Split Copilot providers into Responses and Chat Completions routes using
/reflectendpoint capabilities. - Qualify routed, fallback, reflected, and sub-agent models; preserve explicit API selections. - Leave non-Copilot endpoints and CLI mode unchanged. - Declared agents - Load inline and repository agent files as SDKcustomAgents, preserving name, description, prompt, and tools. - Qualify concrete models; aliases inherit the session model. Unknown agent models warn before inheriting. - Observability - Capturesubagent.selectedandmodel.call_final_result, including BYOK status. - Normalize qualified model identities for audit spend attribution. - Require smoke evidence of completed delegation on the expected model and proxy endpoint, rather than model-name replies. Example routing within one session:text Main: copilot-responses/gpt-5.6-luna → /responses Sub-agent: copilot-completions/claude-haiku-4.5 → /chat/completions- Fixes #67507ADR: docs/adr/67509-split-copilot-sdk-providers-by-wire-api.md