Skip to content

fix(cli-plugin-copilot): narrow JsonValue before reading tool-call arg properties - #5338

Merged
odinr merged 1 commit into
mainfrom
fix/copilot-plugin-jsonvalue-narrowing
Aug 19, 2026
Merged

fix(cli-plugin-copilot): narrow JsonValue before reading tool-call arg properties#5338
odinr merged 1 commit into
mainfrom
fix/copilot-plugin-jsonvalue-narrowing

Conversation

@odinr

@odinr odinr commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

main's "Check Code" CI is currently failing the build step:

src/commands/app/attach-session-logger.ts(72,30): error TS2339: Property 'url' does not exist on type 'string | number | boolean | JsonValue[] | { [key: string]: JsonValue; }'.

A recent @github/copilot-sdk bump (now 1.0.11 installed alongside an older 1.0.9 in the lockfile) tightened the type of tool.execution_start's arguments field to JsonValue — a union that also includes primitives and arrays. Reading .url/.path/.load/.selector directly off that union no longer type-checks.

Fix

Added a small type guard (firstStringProp) that narrows JsonValue to its object branch before reading known keys, replacing the unchecked args?.url ?? args?.path ?? ... chain in attach-session-logger.ts.

Validation

  • pnpm --filter @equinor/fusion-framework-cli-plugin-copilot build — passes (previously failed with the TS2339 errors above).
  • pnpm exec biome check packages/cli-plugins/copilot/src/commands/app/attach-session-logger.ts — clean.
  • Added a patch changeset for @equinor/fusion-framework-cli-plugin-copilot.

@odinr
odinr requested a review from a team as a code owner August 19, 2026 14:54
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2da39f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@equinor/fusion-framework-cli-plugin-copilot Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the 🐞 bug Something isn't working label Aug 19, 2026
@odinr
odinr force-pushed the fix/copilot-plugin-jsonvalue-narrowing branch 2 times, most recently from e78747a to f62a9bb Compare August 19, 2026 14:56
…g properties

@github/copilot-sdk's tool-call arguments are typed JsonValue (a union
including primitives/arrays), so accessing .url/.path/.load/.selector
directly no longer type-checks and was breaking the build on main.
@odinr
odinr force-pushed the fix/copilot-plugin-jsonvalue-narrowing branch from f62a9bb to 2da39f9 Compare August 19, 2026 15:39
@odinr
odinr merged commit ba6e8bb into main Aug 19, 2026
6 checks passed
@odinr
odinr deleted the fix/copilot-plugin-jsonvalue-narrowing branch August 19, 2026 15:39
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.37% 4052 / 6014
🔵 Statements 67.09% 4821 / 7185
🔵 Functions 53.7% 1385 / 2579
🔵 Branches 55.95% 2137 / 3819
File CoverageNo changed files found.
Generated in workflow #15475 for commit 2da39f9 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant