Skip to content

refactor: split bounded query runners - #6762

Merged
lpcox merged 3 commits into
mainfrom
lpcox-refactor-query-runners
Jul 31, 2026
Merged

refactor: split bounded query runners#6762
lpcox merged 3 commits into
mainfrom
lpcox-refactor-query-runners

Conversation

@lpcox

@lpcox lpcox commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Layer 2 of the bounded-query multi-sandbox work, built directly on layer 1 (#6758 / 10885c9d).

  • add a broker-internal QueryRunner contract with explicit DockerQueryRunner and GvisorQueryRunner backends
  • centralize immutable, trusted derivation of query image, entrypoint, mounts, network, seccomp, user, limits, labels, environment, timeout, and cleanup filters
  • select docker versus gvisor from normalized AWF configuration; only the gVisor backend emits --runtime runsc, and missing/unknown runtimes fail closed without fallback
  • create a uniquely named container for every invocation and reconcile abandoned containers only through run/invocation labels
  • serialize invocation cleanup with interruption reconciliation and preserve the layer-1 private-state/agent-ingress boundary
  • keep sbx transport and sbx query execution out of scope

Validation

  • 110 focused bounded-query unit tests pass
  • bounded-query isolation integration test passes
  • TypeScript build and type-check pass
  • ESLint passes with existing warnings only
  • full unit suite: 4,848 pass; 2 existing macOS /var/tmp versus /private/var/tmp path-assumption tests fail outside this diff

Introduce trusted Docker and gVisor QueryRunner backends with centralized launch derivation and label-scoped lifecycle reconciliation.

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

Copilot-Session: 7cf71cc5-3209-47c7-8743-f903cbe4eff1
Copilot AI review requested due to automatic review settings July 31, 2026 01:27
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 99.14% 99.17% 📈 +0.03%
Statements 99.05% 99.08% 📈 +0.03%
Functions 99.29% 99.29% ➡️ +0.00%
Branches 95.85% 95.87% 📈 +0.02%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

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.

🟡 Not ready to approve

Shutdown can race with request admission and leave a query container unreconciled.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Refactors bounded-query execution into trusted Docker and gVisor runner backends with centralized sandbox specification and lifecycle cleanup.

Changes:

  • Adds backend-specific query runners and immutable launch specifications.
  • Adds label-based cleanup and shutdown reconciliation.
  • Propagates normalized backend configuration and expands tests.
File summaries
File Description
tests/integration/bounded-query-isolation.test.ts Uses the Docker backend configuration.
src/services/bounded-query-service.ts Passes the normalized backend to the broker.
src/services/bounded-query-service.test.ts Tests backend environment mapping.
src/bounded-query/query-runner.test.ts Covers runner selection, specs, and cleanup.
src/bounded-query/end-to-end.test.ts Updates end-to-end configuration.
src/bounded-query/broker.test.ts Updates broker and launch-argument tests.
containers/bounded-query/Dockerfile Validates new broker modules.
containers/bounded-query/broker/server.js Creates runners and reconciles shutdown state.
containers/bounded-query/broker/query-runner.js Defines and selects runner backends.
containers/bounded-query/broker/query-runner-spec.js Derives trusted container specifications.
containers/bounded-query/broker/gvisor-query-runner.js Implements fixed-runsc execution.
containers/bounded-query/broker/docker-query-runner.js Implements Docker execution and cleanup.
containers/bounded-query/broker/docker-client.js Encapsulates bounded Docker CLI calls.
containers/bounded-query/broker/config.js Loads and validates backend selection.
containers/bounded-query/broker/broker.js Requires an injected runner and exposes draining.
Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +141 to +145
await Promise.race([
broker.drain(),
new Promise((resolve) => setTimeout(resolve, SHUTDOWN_GRACE_MS)),
]);
await runner.reconcileRun(runId);
@lpcox

lpcox commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in 97166cb.

Copilot finished work on behalf of lpcox July 31, 2026 02:24
@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.

@lpcox
lpcox enabled auto-merge (squash) July 31, 2026 02:25
@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 BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK reports failed. BYOK mode investigation needed...

@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

Smoke Gemini reports failed. Facets need polishing...

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@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 failed Smoke Chroot failed - See logs for details.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — Service connectivity failed ⚠️

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation reports failed while checking network isolation. Investigate the egress model.

@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

📰 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

Build Test Failed Build Test Suite - See logs for details

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing reports failed. OTel tracing regression detected. ⚠️

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR #6762 follows the contribution guidelines in CONTRIBUTING.md: the description is clear and references prior work (#6758 / 10885c9), new functionality is covered by focused unit and integration tests, and new files are placed under the expected src/ and containers/ directories. No review comment needed.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@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

📡 Smoke OTel Tracing reports failed. OTel tracing regression detected. ⚠️

@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 added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Copilot Network Isolation Smoke Test (@lpcox)

EGRESS_RESULT allow=pass deny=pass

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

Overall status: PASS

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: Claude Engine Validation

Overall result: PASS

Check Status
API ✅ PASS
GH CLI ✅ PASS
File ✅ PASS

Event: pull_request

Generated by Smoke Claude for #6762 · haiku45 · 54.9 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 for host.docker.internal)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (DNS resolution failure)

Overall: FAIL — host.docker.internal could not be resolved 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 PR data: ✅
  • GitHub.com connectivity: ✅
  • File I/O: ✅
  • BYOK inference: ✅

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

Overall: 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 Results (@lpcox)

  • ✅ GitHub MCP connectivity (list_pull_requests)
  • ✅ GitHub.com connectivity (HTTP 200)
  • ✅ File write/read test

Recent merged PRs:

Overall: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Merged PRs:

  • fix: isolate bounded-query private state from agent mounts
  • Fix bounded query smoke workflow run

Checks:

  • GitHub reads: ✅
  • GitHub title check: ✅
  • File write/read: ✅
  • Build AWF: ❌

Overall status: 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) ✅ PASS

Test Results:

  • ✅ GitHub MCP: Connected (pre-fetched PR data verified)
  • ✅ GitHub.com: HTTP 200 (connectivity OK)
  • ✅ File Write/Read: /tmp/gh-aw/agent/smoke-test-copilot-byok.txt exists
  • ✅ BYOK Inference: Direct BYOK mode active (agent → api-proxy → api.githubcopilot.com)

Mode: Running via COPILOT_PROVIDER_API_KEY with api-proxy sidecar injection.

cc/ @lpcox

🔑 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

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 mismatch between host and chroot environments. smoke-chroot label not applied since not all tests passed.

Tested by Smoke Chroot
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

🏗️ 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 passed ✅ PASS
Go env passed ✅ PASS
Go uuid 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 overriding Maven's local repository path (-Dmaven.repo.local) since the default ~/.m2/repository was not writable in this environment; this is an environment/permissions detail unrelated to network firewall behavior.

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

@lpcox
lpcox merged commit 473b255 into main Jul 31, 2026
132 of 137 checks passed
@lpcox
lpcox deleted the lpcox-refactor-query-runners branch July 31, 2026 03:12
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

Overall status: FAIL

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

3 participants