-
Notifications
You must be signed in to change notification settings - Fork 3k
ci(advisor): run PR Review Advisor in OpenShell #7600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cjagwani
wants to merge
13
commits into
main
Choose a base branch
from
codex/pr-advisor-openshell
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,649
−553
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
65e814f
ci(advisor): run PR advisor in OpenShell
cjagwani e18dac7
fix(advisor): configure OpenShell proxy transport
cjagwani 792f1cf
test(advisor): keep proxy failures observable
cjagwani e293f0a
test(advisor): keep OpenShell tests linear
cjagwani ac4154d
fix(advisor): avoid context file races
cjagwani 8f9c52f
fix(advisor): harden context reads and diagnostics
cjagwani ac95efa
test(advisor): gate FIFO portability
cjagwani 7e321f1
fix(advisor): bind CodeQL disposition to sink
cjagwani 52dcfd2
fix(advisor): enforce runtime input immutability
prekshivyas 5327f5f
fix(advisor): bind immutable sandbox inputs
cjagwani 8fa580d
fix(advisor): trust mounted Git metadata
cjagwani 82e56aa
test(advisor): isolate Git ownership simulation
cjagwani e97aabb
merge(main): refresh PR #7600
prekshivyas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,7 @@ | |
| "tsx": "^4.21.0", | ||
| "typebox": "1.1.38", | ||
| "typescript": "6.0.3", | ||
| "undici": "8.5.0", | ||
| "vitest": "^4.1.9" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { type ChildProcess, spawn } from "node:child_process"; | ||
| import { once } from "node:events"; | ||
| import http from "node:http"; | ||
| import type { AddressInfo } from "node:net"; | ||
|
|
||
| import { afterEach, describe, expect, it } from "vitest"; | ||
|
|
||
| const servers: http.Server[] = []; | ||
| const children: ChildProcess[] = []; | ||
|
|
||
| afterEach(async () => { | ||
| for (const child of children.splice(0)) { | ||
| child.kill("SIGKILL"); | ||
| } | ||
| await Promise.all( | ||
| servers.splice(0).map( | ||
| (server) => | ||
| new Promise<void>((resolve, reject) => { | ||
| server.closeAllConnections(); | ||
| server.close((error) => (error ? reject(error) : resolve())); | ||
| }), | ||
| ), | ||
| ); | ||
| }); | ||
|
|
||
| describe("advisor HTTP dispatcher", () => { | ||
| it("routes embedded SDK fetch through the environment proxy", async () => { | ||
| const connectTargets: string[] = []; | ||
| const proxy = http.createServer(); | ||
| proxy.on("connect", (request, socket) => { | ||
| connectTargets.push(request.url ?? ""); | ||
| socket.end("HTTP/1.1 502 Bad Gateway\r\nConnection: close\r\n\r\n"); | ||
| }); | ||
| proxy.listen(0, "127.0.0.1"); | ||
| await once(proxy, "listening"); | ||
| servers.push(proxy); | ||
| const address = proxy.address() as AddressInfo; | ||
|
|
||
| const moduleUrl = new URL("../tools/advisors/http-dispatcher.mts", import.meta.url).href; | ||
| const script = ` | ||
| import { getGlobalDispatcher } from "undici"; | ||
| import { configureAdvisorHttpDispatcher } from ${JSON.stringify(moduleUrl)}; | ||
| const originalFetch = globalThis.fetch; | ||
| configureAdvisorHttpDispatcher(); | ||
| if (globalThis.fetch === originalFetch) { | ||
| throw new Error("advisor transport did not install npm Undici fetch"); | ||
| } | ||
| let fetchRejected = false; | ||
| try { | ||
| await fetch("https://advisor-transport.invalid/v1"); | ||
| } catch { | ||
| fetchRejected = true; | ||
| } | ||
| if (!fetchRejected) { | ||
| throw new Error("advisor transport swallowed a failed fetch"); | ||
| } | ||
| getGlobalDispatcher().emit("error", new Error("unpaired-dispatcher-failure")); | ||
| `; | ||
| const child = spawn( | ||
| process.execPath, | ||
| ["--experimental-strip-types", "--no-warnings", "--input-type=module", "--eval", script], | ||
| { | ||
| env: { | ||
| ...process.env, | ||
| HTTP_PROXY: `http://127.0.0.1:${address.port}`, | ||
| HTTPS_PROXY: `http://127.0.0.1:${address.port}`, | ||
| ALL_PROXY: "", | ||
| NO_PROXY: "", | ||
| NODE_USE_ENV_PROXY: "", | ||
| all_proxy: "", | ||
| http_proxy: `http://127.0.0.1:${address.port}`, | ||
| https_proxy: `http://127.0.0.1:${address.port}`, | ||
| no_proxy: "", | ||
| }, | ||
| stdio: ["ignore", "pipe", "pipe"], | ||
| }, | ||
| ); | ||
| children.push(child); | ||
| const stderr: Buffer[] = []; | ||
| child.stderr?.on("data", (chunk: Buffer) => stderr.push(chunk)); | ||
| const timeout = setTimeout(() => child.kill("SIGKILL"), 3_000); | ||
| timeout.unref(); | ||
| const [exitCode] = (await once(child, "exit")) as [number | null]; | ||
| clearTimeout(timeout); | ||
|
|
||
| expect(exitCode, Buffer.concat(stderr).toString("utf8")).toBe(0); | ||
| expect(connectTargets).toContain("advisor-transport.invalid:443"); | ||
| expect(Buffer.concat(stderr).toString("utf8")).toContain( | ||
| "Advisor HTTP dispatcher error: Error: unpaired-dispatcher-failure", | ||
| ); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.