Skip to content

Commit 162030b

Browse files
Copilotedburns
andauthored
Fix version drift between pom.xml and scripts/codegen/package.json
The sync-codegen-version.sh script used `npm install` which normalizes semver ranges, stripping prerelease suffixes (e.g. ^1.0.43-0 → ^1.0.43). Fix by writing the version directly into package.json before running npm install, matching how sync-cli-version-from-reference-impl.sh updates pom.xml. Also fix CapiProxy inconsistent state: defer proxyUrl assignment until after metadata parsing succeeds. Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/243ea08c-366e-4ac4-bdb6-939a59a1e755 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent 33c3635 commit 162030b

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

.github/scripts/reference-impl-sync/sync-codegen-version.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,17 @@ if [[ ! -f "$CODEGEN_PKG" ]]; then
6363
fi
6464

6565
# Update scripts/codegen/package.json with the new version and regenerate the lock file.
66-
# Intentionally omit --save-exact to preserve the version specifier used by the reference
67-
# implementation (e.g. a caret range like '^1.0.36-0' rather than an exact pin '1.0.36-0').
66+
# Write the version string directly into package.json to preserve the exact specifier
67+
# used by the reference implementation (e.g. '^1.0.43-0'). npm install normalises
68+
# caret ranges and would silently strip the prerelease suffix, causing a mismatch
69+
# with pom.xml.
6870
echo "▸ Updating scripts/codegen/package.json: @github/copilot → ${CLI_VERSION}"
6971
cd "$CODEGEN_DIR"
70-
npm install "@github/copilot@${CLI_VERSION}"
72+
node -e "
73+
const fs = require('fs');
74+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
75+
pkg.dependencies['@github/copilot'] = process.argv[1];
76+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
77+
" "$CLI_VERSION"
78+
npm install
7179
echo "▸ Updated scripts/codegen to @github/copilot@${CLI_VERSION}"

scripts/codegen/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"generate:java": "tsx java.ts"
88
},
99
"dependencies": {
10-
"@github/copilot": "^1.0.43",
10+
"@github/copilot": "^1.0.43-0",
1111
"json-schema": "^0.4.0",
1212
"tsx": "^4.20.6"
1313
}

src/test/java/com/github/copilot/sdk/CapiProxy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public String start() throws IOException, InterruptedException {
139139
throw new IOException("Unexpected proxy output: " + line);
140140
}
141141

142-
proxyUrl = matcher.group(1);
142+
String url = matcher.group(1);
143143

144144
// Parse optional metadata (CONNECT proxy details)
145145
String metadata = matcher.group(2);
@@ -155,6 +155,8 @@ public String start() throws IOException, InterruptedException {
155155
}
156156
}
157157

158+
// Only set proxyUrl after all parsing succeeds to avoid inconsistent state
159+
proxyUrl = url;
158160
return proxyUrl;
159161
}
160162

0 commit comments

Comments
 (0)