Skip to content

feat: add fail-closed sbx bounded-query backend - #6764

Merged
lpcox merged 4 commits into
lpcox-add-sbx-broker-ingressfrom
lpcox-add-sbx-query-runner
Jul 31, 2026
Merged

feat: add fail-closed sbx bounded-query backend#6764
lpcox merged 4 commits into
lpcox-add-sbx-broker-ingressfrom
lpcox-add-sbx-query-runner

Conversation

@lpcox

@lpcox lpcox commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds PR layer 4 of the bounded-query multi-sandbox plan, stacked on #6763.

  • extends boundedQueries.runtime with an independent sbx query backend
  • adds a broker-owned SbxQueryRunner, immutable trusted launch spec, scoped VM reconciliation, and deterministic stop/delete
  • adds an executable sbx capability probe pinned to the audited Docker Sandboxes CLI v0.37.1
  • keeps primary-agent sbx ingress capabilities entirely separate from query launch/auth
  • blocks broker assembly before staging or credential/socket exposure while mandatory sbx guarantees are unavailable
  • preserves the broker policy/protocol, canonical responses, timing buckets, information budgets, and Docker/gVisor behavior

Current support status

This is intentionally fail-closed preview support. sbx v0.37.1 provides sbx create --name --cpus --memory --template, read-only same-path mounts, sbx exec --user --workdir, sbx ls --json, sbx stop, and sbx rm --force, but does not provide enforceable per-VM network-none, PID, disk, per-file size, or explicit guest mount-target controls. Local/kit network rules are insufficient because organization governance can replace them.

The probe therefore exits non-zero, runtime: "sbx" aborts before staging/Compose assembly, no Docker socket or sbx daemon credential reaches the broker, and there is no fallback to Docker/gVisor. The dormant launch vector is contract-locked to every probed hard-isolation flag so future enablement cannot drift from the proof.

Validation

  • TypeScript type-check and build pass
  • 187 focused bounded-query/schema tests pass
  • 4,881 regression tests pass (281 suites; one opt-in real-sbx capability test skipped by default)
  • opt-in real sbx capability probe passes and reports unsupported when sbx is unavailable
  • full suite has one pre-existing macOS /var/tmp vs /private/var/tmp assertion failure in src/bounded-query/mount-policy.test.ts; the remaining 4,894 tests pass
  • executable probe and all new broker modules pass node --check

Layer 5 requirements

Layer 5 must keep sbx query rollout blocked until a supported sbx release exposes all probed controls, AWF publishes a digest-pinned Python-standard-library-only query template/bootstrap, broker-only daemon transport/auth is defined and packaged without image-layer credentials, and the real matrix proves no network/lateral access plus timeout/OOM/PID/disk/file-size and interrupted-cleanup behavior.

Add the independent broker-owned sbx runner boundary, executable capability proof, config/schema surface, focused tests, and documentation. Keep support blocked until sbx can enforce every mandatory network and resource bound; never fall back to Docker or gVisor.

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

Copilot-Session: 1fb32473-f407-49e7-9d57-6331d80a8df6
Copilot AI review requested due to automatic review settings July 31, 2026 02:27
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit a4b7c80

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

Adds a fail-closed preview of an independent sbx backend for bounded-query execution.

Changes:

  • Extends configuration, validation, schemas, and documentation with runtime: "sbx".
  • Adds capability probing and broker-owned sbx runner infrastructure.
  • Blocks sbx assembly until mandatory isolation guarantees are available.
Show a summary per file
File Description
src/types/bounded-query-options.ts Adds the sbx runtime type.
src/services/bounded-query-service.ts Prevents unsupported sbx broker wiring.
src/services/bounded-query-service.test.ts Tests assembly rejection.
src/parsers/bounded-query-parser.test.ts Tests sbx normalization.
src/config-file.ts Exposes sbx configuration.
src/config-file-bounded-queries-validation.test.ts Tests configuration acceptance.
src/bounded-query/query-runner.test.ts Tests runner, probe, and cleanup contracts.
src/bounded-query/preflight.ts Adds host capability checks.
src/bounded-query/preflight.test.ts Tests fail-closed preflight behavior.
src/awf-config-schema.json Updates the runtime schema.
docs/sbx-integration.md Documents runtime independence.
docs/bounded-queries.md Documents preview limitations.
docs/awf-config.schema.json Updates the published schema.
docs/awf-config-spec.md Specifies sbx preflight requirements.
containers/bounded-query/Dockerfile Validates new broker modules.
containers/bounded-query/broker/sbx-query-runner.js Implements sbx lifecycle management.
containers/bounded-query/broker/sbx-query-runner-spec.js Defines trusted launch arguments.
containers/bounded-query/broker/sbx-client.js Adds bounded sbx CLI execution.
containers/bounded-query/broker/sbx-capability-probe.js Implements broker capability probing.
containers/bounded-query/broker/query-runner.js Selects the sbx runner.
containers/bounded-query/broker/config.js Accepts the sbx backend.

Review details

Tip

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

Suppressed comments (1)

containers/bounded-query/broker/sbx-query-runner-spec.js:37

  • hostWorkDir is specifically the Docker-daemon-visible path (config.js:122-124) and is translated with dockerHostPathPrefix during Compose assembly. Reusing it for sbx mounts couples the supposedly independent backend to Docker's filesystem namespace; in DinD/ARC setups it can point at a path such as /host/... that the sbx daemon cannot see, so every mount fails. Introduce an sbx-daemon-visible work path rather than deriving this launch vector from the Docker path.
  const hostInvocationDir = `${config.hostWorkDir}/${invocationId}`;
  • Files reviewed: 21/21 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread containers/bounded-query/broker/sbx-capability-probe.js
Comment thread containers/bounded-query/broker/sbx-query-runner-spec.js Outdated
Comment thread src/bounded-query/preflight.ts Outdated
lpcox added 2 commits July 30, 2026 21:19
Require authenticated daemon reachability, retain complete run identity during scoped reconciliation, and separate sbx daemon mount paths from Docker daemon paths.

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

Copilot-Session: 1fb32473-f407-49e7-9d57-6331d80a8df6
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

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

@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

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@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

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Docker Sbx reports failed. Our correspondents are investigating the incident...

@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 failed. Please review the logs for details.

@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

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@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

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Security Guard completed successfully!

Security review of PR #6764 complete. No security weakening detected. Changes add sbx bounded-query backend with proper capability probing, version auditing, input validation, and fail-closed isolation controls. All hard-isolation flags (--network=none, --pids-limit, --disk-limit, --ulimit-fsize, --mount-target) are enforced before execution. Environment sanitization prevents credential leakage. Backend validation is strict and explicit. No firewall rules, capabilities, or egress expansions affected. Approved to proceed.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@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 #6764 · haiku45 · 31.9 AIC · ⊞ 3.6K ·
Add label ready-for-aw to run again

@github-actions github-actions Bot added smoke-copilot-network-isolation Copilot network-isolation egress smoke test smoke-claude labels 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 — Network isolation egress enforcement working as expected.

cc @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 ✅

Test Results:

  • ✅ HTTP Connectivity (github.com): 200
  • ✅ File Write/Read: smoke-test-copilot-byok.txt
  • ✅ MCP Merged PRs: 2 recent by @lpcox verified
  • ✅ BYOK Inference Path: Working (agent → api-proxy → api.githubcopilot.com)

Status: PASS — Running in direct BYOK mode via COPILOT_PROVIDER_API_KEY

🔑 BYOK report filed by Smoke Copilot BYOK
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: FAILED — Node.js version differs between host and chroot environment. smoke-chroot label not applied since not all tests passed.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

Overall Status: FAIL

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

@github-actions

Copy link
Copy Markdown
Contributor

📡 Smoke Test: API Proxy OTel Tracing

Scenario Result
1. Module Loading otel.js loads, isEnabled() = true, exports 14 functions/classes (startRequestSpan, setTokenAttributes, endSpan, etc.)
2. Test Suite ✅ 59/59 tests passed (2 suites: otel.test.js, otel-fanout.test.js)
3. Env Var Forwarding ⚠️ Not found — src/services/api-proxy-service.ts (43 lines) does not yet forward OTEL_EXPORTER_OTLP_ENDPOINT/GITHUB_AW_OTEL_TRACE_ID to the api-proxy container (expected gap, pending implementation)
4. Token Tracker Integration onUsage callback present in token-tracker-http.js (OTEL hook point)
5. OTEL Diagnostics /tmp/gh-aw/otel.jsonl populated with 1 resourceSpans record for this workflow run (workflow-level tracing active)

Overall: 4/5 pass, 1 expected-pending. No unexpected regressions in OTEL tracing for the api-proxy sidecar.

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

@github-actions github-actions Bot mentioned this pull request Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

  • Redis PING: ❌ (Temporary failure in name resolution)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (could not translate host name)

Overall: FAILhost.docker.internal did not resolve from within the AWF sandbox.

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox
Smoke test results:
• GitHub MCP tool connectivity: ✅
• GitHub.com HTTP: ✅
• File write/read: ✅
• BYOK inference (Foundry via Entra): ✅
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)
Overall status: 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

🏗️ 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 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ 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 required -Dmaven.repo.local=/tmp/... override since ~/.m2/repository was not writable in this sandbox; all builds/tests otherwise ran unmodified through the AWF proxy.

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

@lpcox
lpcox merged commit 7346411 into lpcox-add-sbx-broker-ingress Jul 31, 2026
3 checks passed
@lpcox
lpcox deleted the lpcox-add-sbx-query-runner branch July 31, 2026 05:20
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.

2 participants