fix: resolve TypeScript errors in js workflow check#25004
fix: resolve TypeScript errors in js workflow check#25004lpcox merged 1 commit intocopilot/add-cli-proxy-feature-flagfrom
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d97ec115-fca7-468f-8455-80e276a712cf Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Resolves TypeScript (// @ts-check) failures in the js workflow by aligning JSDoc annotations with actual values returned/passed by the safe-output handlers.
Changes:
- Broadened JSDoc types to correctly model
null/undefinedand optional fields returned by handlers. - Fixed a deferred return shape in
assign_to_agent.cjsto include the requiredsuccessfield, and ensured repo validation errors are always strings. - Removed
@octokit/rest-based JSDoc references increate_pull_request.cjsto avoid relying on a non-dev dependency.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/pr_helpers.cjs | Updates JSDoc to accept null for configuredBaseBranch, matching callers. |
| actions/setup/js/create_pull_request.cjs | Replaces @octokit/rest JSDoc types with looser types to eliminate TS errors. |
| actions/setup/js/create_agent_session.cjs | Extends handler return-type JSDoc to include skipped?: boolean. |
| actions/setup/js/assign_to_agent.cjs | Adjusts deferred result to include success, and narrows repo-validation error to a string. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 1
| * @param {object} githubClient - Authenticated GitHub client | ||
| * @param {{owner: string, repo: string}} repoParts - Repository owner and name | ||
| * @param {string} title - Issue title | ||
| * @param {string} body - Issue body | ||
| * @param {string[]} labels - Issue labels | ||
| * @param {string[] | null} assignees - Sanitized assignees (null = omit field) | ||
| * @returns {Promise<import('@octokit/rest').Octokit['rest']['issues']['create'] extends (...args: any[]) => Promise<infer R> ? R : never>} | ||
| * @returns {Promise<any>} |
There was a problem hiding this comment.
The JSDoc change to @param {object} githubClient and especially @returns {Promise<any>} removes most of the type-checking value from // @ts-check for this helper. Since this module already has /// <reference types="@actions/github-script" /> and the client comes from createAuthenticatedGitHubClient() (which returns the github-script github or getOctokit() from @actions/github), you can keep strong typing without depending on @octokit/rest by using a type from @actions/github-script/@actions/github (e.g., typing githubClient as import("@actions/github-script").AsyncFunctionArguments["github"] and deriving the return type from githubClient.rest.issues.create).
See below for a potential fix:
* @param {import("@actions/github-script").AsyncFunctionArguments["github"]} githubClient - Authenticated GitHub client
* @param {{owner: string, repo: string}} repoParts - Repository owner and name
* @param {string} title - Issue title
* @param {string} body - Issue body
* @param {string[]} labels - Issue labels
* @param {string[] | null} assignees - Sanitized assignees (null = omit field)
* @returns {ReturnType<import("@actions/github-script").AsyncFunctionArguments["github"]["rest"]["issues"]["create"]>}
…ll v0.25.14) (#24997) * Initial plan * feat: bump default AWF firewall version to v0.25.14 Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2e432b55-8a31-4eb8-ab16-7602b03acea2 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * feat: add cli-proxy and cli-proxy-writable feature flags with AWF command injection Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2e432b55-8a31-4eb8-ab16-7602b03acea2 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * feat: add awfSupportsCliProxy version gate to prevent failures on older AWF versions Agent-Logs-Url: https://github.com/github/gh-aw/sessions/180bd43e-792e-4d72-b6b0-137eacfdd829 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * fix: update wasm golden files for v0.25.14 and new actions permission (#25003) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/45d7425a-e55e-4a76-8049-e58cad7ee0d6 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * fix: resolve TypeScript errors in js workflow check (#25004) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d97ec115-fca7-468f-8455-80e276a712cf Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * ci: remove stale js-qmd-index job whose test file was deleted (#25005) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7417d3b0-97d5-4b8f-baf1-dff3635cd5d2 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * fix: update assign_to_agent tests to use handler factory pattern (#25008) * fix: restore backward compat in assign_to_agent.cjs for standalone tests The main() function was refactored to a handler factory pattern but tests still use the old standalone interface (env vars + direct item processing). Add standalone mode detection when main() is called with no config: - Reads config from env vars (GH_AW_AGENT_DEFAULT, GH_AW_AGENT_MAX_COUNT, etc.) - Processes all assign_to_agent items from GH_AW_AGENT_OUTPUT - Writes summary, sets outputs, calls setFailed on errors Also fix the "Ignore-if-error mode enabled" log message to match tests. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e00f51ce-33dd-493d-ba64-e13e1ebeb1be Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * fix: address code review feedback on standalone mode detection Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e00f51ce-33dd-493d-ba64-e13e1ebeb1be Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * Update; rm -rf / Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * fix: update assign_to_agent tests to use handler factory pattern Replace `await main()` standalone calls in test evals with a STANDALONE_RUNNER snippet that simulates the safe-output handler manager flow: - build config from env vars - call main(config) to get the handler function - process assign_to_agent items through the handler - write summary, set outputs, call setFailed on errors Also fix the "encounters auth errors" assertion to match the production log message. No changes to assign_to_agent.cjs production code. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d92459b5-9e9b-40ad-a0c6-108c70f23622 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixes 6 TypeScript errors that were causing the
jsCI job to fail (check run #70179089953).Root causes & fixes
pr_helpers.cjsconfiguredBaseBranchasstring|undefinedbut callers passstring|nullstring|null|undefinedassign_to_agent.cjs{ deferred: true }missing requiredsuccessfieldsuccess: falseto the objectassign_to_agent.cjsvalidateRepoerror isstring|nullbut_allResults/ return type expectsstring?? "Repository validation failed"to narrow tostringcreate_agent_session.cjsskipped?: booleanbut code returns{ success: true, skipped: true }skipped?: booleanto JSDoccreate_pull_request.cjs@octokit/rest(not a dev dependency) in two JSDoc annotationsobject/anyAll changes are limited to JSDoc type annotations and one minor literal fix — no runtime logic is altered.