Skip to content

feat(router): expose distinct eligible primary routing options - #11794

Merged
rabeckett merged 11 commits into
mainfrom
adaptive-route-options
Nov 19, 2026
Merged

rabeckett merged 11 commits into
mainfrom
adaptive-route-options

Conversation

@rabeckett

@rabeckett rabeckett commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #11793

Request apiProxy.routing.topK (1–32; pilot: 3) to report the first eligible effort for each of up to K distinct models from the configured provider. The proxy uses its existing validated rank and always guards the ordinary first pick. Omitting topK preserves the old selection, wire and log shape. No classifier, router request, discovery, inference, or table changes. There is no manual exclusion option; workflow-learned suspensions belong to the separate selector, not this PR.

The trusted host's private selection receipt adds only routeOptions.ordinaryPick and routeOptions.options when requested. Nothing is added to /reflect. The full rank stays intact and the receipt stays inside the existing 16 KiB bound. Alternatives blocked by the model multiplier cap are skipped before taking K; a blocked primary still fails rather than falling through.

Verified at 5f632f449e72939e506c02745a37138ea91e2e20: 278 focused proxy/guard tests, 281 host tests, build, type-check, lint and schema sync. Five no-inference Linux Docker cases on a 74-pair real-router rank covered ordinary routing, K=1/3/4, capped-alternative refill and the private host bootstrap. These use a synthetic provider/classifier, not a full agent run. Full rank, ordinary pick and bounded fixture cases.

The preceding head's red coverage job failed a shell-output assertion in the Docker harness observation suite before the coverage comparison. It did not report a drop. Prior deterministic integration CI comparison against main.

rabeckett and others added 4 commits November 18, 2026 10:35
Keep the ordinary pick and full eligible rank in the proxy, apply primary-only soft exclusions before taking three pairs, and report a bounded summary through the private bootstrap.

Co-authored-by: Copilot <[email protected]>
Walk the full eligible rank after exclusions or suspensions. Keep exact pairs and their original order for the ordinary pick and recorded arms.

Co-authored-by: Copilot <[email protected]>
Compare the whole provider-qualified ID without case in host and proxy validation, but retain the supplied spelling for a valid exclusion.

Co-authored-by: Copilot <[email protected]>
Keep the cost-only goal accepted by main and the primary-only exclusions documented by FW-1.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11794 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 5fa8ec7

@rabeckett rabeckett changed the title Expose distinct eligible primary routing options without replanning feat(router): expose distinct eligible primary routing options Nov 18, 2026
@rabeckett

Copy link
Copy Markdown
Collaborator Author

Validated 191ef84a6d1665583215775b5ca7e6e611508798 after integrating the cost-only change from main. The PR diff contains only FW-1. Build, type-check, 145 focused proxy tests and 281 host configuration tests passed locally.

No-paid-inference Docker smoke: on an internal Linux ARM64 network, the real v0.3.0 router served this head's three cost tables to the PR-head proxy controller. The production session published private results and the host bootstrap accepted selection and completion. Four dispatches passed: no opt-in, three distinct options, exclude the ordinary base and refill, and exclude all bases and retain the ordinary pick. Each used the same 74-pair rank, one /classify, one /route, one synthetic classifier response, and one real final guard check. No provider credentials or paid inference were used.

Limits: this exercises the routing bootstrap, not a full agent launch or live provider discovery/inference. The legacy six-profile v0.3.0 configuration was rejected by the new cost-only capabilities validator inherited from main; the three-cost-profile run passed. I did not change that validator or dispatch the live workflow.

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

Valid routes can incorrectly fail with routing_contract_error when raw and provider-prefixed catalogue entries share a model/effort under different choice IDs, even without exclusions.

1 open issue
What changed in this PR

This PR extends AWF’s task-level model routing to expose up to three distinct eligible models from the existing validated ranking, without another router call.

Changes:

  • Adds primary-only excludedModels configuration with case-insensitive duplicate validation.
  • Publishes an opt-in private options summary and records when exclusions fall back to the ordinary pick.
  • Adds documentation and regression coverage for distinct-model selection, fallback, guards, and baseline compatibility.
File Description
src/​types/​api-proxy-routing-options.ts Adds the optional exclusions type.
src/​services/​api-proxy-env-config.test.ts Tests exclusion transmission to the proxy.
src/​config-file.ts Rejects case-insensitive duplicate exclusions.
src/​config-file-validation.test.ts Covers host-side exclusion validation.
src/​awf-config-schema.json Adds runtime schema constraints for exclusions.
docs/​awf-config.schema.json Defines exclusions in the canonical schema.
docs/​awf-config-spec.md Documents selection, private options, and fallback.
containers/​api-proxy/​routing-runtime.test.js Tests the combined private-result size limit.
containers/​api-proxy/​routing-runtime.js Publishes options only in the private result.
containers/​api-proxy/​routing-persistence.test.js Tests fallback logging and summary omission.
containers/​api-proxy/​routing-persistence.js Allows the fallback audit field.
containers/​api-proxy/​routing-efforts.test.js Covers private options and omitted-effort semantics.
containers/​api-proxy/​routing-controller.test.js Adds ranking, fallback, guard, and compatibility tests.
containers/​api-proxy/​routing-controller.js Integrates primary options, selection, and audit output.
containers/​api-proxy/​routing-config.test.js Covers proxy-side exclusion validation.
containers/​api-proxy/​routing-config.js Parses and validates exclusions.
containers/​api-proxy/​routing-candidates.test.js Tests distinct-model shortlisting and refill.
containers/​api-proxy/​routing-candidates.js Builds primary options from the validated rank.
containers/​api-proxy/​fixtures/​routing-options/​three-efforts.json Supplies ranking and fallback fixtures.

Review effort: Balanced

@rabeckett

Copy link
Copy Markdown
Collaborator Author

Reviewed head 191ef84a6d1665583215775b5ca7e6e611508798. The duplicate-pair thread remains open. I replayed the same synthetic catalogue and unmodified route response against base c1d3c5cf and this head, without opting in. Two distinct offered IDs resolved to github-copilot/model-b at high. The base chose the first ID and ran the final guard once. This head returned routing_contract_error before the guard. Both called classification and routing once. The existing wire contract accepts that rank while the FW-1 plan explicitly rejects duplicate pairs. My recommendation is to preserve the base behavior without opt-in and enforce pair uniqueness only for requested options, pending a contract decision.

Checks finished: 42 passed and 5 skipped. The coverage job ran and saved PR-head coverage, then hit its 15-minute limit while collecting base coverage. There is no coverage comparison. The four isolated Docker cases did not use paid inference or launch a full agent. Leaving this draft unmerged.

Only build bounded options when requested. A wire-valid rank with two IDs for one model and effort keeps its original first ID and final guard without opt-in. The options contract still rejects duplicate pairs before filtering.

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@rabeckett Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

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.

🔵 Needs a closer look

Opt-in exclusions affect primary selection across classifier eligibility, ranked-choice mappings, provider guards, and private bootstrap publication, creating interacting routing and startup contracts that require broader review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@lpcox
lpcox marked this pull request as ready for review November 18, 2026 20:51
@rabeckett

Copy link
Copy Markdown
Collaborator Author

CI handoff for d968700819ea0eec6ec0dc30528e3766f4ac8942: the finished FW-1 integration run failed the same seven named tests as the PR base without FW-1. API Proxy had one failure, Protocol & Security two, Container & Ops three, and Domain one. The image build and Network Tests passed on both. FW-1 changed neither these tests nor the integration workflow. The newer main run is also red on all three required jobs.

For upstream triage, the last passing main integration run and the next failing main run are one commit apart. That first red run already failed API Proxy, Protocol & Security, and Domain; Container & Ops was not red in that run. This narrows where to start, not which change caused all seven failures.

The FW-1 alias finding is resolved on this head. The focused tests and four no-inference Docker routing cases passed. CI maintainers/coordinator: please link the upstream fix here when tracked. Once it is on main, the next step for this PR is to take the fix, retest routing, and run the deterministic integration workflow on the resulting SHA. No check bypass or paid smoke run is needed for triage.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Security Guard completed successfully!

Security Guard

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 Security Guard for #11794 · copilot · auto (Claude Sonnet 5.5) · ~14 AIC · ⊞ 9.1K · ◷

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts

Merged main cleanly in cf66660 (two-parent merge; no conflicts). The API-proxy tests could not run because the package feed hostname failed to resolve (ENOTFOUND).

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

Smoke Chroot

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.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Build Test Suite

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.

Warning

Firewall blocked 1 domain

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

  • 169.254.169.254

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

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Generated by Build Test Suite for #11794 · copilot · routed: haiku55 high · ~4 AIC · ⊞ 6.1K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #11794 · claude · haiku45 · ~36 AIC · ⊞ 6.4K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

❌ Security Guard failed. Please review the logs for details.

Security Guard

Outcome: incomplete

The agent failed after emitting a no-op output. Task completion is unconfirmed; the no-op does not establish success or a transient failure.

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

Generated by Security Guard for #11794 · copilot · auto (Claude Sonnet 5.5) · ~14 AIC · ⊞ 9K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

🛡️ Egress verdict from Smoke Copilot Network Isolation

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

Smoke Codex

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.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

Cloud Hypervisor + Copilot smoke test

  1. Merged PR lookup: PASS
  2. github.com connectivity: PASS (HTTP 200)
  3. File write/read: PASS
  4. example.com blocked: PASS (HTTP 000)

Overall: PASS

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Network Isolation ✅ PASS

Both egress isolation checks completed successfully:

Check Result Details
Allow ✅ PASS api.github.com returned HTTP 200 (allowlisted domain)
Deny ✅ PASS example.com rejected with SNI certificate mismatch (blocked by isolation)
EGRESS_RESULT allow=pass deny=pass

The firewall correctly permits traffic to allowlisted domains and blocks non-allowlisted domains via SNI inspection.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Services smoke test: PASS

  • ✅ Redis PING → PONG
  • ✅ pg_isready → accepting connections
  • ✅ psql SELECT 1 → 1

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia ✅ 1/1 passed ✅ PASS
Bun hono ✅ 1/1 passed ✅ PASS
C++ fmt ✅ N/A ✅ PASS
C++ json ✅ N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world ✅ N/A ✅ PASS
.NET json-parse ✅ N/A ✅ PASS
Go color ✅ ok (pass) ✅ PASS
Go env ✅ ok (pass) ✅ PASS
Go uuid ✅ ok (pass) ✅ PASS
Java gson ✅ 1/1 passed ✅ PASS
Java caffeine ✅ 1/1 passed ✅ PASS
Node.js clsx ✅ "All tests passed" ✅ PASS
Node.js execa ✅ "All tests passed" ✅ PASS
Node.js p-limit ✅ "All tests passed" ✅ PASS
Rust fd ✅ 1/1 passed ✅ PASS
Rust zoxide ✅ 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

All clones succeeded. Environment workarounds were needed on this runner (none affect test results):

  • .NET: XDG_RUNTIME_DIR=/run/user/1001 doesn't exist; pointed it at a writable temp dir.
  • Java: ~/.m2 is root-owned, so the local repo was set to a temp dir and proxy settings were passed via -s. The JDK cacerts is a broken symlink, so Maven used a truststore built from the system CA bundle (certificate verification stays on).
  • Bun/Deno: installed via their official installers.

Warning

Firewall blocked 1 domain

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

  • 169.254.169.254

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

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Generated by Build Test Suite for #11794 · copilot · routed: haiku55 high · ~4 AIC · ⊞ 6.1K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

  • API status: ✅ PASS
  • GitHub check: ✅ PASS
  • File status: ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #11794 · claude · haiku45 · ~36 AIC · ⊞ 6.4K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.16 Python 3.12.16 ✅ YES
Node.js v24.22.2 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ALL_TESTS_PASSED=false. Python and Go match, but Node.js differs between host (v24) and chroot (v22). The smoke-chroot label was not added.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine (PR #11794, @rabeckett)

Merged PR titles checked:

Overall status: PASS

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test results

  • fix: prepare sensitive tmpfs targets in read-only handoffs
  • fix: restore private tmp integration checks and read-only handoff startup
  • Merged PR review: ✅
  • PR detail lookup: ✅
  • Playwright title check: ❌
  • File write/read: ✅
  • AWF build: ✅
  • Overall: FAIL

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct Mode)

Test Result
GitHub MCP ✅ PR #11812, #11809 fetched
GitHub.com Connectivity ✅ HTTP 200
File Write/Read ✅ smoke-test-copilot-byok.txt verified
BYOK Inference ✅ Direct BYOK (agent → api-proxy → api.githubcopilot.com)

Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

OTEL Tracing Smoke Test Results

  • ✅ 1. Module loading: containers/api-proxy/otel.js loads. Exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, routerCallTracing, shutdown, isEnabled, plus _-prefixed internals.
  • ✅ 2. Test suite: otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js pass. 3/3 suites, 75/75 tests.
  • ✅ 3. Env var forwarding: env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID and GITHUB_AW_OTEL_PARENT_SPAN_ID (plus COPILOT_OTEL_FILE_EXPORTER_PATH) into the agent. api-proxy-env-config.ts forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, and the trace/parent IDs into the api-proxy.
  • ✅ 4. Token tracker integration: onUsage hook exists in token-tracker-http.js. upstream-token.js calls otel.setTokenAttributes from it.
  • ⚠️ 5. OTEL diagnostics: No /tmp/gh-aw/sandbox/firewall/logs/api-proxy/otel.jsonl found, so zero spans were confirmed exported. The api-proxy sidecar's output directory does not exist in this sandbox. Export is unverified, not failed.

Overall: Scenarios 1–4 pass. Scenario 5 needs a run where the api-proxy sidecar is active to confirm span export.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@rabeckett
rabeckett merged commit f4cb25c into main Nov 19, 2026
154 of 156 checks passed
@rabeckett
rabeckett deleted the adaptive-route-options branch November 19, 2026 16:13
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.

Make the ranked alternatives available before the primary model runs

4 participants