Skip to content

refactor(api-proxy): split wire API compatibility into focused modules - #11947

Merged
lpcox merged 6 commits into
mainfrom
copilot/refactor-split-wire-api-compat
Nov 22, 2026
Merged

lpcox merged 6 commits into
mainfrom
copilot/refactor-split-wire-api-compat

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

The 791-line compatibility module combines request translation, response/usage mapping, and SSE state machines. This separates those concerns without changing protocol behavior or caller imports.

  • Module boundaries: Extract shared helpers, request translation, response/usage translation, and SSE transforms. Keep a 32-line facade with identical public and _testing exports.
  • Packaging and integrity: Include the new directory in the proxy image. Extend SHA-256 integrity checks to all extracted modules and refresh the contract digest.
  • Compatibility contracts: Preserve the strict diagnostics projection; add facade identity, fragmented SSE, and per-module drift coverage.

@lpcox lpcox changed the title [WIP] Refactor wire-api-compat.js into focused modules refactor(api-proxy): split wire API compatibility into focused modules Nov 22, 2026
@lpcox
lpcox marked this pull request as ready for review November 22, 2026 17:23
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 17:23

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

Extracted translator modules are missing from smoke-test triggers and diagnostics fingerprints, allowing changes to skip live coverage and stale dependency pins to pass validation.

2 open issues
What changed in this PR

Refactors the API proxy’s Chat Completions/Responses compatibility layer into focused modules while preserving existing caller imports and exports.

Changes:

  • Separates shared helpers, request translation, response/usage mapping, and streaming transforms behind the existing facade.
  • Packages the extracted modules and extends integrity checks to their dependency pins.
  • Adds coverage for export identity, fragmented streams, implementation drift, immutable types, and diagnostics projection.
File Description
docs/​api-proxy-sidecar.md Documents module boundaries and dependency pins.
containers/​api-proxy/​wire-api/​sse-transforms.js Extracts streaming translation and event framing.
containers/​api-proxy/​wire-api/​shared.js Extracts shared errors, validation, and endpoint helpers.
containers/​api-proxy/​wire-api/​response-translation.js Extracts response and usage mapping.
containers/​api-proxy/​wire-api/​request-translation.js Extracts request translation and endpoint selection.
containers/​api-proxy/​wire-api-compat.test.js Adds facade and streaming compatibility coverage.
containers/​api-proxy/​wire-api-compat.js Replaces the combined implementation with re-exports.
containers/​api-proxy/​protocol-compatibility/​index.js Pins the facade and extracted implementations.
containers/​api-proxy/​protocol-compatibility/​index.d.ts Declares immutable dependency pins.
containers/​api-proxy/​protocol-compatibility/​assessment.js Checks dependency integrity and refreshes the contract digest.
containers/​api-proxy/​protocol-compatibility.test.js Verifies hashes for all pinned modules.
containers/​api-proxy/​protocol-compatibility.packaging.test.js Verifies extracted modules are packaged.
containers/​api-proxy/​protocol-compatibility-assessment.test.js Adds per-module drift rejection coverage.
containers/​api-proxy/​model-decision-observation.test.js Verifies the existing strict diagnostics projection.
containers/​api-proxy/​fixtures/​protocol-compatibility/​contract-types.ts Checks dependency-pin immutability.
containers/​api-proxy/​Dockerfile Includes the new module directory in the image.

Review effort: Max (adaptive)

Comment on lines +20 to +21
sha256: 'db7121abee27b8e453b1b7c4833fcb95c36523670d1829e7a9fb5805790bbff9',
dependencies: Object.freeze([
} = require('./wire-api/shared');
const {
translateCopilotWireApi, translateChatRequest, translateResponsesRequest,
} = require('./wire-api/request-translation');
@lpcox

lpcox commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in commit 4d3332e: diagnostics now fingerprint and validate extracted translator dependency pins, and the Model Routing workflow watches wire-api/**.

@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 Nov 22, 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-11947 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 2d538c9

@lpcox

lpcox commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

@github-actions

github-actions Bot commented Nov 22, 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 94.59% 94.59% ➡️ +0.00%
Statements 93.26% 93.25% 📉 -0.01%
Functions 93.74% 93.74% ➡️ +0.00%
Branches 87.62% 87.61% 📉 -0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/nvx/one-shot-process.ts 84.0% → 81.5% (-2.47%) 76.8% → 74.7% (-2.11%)
src/commands/main-action-cleanup.ts 96.9% → 97.9% (+1.03%) 97.0% → 98.0% (+0.99%)

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

Copilot AI commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/45050435469/job/137295117687?pr=11947

Fixed in 512f490: the diagnostics schema now declares the conditional property so strict AJV compilation succeeds. Local tests were blocked because the npm registry could not resolve (ENOTFOUND); JSON and diff checks passed.

@lpcox

lpcox commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts

…t-wire-api-compat

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts

Merged main without conflicts in commit 17363a3 and published the two-parent merge commit.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Smoke OTel Tracing

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Smoke Copilot Network Isolation

Outcome: incomplete

The agent failed after emitting a no-op output. Task completion is unconfirmed; the no-op does not establish success or a transient failure.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🛡️ Egress verdict from Smoke Copilot Network Isolation

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #11947 · claude · haiku45 · ~36 AIC · ⊞ 6.4K · ◷

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

Smoke Codex

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Security Guard completed successfully!

Security Guard

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Security Guard for #11947 · copilot · routed: gpt61 high · ~7 AIC · ⊞ 3.4K · ◷

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Build Test Suite

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Warning

Firewall blocked 1 domain

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

  • 169.254.169.254

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

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Generated by Build Test Suite for #11947 · copilot · routed: haiku55 xhigh · ~4 AIC · ⊞ 6.1K · ◷

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Smoke Chroot

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Nov 22, 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

Copy link
Copy Markdown
Contributor

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Smoke Test: Copilot BYOK (Direct Mode) ✅ PASS

Test Result
GitHub MCP Connectivity ✅
GitHub.com HTTP (200) ✅
File Write/Read ✅
BYOK Inference (api-proxy → api.githubcopilot.com) ✅

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Claude Results

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

Overall result: PASS

Generated by Smoke Claude for #11947 · claude · haiku45 · ~36 AIC · ⊞ 6.4K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Cloud Hypervisor + Copilot smoke test

  1. Merged PR lookup: PASS
  2. github.com connectivity: PASS (HTTP 200)
  3. File write/read: PASS
  4. example.com blocked: PASS (HTTP 000)

Overall: PASS

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor
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.16 Python 3.12.16 ✅ YES
Node.js v24.22.3 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ALL_TESTS_PASSED=false. Python and Go match, but Node.js differs between host (v24) and chroot (v22). The smoke-chroot label was not added.

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

@github-actions

Copy link
Copy Markdown
Contributor

OTel tracing smoke results

  • ✅ Scenario 1, module load: otel.js loads. isEnabled() is true via the file-exporter fallback.
  • ❌ Scenario 2, test suite: --testPathPattern is rejected by Jest 30, and || true hides it, so no OTEL tests run in CI. With --testPathPatterns, 75/75 pass across 3 suites.
  • ✅ Scenario 3, env forwarding: all 6 required vars are present in env-passthrough.ts and api-proxy-env-config.ts.
  • ✅ Scenario 4, token tracker: the onUsage hook is present in token-tracker-http.js.
  • ❌ Scenario 5, diagnostics: the post-step path logs/api-proxy/ does not match api-proxy-logs/, so span export cannot be confirmed.

Filed a tracking issue for the two failures with a proposed fix.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine

Overall: PASS

cc @lpcox (author), assignees: @lpcox, @Copilot

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

@github-actions

Copy link
Copy Markdown
Contributor

Merged PRs: Recompile workflows with gh-aw v1.3.1; Split Cloud Hypervisor diagnostics into focused modules
PR details: ✅
Playwright: ❌
File write/read: ✅
Discussion comment: ✅
Build AWF: ✅
Overall: FAIL

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

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Services smoke test: ✅ Redis PONG · ✅ pg_isready accepting connections · ✅ SELECT 1 → 1. PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia ✅ 1/1 passed ✅ PASS
Bun hono ✅ 1/1 passed ✅ PASS
C++ fmt ✅ (cmake + make) N/A ✅ PASS
C++ json ✅ (cmake + make) N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world ✅ (restore + build + run) N/A ✅ PASS
.NET json-parse ✅ (restore + build + run) N/A ✅ PASS
Go color ✅ 1/1 passed ✅ PASS
Go env ✅ 1/1 passed ✅ PASS
Go uuid ✅ 1/1 passed ✅ PASS
Java gson ✅ (compile) 1/1 passed ✅ PASS
Java caffeine ✅ (compile) 1/1 passed ✅ PASS
Node.js clsx ✅ script passed ("All tests passed!") ✅ PASS
Node.js execa ✅ script passed ("All tests passed!") ✅ PASS
Node.js p-limit ✅ script passed ("All tests passed!") ✅ PASS
Rust fd ✅ 1/1 passed ✅ PASS
Rust zoxide ✅ 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Environment workarounds (no failures in the projects themselves):

  • .NET: NuGet first-run failed because /run/user/1001 does not exist; set XDG_RUNTIME_DIR to a temp directory.
  • Java: ~/.m2 is root-owned, so Maven used a temp -Dmaven.repo.local. The JDK cacerts symlink is dangling, so Maven's JVM used a truststore built from the system CA bundle. TLS verification stayed enabled. The existing ~/.m2/settings.xml proxy config was used as-is.
  • Bun and Deno were installed with their official install scripts (Bun 1.4.5, Deno 2.9.8).

Warning

Firewall blocked 1 domain

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

  • 169.254.169.254

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

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Generated by Build Test Suite for #11947 · copilot · routed: haiku55 xhigh · ~4 AIC · ⊞ 6.1K · ◷
Add label ready-for-aw to run again

@lpcox
lpcox merged commit f69c8dd into main Nov 22, 2026
139 of 141 checks passed
@lpcox
lpcox deleted the copilot/refactor-split-wire-api-compat branch November 22, 2026 19:44
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.

[Refactoring] Split containers/api-proxy/wire-api-compat.js into focused modules

3 participants