fix(cli-plugin-copilot): narrow JsonValue before reading tool-call arg properties - #5338
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 2da39f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
odinr
force-pushed
the
fix/copilot-plugin-jsonvalue-narrowing
branch
2 times, most recently
from
August 19, 2026 14:56
e78747a to
f62a9bb
Compare
…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
force-pushed
the
fix/copilot-plugin-jsonvalue-narrowing
branch
from
August 19, 2026 15:39
f62a9bb to
2da39f9
Compare
Contributor
Coverage Report
File CoverageNo changed files found. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
main's "Check Code" CI is currently failing the build step:A recent
@github/copilot-sdkbump (now1.0.11installed alongside an older1.0.9in the lockfile) tightened the type oftool.execution_start'sargumentsfield toJsonValue— a union that also includes primitives and arrays. Reading.url/.path/.load/.selectordirectly off that union no longer type-checks.Fix
Added a small type guard (
firstStringProp) that narrowsJsonValueto its object branch before reading known keys, replacing the uncheckedargs?.url ?? args?.path ?? ...chain inattach-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.@equinor/fusion-framework-cli-plugin-copilot.