Skip to content

Add devproxy installation script and update .gitignore#1647

Merged
pelikhan merged 8 commits into
devfrom
proxy-test
Jun 25, 2025
Merged

Add devproxy installation script and update .gitignore#1647
pelikhan merged 8 commits into
devfrom
proxy-test

Conversation

@pelikhan
Copy link
Copy Markdown
Member

Introduce a script for installing devproxy and update .gitignore to exclude related directories.

}
} catch(e) {
} catch (e) {
dbg(`failed to parse retry-after header as date: %s`, errorMessage(e));
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.

The function errorMessage(e) is used, but there is no import or definition for errorMessage in this file. This will cause a runtime error if errorMessage is not defined elsewhere in the scope.

AI-generated content by pr-review-commit undefined_identifier may be incorrect. Use reactions to eval.

const agent = new ProxyAgent(proxy);
agent.on(`connect`, (info) => dbg(`connect: %s`, info.href));
agent.on(`connectionError`, (err) => dbg(`connection error: %s`, err.toString()));
agent.on(`disconnect`, () => dbg(`disconnect`));
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.

The ProxyAgent from "undici" does not emit 'connect', 'connectionError', or 'disconnect' events. Attempting to attach event listeners to these events will have no effect and may cause confusion or runtime errors. Please refer to the "undici" documentation for supported events and usage.

AI-generated content by pr-review-commit undici_proxyagent_event_api may be incorrect. Use reactions to eval.

@github-actions
Copy link
Copy Markdown
Contributor

Caution

The ProxyAgent from "undici" does not emit 'connect', 'connectionError', or 'disconnect' events. Attempting to attach event listeners to these events will have no effect and may cause confusion or runtime errors if the API changes. Please remove these event listeners or use supported mechanisms for monitoring agent activity.
packages/core/src/proxy.ts#L39 undici_proxyagent_event

AI-generated content by pr-review-commit may be incorrect. Use reactions to eval.

// We enrich crossFetch with the proxy.
const crossFetchWithProxy: typeof fetch = agent
? (url, options) => crossFetch(url, { ...(options || {}), dispatcher: agent } as any)
? (url, options) => crossFetch(url, { ...options, agent } as RequestInit)
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.

The fetch agent is being set using the agent property in the options object, but cross-fetch does not support the agent property. This will have no effect and proxying will not work as intended.

Suggested change
? (url, options) => crossFetch(url, { ...options, agent } as RequestInit)
? (url, options) => crossFetch(url, { ...options, agent } as RequestInit)

AI-generated content by pr-review-commit incorrect_fetch_agent_option may be incorrect. Use reactions to eval.

const agent = new ProxyAgent(proxy);
agent.on(`connect`, (info) => dbg(`connect: %s`, info.href));
agent.on(`connectionError`, (err) => dbg(`connection error: %s`, err.toString()));
agent.on(`disconnect`, () => dbg(`disconnect`));
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.

The event listeners connect, connectionError, and disconnect are being attached to the undici ProxyAgent, but these are not standard events for undici's ProxyAgent and will not be triggered. This may cause confusion or missed debugging information.

Suggested change
agent.on(`disconnect`, () => dbg(`disconnect`));
agent.on(`connect`, (info) => dbg(`connect: %s`, info.href));

AI-generated content by pr-review-commit undici_proxyagent_event_names may be incorrect. Use reactions to eval.

const { HttpsProxyAgent } = await import("https-proxy-agent");
const agent = new HttpsProxyAgent(proxyUrl);
agent.on(`connect`, (info) => dbg(`connect: %s`, info.href));
agent.on(`error`, (err) => dbg(`error: %s`, err.toString()));
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.

The event listeners connect and error are being attached to the https-proxy-agent, but these are not standard events for this agent and will not be triggered. This may cause confusion or missed debugging information.

Suggested change
agent.on(`error`, (err) => dbg(`error: %s`, err.toString()));
agent.on(`connect`, (info) => dbg(`connect: %s`, info.href));

AI-generated content by pr-review-commit https_proxy_agent_event_names may be incorrect. Use reactions to eval.

@github-actions
Copy link
Copy Markdown
Contributor

Investigator report

Context collection

  • run id: 15882126649
  • failed job
  • last successful run not found

AI Analysis

The root cause of the failure is:

The TypeScript compiler (tsc) fails in the packages/vscode project because it cannot find dozens of types (e.g., DiagnosticSeverity, ChatTurnGenerationContext, WorkspaceFile, etc.) that are referenced from ../core/src/*.ts, and also several types referenced by files in packages/vscode/src/*.ts. This results in more than 100 "Cannot find name ''" errors.

The commonality across all these errors is that types used from the ../core package are not available during typechecking in the vscode package—likely due to incorrect TypeScript project references, missing type declarations/exports, or an incomplete intermediate build/output.

Responsible code

Here are representative errors and sample code ranges affected:

In packages/vscode build (tsc -p .):

../core/src/annotations.ts(51,31): error TS2304: Cannot find name 'DiagnosticSeverity'.

// Excerpt (packages/core/src/annotations.ts)
function someFunction() {
    let severity: DiagnosticSeverity; // <-- Not found
}

In packages/vscode/src/state.ts:

src/state.ts(42,15): error TS2304: Cannot find name 'PromptParameters'.
// Example usage:
let params: PromptParameters; // <-- Not found

In packages/vscode/src/docsnotebook.ts:

src/docsnotebook.ts(63,10): error TS2304: Cannot find name 'PromptParameters'.
// Example usage:
(params: PromptParameters) => { ... }

Analysis

  • All missing types are types expected to be imported (directly or indirectly) from @genaiscript/core.
  • tsc -p . is running from the packages/vscode folder, and it is referencing files in ../core/src, but type declarations/types from core are missing/not visible.
  • This hints at a likely incorrect TypeScript project structure: either missing "composite": true and declaration in core/tsconfig.json, missing/incorrectly built .d.ts files, or lack of "references" between packages so tsc isn't building core before vscode.

What is responsible:

  • packages/vscode depends on types from @genaiscript/core, but the type declarations/types are not being generated or referenced correctly.
  • If core is not built or does not emit type declarations, or vscode does not reference core as a project reference, all of its types are missing.

Potential Fix

  • Ensure @genaiscript/core has "composite": true, "declaration": true, and outputs declaration files.
  • Add a "references": [{ "path": "../core" }] in packages/vscode/tsconfig.json.
  • Make sure build scripts first build core before vscode, or use pnpm's built-in workspace functionality with tsc -b (pnpm build --filter core... or similar).
  • If types are not correctly exported in @genaiscript/core, re-export them.

Example Fix (diff):

Add project reference in tsconfig.json for vscode:

File packages/vscode/tsconfig.json:

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "references": [
    { "path": "../core" }
  ],
  "include": ["src/**/*.ts"]
}

Ensure composite and declaration is enabled in core:

File packages/core/tsconfig.json:

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "composite": true,
    "declaration": true,
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "include": ["src/**/*.ts"]
}

Summary

The build failure is due to unresolved type references in packages/vscode to types from packages/core. This is almost always caused by missing/incomplete TypeScript project references and absence of declaration file generation in the dependency (core). Declare project references, set composite and declaration, and ensure core is built before vscode. No actual code in the src files needs to change; this is entirely a TypeScript and build configuration issue.

AI-generated content by gai may be incorrect. Use reactions to eval.

@pelikhan pelikhan merged commit c7a8184 into dev Jun 25, 2025
7 of 11 checks passed
@pelikhan pelikhan deleted the proxy-test branch June 25, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant