Skip to content

Deduplicate bounded-query runtime preflight checks behind a shared policy dispatcher - #6805

Merged
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-bounded-query-checks
Jul 31, 2026
Merged

Deduplicate bounded-query runtime preflight checks behind a shared policy dispatcher#6805
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-bounded-query-checks

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The bounded-query preflight path had duplicated runtime-availability branching in assertQueryRuntimeAvailable and assertPrimaryRuntimeAvailable, with parallel fail-closed logic that could drift. This change consolidates runtime selection into one internal dispatcher while keeping each scope’s probe behavior and error surface explicit.

  • Runtime policy unification

    • Added classifyRuntimeAvailability(...) and assertRuntimeAvailability(...) in src/bounded-query/preflight.ts.
    • Centralized runtime-case routing (sbx, docker, gvisor/runsc, custom OCI runtime, default Docker) so both preflight entry points use the same control-flow table.
  • Scope-specific enforcement preserved

    • assertQueryRuntimeAvailable(...) still enforces bounded-query runtime guarantees (including sbx capability proof and gVisor runsc requirement).
    • assertPrimaryRuntimeAvailable(...) still enforces primary-runtime availability before staging, with runtime-specific fail-closed errors.
  • Coverage updates for edge routing

    • Extended preflight unit coverage to include explicit "docker" primary runtime routing and ensure it follows runtime-registration checks.
const runtimeCase = classifyRuntimeAvailability(runtime);

switch (runtimeCase) {
  case 'sbx': return checks.sbx();
  case 'docker': return checks.docker();
  case 'gvisor': return checks.gvisor(runtime!);
  case 'custom': return checks.custom(runtime!);
  case 'default-docker': return checks.defaultDocker();
}

Copilot AI changed the title [WIP] Refactor bounded-query runtime availability checks Deduplicate bounded-query runtime preflight checks behind a shared policy dispatcher Jul 31, 2026
Copilot finished work on behalf of lpcox July 31, 2026 20:43
Copilot AI requested a review from lpcox July 31, 2026 20:43
@lpcox
lpcox marked this pull request as ready for review July 31, 2026 21:27
Copilot AI review requested due to automatic review settings July 31, 2026 21:27

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.

Pull request overview

Centralizes bounded-query runtime availability routing while preserving scope-specific probes and fail-closed errors.

Changes:

  • Adds a shared runtime classifier and dispatcher.
  • Refactors query and primary runtime preflight checks to use it.
  • Covers explicit Docker primary-runtime routing.
Show a summary per file
File Description
src/bounded-query/preflight.ts Consolidates runtime routing behind shared helpers.
src/bounded-query/preflight.test.ts Tests explicit Docker registration routing.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

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

@lpcox
lpcox enabled auto-merge (squash) July 31, 2026 21:49
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

Smoke test complete. Results posted to PR #6805.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR #6805 follows the CONTRIBUTING.md checklist: code changes are in src/, tests were added for the new runtime routing behavior, and the PR description is clear and references Fixes #6792. No contribution-guideline issues found.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6805 · haiku45 · 54.8 AIC · ⊞ 3.6K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

  • Redis PING: ❌ (DNS resolution failure)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (DNS resolution failure)

Overall: FAIL

All checks failed with Temporary failure in name resolution for host.docker.internal — the sandbox could not resolve the host name to reach the service containers.

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

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable: allowed=200
✅ Blocked domain (example.com) denied: CONNECT tunnel 403

Overall: PASS

@lpcox

Warning

Firewall blocked 1 domain

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

  • example.com

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

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅

Running in direct BYOK mode via COPILOT_PROVIDER_API_KEY → api-proxy sidecar → api.githubcopilot.com

Results:

  • ✅ GitHub MCP connectivity verified
  • ✅ github.com HTTP 200 OK
  • ✅ File write/read functional
  • ✅ BYOK inference path working (agent can respond)

Status: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox

  • GitHub MCP connectivity: ✅
  • GitHub.com connectivity: ✅
  • File write/read test: ✅
  • BYOK inference: ✅

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)

PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Copilot Engine

Overall: PASS

cc @lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 ✅ YES
Node.js v24.18.0 v22.23.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall result: FAILED — Node.js version mismatch between host and chroot environment. The smoke-chroot label was not added since not all tests passed.

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox
MCP connectivity (merged PRs): fix: diagnose bounded query runtime smokes, ci: add bounded query runtime smoke workflows ✅
GitHub.com HTTP: 200 ✅
File write/read (/tmp/gh-aw/agent/smoke-test-copilot-byok-aoai-entra-30667901904.txt): ✅
Direct BYOK inference: ✅

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra
Overall: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor
  • fix: diagnose bounded query runtime smokes
  • [Test Coverage] src/docker-manager.ts
  • GitHub PR read ✅
  • GitHub discussion lookup ✅
  • Browser title check ✅
  • File write/read ✅
  • npm ci && npm run build
  • Overall: PASS

Discussion comment and label steps were requested, but the available write tools in this workflow do not expose discussion comments or labels.

Warning

Firewall blocked 1 domain

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

  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

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

@github-actions

Copy link
Copy Markdown
Contributor

📡 OTel Tracing Smoke Test Results

Scenario Result
1. Module Loading otel.js loads; isEnabled() → true; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, plus internal exporters
2. Test Suite ✅ 59/59 tests passed (otel.test.js + otel-fanout.test.js)
3. Env Var Forwarding ✅ Forwarding implemented — lives in src/services/api-proxy-env-config.ts (OTEL_EXPORTER_OTLP_ENDPOINT, GITHUB_AW_OTEL_TRACE_ID/PARENT_SPAN_ID, etc.), not api-proxy-service.ts. Workflow's grep check targets the wrong file (minor test gap, not a code regression)
4. Token Tracker Integration onUsage callback present in token-tracker-http.js (4 occurrences)
5. OTEL Diagnostics ✅ Spans exported this run — gh-aw.agent.setup span observed in /tmp/gh-aw/otel.jsonl with correct traceId/spanId/resource attributes

Overall: ✅ All scenarios pass. Note: the smoke workflow's Scenario 3 check greps api-proxy-service.ts, but forwarding logic was moved to api-proxy-env-config.ts — consider updating the workflow's grep target to avoid a false negative in future runs.

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

@github-actions

Copy link
Copy Markdown
Contributor

Docker Sbx Smoke Test

Overall: PASS

cc @lpcox

📰 BREAKING: Report filed by Smoke Docker Sbx
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
Go env ok ✅ PASS
Go uuid ok ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Note: Java tests initially failed due to ~/.m2 being root-owned (permission denied creating local repo); resolved by overriding -Dmaven.repo.local to a writable path. All other ecosystems passed on first attempt with no errors.

Generated by Build Test Suite for #6805 · aut00 · 41 AIC · ⊞ 11.3K ·
Add label ready-for-aw to run again

@lpcox
lpcox merged commit e2753f9 into main Jul 31, 2026
136 of 140 checks passed
@lpcox
lpcox deleted the copilot/duplicate-code-bounded-query-checks branch July 31, 2026 22:01
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Result: FAIL

  • MCP: ❌ (Blocked)
  • Egress: ✅ (via Proxy)
  • Files: ✅
  • Bash: ✅

PRs: #6805, #6801

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

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.

[Duplicate Code] Bounded-query runtime availability checks are duplicated

3 participants