Skip to content

Align model routing with AWF runtime and topology support #77208

Done

Description

@SivaKesava1

Summary

Align implicit model-routing eligibility and explicit routing validation with AWF's supported primary-agent runtimes and topology. Today gh-aw skips an otherwise eligible Cloud Hypervisor workflow that AWF can route, while accepting explicit routing on configurations AWF rejects before the agent starts.

This is a compiler fix, not a request to change workflows to model: router or implement another AWF backend.

Verified background

Checked the relevant code on main at gh-aw 741ff0c and gh-aw-firewall 72336a0.

Before that change, Daily Fact run 42721729780 and Daily AWF Spec Compiler Surfacing Review run 42721692090, both on 9 November 2026, enabled routing, selected --container-runtime cloud-hypervisor, and failed with Fatal error: Error: Model routing requires a Docker Compose managed agent. These are historical failure evidence, not the current NVX error or live acceptance evidence for the new backend.

Problem 1: the implicit default still excludes Cloud Hypervisor

defaultModelRoutingIneligibility unconditionally groups isCloudHypervisorRuntime with ARC/DinD, NVX, and the legacy-security runtime. It does not account for Cloud Hypervisor routing support in the effective AWF version.

There are seven direct workflows with sandbox.agent.runtime: cloud-hypervisor at the audited revision, but six already explicitly choose a model:

Workflow Authored model choice
audit-workflows model: copilot/gpt-6-luna
copilot-centralization-optimizer model: copilot/gpt-6.1-sol
daily-awf-spec-compiler-surfacing model: copilot/gpt-6-sol
daily-caveman-optimizer model: "${{ needs.activation.outputs.model_size }}"
daily-fact model: openai/gpt-5.6-terra; also uses the OpenAI provider
daily-mcp-concurrency-analysis No model or routing choice, including its resolved shared imports; Copilot engine
smoke-work-queue engine.model: copilot/gpt-5.3-codex, plus explicit fallback models

Consequently, this fix should newly default daily-mcp-concurrency-analysis, not all seven. The others are not running an unspecified engine-default model and must retain their authored choices. Existing model-choice and provider eligibility rules must not be relaxed.

Problem 2: explicit routing lacks runtime/topology validation

validateModelRouting validates the engine, firewall, provider/target, objective, candidates/policy, and minimum routing version, but not the runtime/topology/host compatibility described above. model: router normalizes into the same explicit-routing configuration.

Otherwise-valid workflows can therefore compile with routing on NVX, runner.topology: arc-dind, or an effective agent mount that exposes the Docker socket, without a routing-compatibility diagnostic. AWF then refuses that routed invocation at startup.

Two details matter when defining the missing validation:

Intended change

Introduce one shared runtime/topology compatibility helper, consumed by both implicit-default eligibility and explicit-routing validation, so the two cannot drift.

Apply the parts of AWF's routing contract that gh-aw can establish from the resolved workflow:

  • Default Docker execution uses AWF's runc path; the gh-aw frontmatter selector is sandbox.agent.runtime: docker or omission, not runtime: runc. Cloud Hypervisor supports routing with effective AWF v0.29.12 or newer. NVX remains unsupported.
  • Reject known DinD topology, notably runner.topology: arc-dind.
  • Reject statically identifiable, effective agent mounts that expose the Docker socket, including unmasked parent-directory exposure. Respect AWF's masking semantics; do not reject safe unrelated mounts or mounts the compiler does not emit.
  • Require a Linux AWF execution host, accounting for the existing Windows/WSL adapter. Reject a provably native non-Linux execution path, but do not infer an OS from opaque runner groups, expressions, or arbitrary self-hosted labels.

Reuse existing effective-version precedence (sandbox.agent.version, then configured firewall version, then the compiler default) and version-gate conventions. Do not duplicate or weaken existing API-proxy, router-image pin, model-policy, engine, or provider validation.

For the implicit default, a compatibility failure silently preserves non-routed behavior, with no new routing warning/error/notice. Otherwise-eligible Cloud Hypervisor workflows on supported AWF versions receive the existing goal: cost, mode: auto default and informational notice. Preserve every other default-routing exclusion, including the legacy-security exclusion; shared backend support must not accidentally broaden implicit eligibility.

For explicit routing, return an actionable compile-time validation error naming the conflicting field and value (for example sandbox.agent.runtime: nvx, sandbox.agent.version: v0.29.11, runner.topology: arc-dind, or the offending sandbox.agent.mounts entry). Explain that routing supports default Docker/runc and Cloud Hypervisor with AWF v0.29.12+, identify any host/topology prerequisite, and link github/gh-aw-firewall#10335. Apply this equally to router model values and engine.model-routing.

Compile-time boundary

AWF must retain runtime enforcement. The compiler cannot generally know the actual process platform behind opaque runner selections, the runner/Docker filesystem relationship, runtime-selected socket paths and symlink targets, private-routing-root/guest-export overlap, or host/KVM/tool availability. Nor can it resolve flags such as --keep-containers injected outside declared workflow configuration. A literal authored sandbox.agent.args flag is visible, not inherently unknowable; expanding custom command/argument analysis is outside this fix, and existing implicit-default exclusions for custom arguments remain intact.

Acceptance cases

Use small Markdown workflows with on: workflow_dispatch, read-only contents permission, a Copilot engine, a short prompt, and otherwise valid defaults. Use v0.29.11 as the adjacent unsupported Cloud Hypervisor version so unrelated old-AWF feature gates do not obscure the result.

Case Input Observable result
A1 No authored model/routing; sandbox.agent.runtime: cloud-hypervisor; default AWF Compile succeeds; parsed/compiled routing is the implicit goal: cost, mode: auto default; routed AWF config and digest-pinned router image are emitted; one informational default-routing notice and no new warnings. Preserve the existing activation-time model-variable bypass.
A2 A1 with sandbox.agent.version: v0.29.11 Compile succeeds without routing, router/decision/conversation machinery, or routing diagnostics.
B1 A1 with model: router Compile succeeds with explicit routing and no implicit-default notice; lock/config select Cloud Hypervisor and routing. This checks compiler wiring, not a live inference result.
B2 B1 with sandbox.agent.version: v0.29.11 Compile fails with a validation error naming the incompatible version/runtime, explaining the v0.29.12 minimum, and linking github/gh-aw-firewall#10335.
B3 B1/B2 expressed instead as engine.model-routing with goal: cost, mode: auto The same supported/unsupported-version results, through the same compatibility helper.
C1 model: router, separately with sandbox.agent.runtime: nvx, runner.topology: arc-dind, or sandbox.agent.mounts: ["/var/run/docker.sock:/docker.sock:rw"] Each otherwise-valid fixture fails compilation with a routing validation error naming that setting/value, supported runtimes, and the parity link. Cover engine.model-routing too.
C2 model: router with an unmasked parent-directory bind such as sandbox.agent.mounts: ["/var/run:/docker-run:ro"]; repeat without an authored model/routing choice Explicit routing fails with the offending mount named; implicit routing is skipped silently. A safe unrelated bind and a socket bind AWF masks are not rejected by the new compatibility check.
C3a A default-Docker workflow with model: router and literal runs-on: windows-latest Compilation remains allowed and generated AWF execution retains the Linux/WSL adapter. Do not reject it solely because the Actions runner is Windows.
C3b A default-Docker workflow with model: router and runs-on: [self-hosted, windows, x64], which does not select the literal-label WSL adapter Explicit routing fails with an error naming runs-on and explaining the Linux AWF-host requirement. The non-routed fixture retains its existing compile behavior. Opaque runner groups/expressions must not be treated as proof of this native-Windows path.
C4 Otherwise-valid unsupported-runtime/topology fixtures with no authored routing/model, and separately with engine.model-routing: false Compile succeeds non-routed without new routing diagnostics. Preserve existing independent validation failures rather than making invalid workflows valid.
D Run make recompile on the fix and compare with the same command on the audited main baseline, using the same toolchain/pins daily-mcp-concurrency-analysis.lock.yml gains the implicit routing wiring. The six other Cloud Hypervisor workflows keep their authored model choices. No unrelated lock changes caused by this fix, and no new errors/warnings for already-supported routed workflows. Re-evaluate the inventory if main has changed; never force all seven to route.
E Table-driven compiler tests for A-C, including version boundary/precedence and positive Docker/WSL/mount controls Extend pkg/workflow/model_routing_test.go and add focused default cases in pkg/workflow/model_routing_default_test.go. The latter does not currently exist: existing implicit-default tests and fixture-compilation helpers are in model_routing_test.go. Assert compile results, generated routing/absence, diagnostics, and unchanged opt-out behavior, not just helper return values.

Non-goals

  • Implementing NVX/other-backend routing; that remains Provide primary-agent and enclave parity across Docker, NVX, and Cloud Hypervisor gh-aw-firewall#10335.
  • Changing any other default-routing eligibility rule, authored model/provider choice, or workflow to model: router.
  • Replacing AWF's runtime host/filesystem/isolation checks, handling externally injected --keep-containers, or redesigning custom AWF command/argument handling.
  • Proving Cloud Hypervisor live acceptance or dispatching workflows as part of this issue preparation.

Scope

  • Keep the PR to this one fix. Do not change files or behavior 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 to fix a failing check: fix only failures caused by this PR's changes.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions