Skip to content

Recover Copilot endpoint incompatibilities without losing subagent tools - #9559

Merged
lpcox merged 5 commits into
mainfrom
copilot/make-copilot-wire-api-routing-compatible
Oct 7, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/make-copilot-wire-api-routing-compatible

Conversation

Copilot AI commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Copilot subagent requests could fail after successful egress because the selected model rejected the wire API or translation could not preserve custom tools.

  • Endpoint recovery

    • Retry endpoint-rejection errors once on the other wire API using the same model.
    • Attempt recovery before configured model fallback, including when endpoint metadata is missing or stale.
    • Reframe retry bodies, force identity encoding, and map responses back to the client’s API.
  • Feature preservation

    • Keep native custom-tool requests unchanged when the endpoint is supported.
    • Return actionable HTTP 400 errors when translation cannot preserve features; never drop tools or invent a replacement model.
    • Handle nullable response formats and contain unexpected recovery errors.
  • Coverage and documentation

    • Add regressions for endpoint rejection, custom-tool compatibility, bounded retries, and explicit fallback.
    • Document recovery behavior and custom-tool limits.

Copilot AI and others added 2 commits October 7, 2026 17:37
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Copilot wire-API routing for subagent tool requests Recover Copilot endpoint incompatibilities without losing subagent tools Oct 7, 2026
Copilot AI requested a review from lpcox October 7, 2026 17:44
@lpcox
lpcox marked this pull request as ready for review October 7, 2026 17:57
Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:57

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

Pre-translated requests cannot recover when stale metadata selects the wrong endpoint.

1 open finding
What changed in this PR

Adds Copilot wire-API recovery while preserving request features and explicit fallback behavior.

Changes:

  • Retries endpoint incompatibilities using the alternate API.
  • Rejects lossy custom-tool translations with actionable errors.
  • Adds regression coverage and documentation.
File Description
docs/​api-proxy-sidecar.md Documents recovery and custom-tool limits.
containers/​api-proxy/​wire-api-compat.js Extends safe translation handling.
containers/​api-proxy/​wire-api-compat.test.js Tests custom-tool compatibility.
containers/​api-proxy/​upstream-retry.js Prioritizes endpoint recovery.
containers/​api-proxy/​upstream-retry.test.js Tests retry ordering and errors.
containers/​api-proxy/​upstream-response.js Connects recovery to response handling.
containers/​api-proxy/​upstream-http.js Dispatches alternate-endpoint retries.
containers/​api-proxy/​server.model-not-supported.test.js Tests end-to-end recovery behavior.
containers/​api-proxy/​server.model-fallback-chain.test.js Updates fallback-chain expectations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread containers/api-proxy/upstream-http.js Outdated
Comment on lines +265 to +266
if (provider !== 'copilot' || !wireApiSourceBody ||
(wireApiCompatibility && !wireApiCompatibility.passthrough)) return false;
@lpcox

lpcox commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Fixed in c69d834: recovery now uses the rejected upstream endpoint, retries the original client endpoint with the preserved body and passthrough metadata when appropriate, and is bounded to one attempt.

@lpcox
lpcox enabled auto-merge (squash) October 7, 2026 20:00
@github-actions

github-actions Bot commented Oct 7, 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-9559 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit f6e8832

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 93.00% 93.00% ➡️ +0.00%
Statements 91.49% 91.49% ➡️ +0.00%
Functions 90.20% 90.20% ➡️ +0.00%
Branches 85.26% 85.25% 📉 -0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/nvx/one-shot-adapter.ts 83.5% → 82.9% (-0.60%) 80.3% → 79.8% (-0.56%)
src/log-directory-setup.ts 96.8% → 100.0% (+3.18%) 96.9% → 100.0% (+3.13%)

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🪪 Smoke Copilot BYOK AOAI (Entra) is testing Azure OpenAI BYOK (Entra / GitHub OIDC) mode on this pull request...

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot BYOK is testing direct BYOK mode on this pull request...

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot BYOK AOAI (api-key) is testing Azure OpenAI BYOK (api-key) mode on this pull request...

@github-actions

github-actions Bot commented Oct 7, 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 Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Generated by Build Test Suite for #9559

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

💎 Smoke Gemini is crystallizing results on this pull request...

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #9559

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request...

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🪪 Smoke Copilot BYOK AOAI (Entra) is testing Azure OpenAI BYOK (Entra / GitHub OIDC) mode on this pull request...

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Generated by Build Test Suite for #9559

@github-actions

github-actions Bot commented Oct 7, 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 Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #9559

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot BYOK AOAI (api-key) is testing Azure OpenAI BYOK (api-key) mode on this pull request...

@lpcox
lpcox enabled auto-merge (squash) October 7, 2026 21:27
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Cloud Hypervisor + Copilot

All checks passed.

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Services smoke test: PASS

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

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot: PASS ✅

  • ✅ GitHub MCP (latest PR: "fix: validate pinned NVX release on hosted KVM")
  • ✅ github.com connectivity (HTTP 200)
  • ✅ File write/read

PR: "Recover Copilot endpoint incompatibilities without losing subagent tools"
Author: @Copilot · Assignees: @lpcox @Copilot

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude Results

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

Overall result: PASS

Generated by Smoke Claude for #9559 · claude · haiku45 · 45.4 AIC · ⊞ 6.1K · ◷
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

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

Result: Not all tests passed (Node.js version mismatch), so the smoke-chroot label was not added.

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

  • ✅ Allowed domain (api.github.com): HTTP 200
  • ✅ Blocked domain (example.com): blocked (curl failed with a TLS cert error)

Overall: PASS — cc @lpcox

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct Mode) ✅

Test Result
GitHub MCP connectivity ✅
github.com (HTTP 200) ✅
File write/read ✅
BYOK inference (agent → api-proxy → api.githubcopilot.com) ✅

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar

Overall Status: ✅ PASS

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Smoke OTEL tracing

  • ✅ S1 Module loads; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, etc.
  • ✅ S2 Tests: 3 suites, 68/68 passed
  • ✅ S3 Env forwarding: trace/parent span IDs in env-passthrough.ts; OTLP vars in api-proxy-env-config.ts
  • ✅ S4 onUsage hook present in token-tracker-http.js
  • ✅ S5 Diagnostics: /tmp/gh-aw/otel.jsonl present (1 line); spans were not independently verified

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia ❌ N/A ❌ FAIL (Bun install blocked by sandbox permission)
Bun hono ❌ N/A ❌ FAIL (same)
C++ fmt ✅ N/A ✅ PASS
C++ json ✅ N/A ✅ PASS
Deno oak ❌ N/A ❌ FAIL (Deno install blocked by sandbox permission)
Deno std ❌ N/A ❌ FAIL (same)
.NET hello-world ✅ N/A ✅ PASS
.NET json-parse ✅ N/A ✅ PASS
Go color ✅ pass ✅ PASS
Go env ✅ pass ✅ PASS
Go uuid ✅ pass ✅ PASS
Java gson ❌ N/A ❌ FAIL (Could not create local repository at /home/runner/.m2/repository)
Java caffeine ❌ N/A ❌ FAIL (same)
Node.js clsx ✅ all passed ✅ PASS
Node.js execa ✅ all passed ✅ PASS
Node.js p-limit ✅ all passed ✅ PASS
Rust fd ✅ 1/1 passed ✅ PASS
Rust zoxide ✅ 1/1 passed ✅ PASS

Overall: 5/8 ecosystems passed — FAIL

Failures: Bun and Deno could not run because the curl | bash installers were denied by the sandbox. Java failed because Maven could not create its local repository (~/.m2/repository) in this environment. No firewall-related errors were observed. All 8 clones succeeded.

Generated by Build Test Suite for #9559 · copilot · auto · 22.1 AIC · ⊞ 11.9K · ◷
Add label ready-for-aw to run again

This branch had an error being deployed

1 failed deployment
aoai-model — 0359b7c0 Deployed Oct 7, 2026 by lpcox via Conclusion #1906
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 Copilot wire-API routing compatible with subagent tool requests

3 participants