Skip to content

Allow a top-level shortlist for router models - #79076

Merged
rabeckett merged 4 commits into
mainfrom
feat/router-shortlist-v1
Nov 18, 2026
Merged

rabeckett merged 4 commits into
mainfrom
feat/router-shortlist-v1

Conversation

@rabeckett

@rabeckett rabeckett commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #78928. This is the first step of #78927.

ADR: ADR-79076: Allow a Top-Level Shortlist for Router Models

A workflow can now put model-routing.allowed-models next to an explicit model: router or named router level. The list narrows the main agent’s candidates without restricting sub-agents. It compiles to the same effective firewall configuration as the equivalent nested engine block. Existing workflows, opt-outs, model overrides and routing tables are unchanged. No smoke workflow is migrated or legacy setting deprecated here.

The compiler tests cover local and imported shortlists, conflicting or missing selectors, and old firewall versions that cannot enforce a main-agent-only list. Focused routing tests and the native Linux intermediate pre-push gate passed on the submitted tree, including formatting, building the compiler, parser/workflow compile and vet, and embedded schema freshness. The full pre-push gate and hosted CI will be checked while this PR is in draft.

Smoke workflow validation

At f60d22d8cc95c2b4f829a04b2b6816bca40041a6, I compiled smoke-copilot-sdk-routed locally twice: first with the existing nested routing block, then with model: router/economy and top-level model-routing.allowed-models. Both compiles succeeded without warnings and emitted identical firewall configuration. The main agent still has just github-copilot/gpt-5.6-luna as a candidate, and the declared haiku-whoami sub-agent still uses claude-haiku-4.5 outside that shortlist. The lock changed only in frontmatter-derived hashes and the audit metadata recording the explicit router/economy selector. No workflow was dispatched or migrated in this PR.

Draft CI finished with 65 passed, 14 skipped, and one failure. The PR job and main job both report TestNoRawOctalPermissionLiteralsInOSCalls on the same 0o600 in pkg/cli/update_pr_release.go, which this PR does not touch.

Keep top-level router selection and its main-agent candidates independent of the engine. Preserve legacy routing, defaults, and sub-agent policy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

Shared-import routing blocks bypass schema validation, silently discarding unsupported keys and allowing invalid workflows to compile with the router model's cost level instead of failing.

1 open issue
What changed in this PR

Adds top-level model-routing.allowed-models to gh-aw workflows, letting authors narrow explicit router choices for the main agent without restricting sub-agents. This implements the first phase of separating model routing from engine configuration.

Changes:

  • Carries local and imported shortlists into the existing routing configuration.
  • Adds selector, conflict, and firewall compatibility checks, with compilation tests.
  • Documents the new syntax while retaining nested routing support.
File Description
pkg/​workflow/​model_routing.go Checks firewall support for separate router candidates.
pkg/​workflow/​model_router_value.go Resolves shortlists and attaches them to router selections.
pkg/​workflow/​model_router_value_test.go Tests equivalence, imports, and invalid configurations.
pkg/​workflow/​compiler_orchestrator_engine.go Integrates shortlist resolution into engine setup.
pkg/​parser/​schemas/​main_workflow_schema.json Defines the top-level shortlist schema.
pkg/​parser/​import_processor.go Exposes imported shortlists to the compiler.
pkg/​parser/​import_extract_engine.go Extracts shortlists from imported frontmatter.
pkg/​parser/​import_accumulator.go Preserves separate imported shortlist declarations.
docs/​src/​content/​docs/​specs/​model-alias-specification.md Specifies shortlist scope and selector requirements.
docs/​src/​content/​docs/​reference/​model-routing.md Explains shortlist syntax, examples, and constraints.
docs/​src/​content/​docs/​reference/​frontmatter.md Introduces the top-level shortlist option.
docs/​src/​content/​docs/​reference/​frontmatter-full.md Includes the new field in the full reference.
.github/​aw/​syntax-engine.md Updates engine syntax guidance for top-level shortlists.

Review effort: Balanced

Comment thread pkg/parser/import_extract_engine.go Resolved
@rabeckett

Copy link
Copy Markdown
Collaborator Author

@copilot /pr-finisher Please address the Balanced review finding on this draft. An import that substitutes github.aw.import-inputs must enforce the same top-level model-routing shape as a local declaration. Please validate the resolved block before extracting its candidates, preserve existing behavior for unrelated import fields, and add a focused regression test covering substitution, including a valid shortlist. Keep this on the existing PR branch and within #78928. Please run the focused tests and repository validation, report the exact SHA tested, and leave the PR in draft.

The PR’s N–R test shard failed on a raw 0o600 in pkg/cli/update_pr_release.go. The same shard on the exact base commit reports the identical file, literal and test. Please do not change that file, repeatedly rerun the job, or merge main for this failure.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@rabeckett
rabeckett marked this pull request as ready for review November 18, 2026 18:45
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #79076 · codex · routed: gpt61 medium · ~9 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~10 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #79076 · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@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.

Reviewed the current diff and changed-line behavior. No actionable correctness, performance, or maintainability issues found. The specialist pass was unavailable due to tool permission rejection; this verdict is based on independent static analysis of the pre-fetched diff and relevant source files. Tests were not run per the static-review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K
Comment /review 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.

Reviewed head f60d22d8cc95c2b4f829a04b2b6816bca40041a6 against the Model Alias Format Specification v1.4.0 and related routing references.

Blocking finding: the PR adds a normative requirement in docs/src/content/docs/specs/model-alias-specification.md §9.4 for top-level model-routing.allowed-models, but leaves the formal document at Version 1.4.0 and adds no Change Log entry. Please synchronize the specification metadata and change log (or keep this behavior only in the informative reference).

One inline comment was posted. No implementation or tests were changed by this review.

Generated by PR Specification Reviewer for #79076 · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review-specs to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-87a2649a-9365-43cf-9f31-1d8244849faa","parents":[],"payload":{"id":"ldg-548c2c88-f296-401b-8f75-71fe779fb1d0","operation":"append","value":{"finding_count":0,"head_sha":"f60d22d8cc95c2b4f829a04b2b6816bca40041a6","outcome":"no_findings"}},"sha":"sha256:52bf46ccea9c45bdd460ebb2010e5b3dce7490bd62eadf2270483b165e000100","timestamp":"2026-11-18T18:52:38.540Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/79076-allow-top-level-shortlist-for-router-models.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff

  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered. Verify the [TODO: verify] deciders field.

  3. Commit the finalized ADR to docs/adr/ on your branch

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-79076: Allow a Top-Level Shortlist for Router Models (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-8f23eb15-23ba-4352-8534-bc3459ee6f9c","parents":[],"payload":{"id":"ldg-39211d77-ee9d-4558-987f-8ab826042799","operation":"append","value":{"finding_count":1,"head_sha":"f60d22d8cc95c2b4f829a04b2b6816bca40041a6","outcome":"regression"}},"sha":"sha256:360dc9c95bd33993a6e8cd594b8465d50ad4dd9c990e6d5b5f982cad24442bb9","timestamp":"2026-11-18T18:53:25.625Z","type":"ledger_append","version":1}
History

@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.

Skills-Based Review 🧠

Applied /tdd and /codebase-design. The core change is sound: the shortlist is kept separate from the router value, conflicts are rejected rather than merged, the firewall-version gate fails closed, and imported blocks are schema-checked after substitution. I found no blocking bugs. Two non-blocking items are inline.

📋 Key Themes & Highlights

Key Themes

  • Dead test branch: the empty shortlist case is caught by schema first, so the code branch it names is unreachable from workflow input.
  • Hint noise: the new root model-routing key adds a misleading "belongs under the root level" hint for mistyped nested keys.

Positive Highlights

  • ✅ Shortlist conflicts across imports fail with an error instead of silently widening the list.
  • ✅ Top-level and nested paths both reject a non-router model and a fixed model with a shortlist.
  • ✅ Diamond imports are deduplicated by the BFS visited set, so one shortlist cannot be counted twice.
  • ✅ The AWF pin-catalog gate matches the existing model_routing_test.go expectation.

Uncertainty

  • I did not confirm the pre-PR output of the mistyped-key hint, so comment 2 is an inference.
  • Expression-valued shortlists were not compared end to end. The fixtures needed sandbox.agent.images to compile.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~10 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

{"imported opt-out", "model: router\n" + block, "engine:\n id: copilot\n model-routing: false\n", "engine.model-routing: false"},
{"two shortlists", "model: router\n" + block, block, "more than one top-level router shortlist"},
{"goal in new block", "model: router\n" + block + " goal: cost\n", "", "goal"},
{"empty shortlist", "model: router\nmodel-routing: {allowed-models: []}\n", "", "allowed-models"},

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.

[/tdd] The empty shortlist case does not reach the branch it names. The schema rejects allowed-models: [] first (minItems: got 0, want 1), so this case only checks the schema message. I found no path that reaches the router shortlist is empty in model_router_value.go: top-level [] fails schema, and imports go through the same check (import_extract_frontmatter.go L18-23). Either assert the schema error directly, or drop the unreachable branch.

@copilot please address this.

"description": "Default LLM model, overridden by nested engine.model. Sets the default model used by the agentic engine for this workflow. Acts as a fallback when an engine instance does not specify its own 'model'; a nested 'engine.model' (e.g. safe-outputs.threat-detection.engine.model) takes precedence over this field for that engine instance. Supports full model IDs (e.g. 'claude-3-5-sonnet-20241022', 'gpt-5.4') and model aliases (e.g. 'small', 'large'). Router values ('router', 'router/economy', 'router/balanced', 'router/robust') choose model routing for the main agent instead of a fixed model.",
"examples": ["gpt-5.4", "claude-3-5-sonnet-20241022", "gpt-4"]
},
"model-routing": {

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.

[/codebase-design] A mistyped nested value gets a misleading hint. With engine.model-routing.allowed-models: [1], the compiler reports Unknown properties: id, model-routing and suggests 'model-routing' belongs under the root level. The new root model-routing property adds a second schema location for that name, and the hint generator in pkg/parser/schema_suggestions.go (around L800) lists every location. Consider a distinct root-level name, or excluding it from the hint index. I did not confirm the pre-PR output.

@copilot please address this.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rabeckett
rabeckett dismissed github-actions[bot]’s stale review November 18, 2026 19:30

Superseded by dac599c. The sole finding is fixed: the Model Alias Format Specification now has draft version 1.5.0 and a matching section 9.4 changelog entry. The inline thread is resolved, and all checks on the fixed revision have completed with no failures.

@rabeckett
rabeckett merged commit 8f42b0b into main Nov 18, 2026
89 checks passed
@rabeckett
rabeckett deleted the feat/router-shortlist-v1 branch November 18, 2026 19:31
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.

Allow a top-level shortlist alongside model: router

3 participants