Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lastmerge
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e20f5bef125860accb30c60d1b35109371a77f16
25b15be86c443c776bc2ab057c698a2ef0b67f35
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
reference-impl-sync workflow and deal with the subsequent
PR.
-->
<readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>^1.0.48</readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>
<readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>^1.0.49-1</readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>

</properties>

Expand Down
56 changes: 28 additions & 28 deletions scripts/codegen/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"generate:java": "tsx java.ts"
},
"dependencies": {
"@github/copilot": "^1.0.48",
"@github/copilot": "^1.0.49-1",
"json-schema": "^0.4.0",
"tsx": "^4.20.6"
}
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/com/github/copilot/sdk/json/CustomAgentConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class CustomAgentConfig {
@JsonProperty("skills")
private List<String> skills;

@JsonProperty("model")
private String model;

/**
* Gets the unique identifier name for this agent.
*
Expand Down Expand Up @@ -255,4 +258,29 @@ public CustomAgentConfig setSkills(List<String> skills) {
this.skills = skills;
return this;
}

/**
* Gets the model identifier for this agent.
*
* @return the model identifier (e.g., "claude-haiku-4.5"), or {@code null} if
* not set
*/
public String getModel() {
return model;
}

/**
* Sets the model identifier for this agent.
* <p>
* When set, the runtime will attempt to use this model for the agent, falling
* back to the parent session model if unavailable.
*
* @param model
* the model identifier (e.g., "claude-haiku-4.5")
* @return this config for method chaining
*/
public CustomAgentConfig setModel(String model) {
this.model = model;
return this;
}
}
14 changes: 14 additions & 0 deletions src/test/java/com/github/copilot/sdk/PermissionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ void testDenyPermission(TestInfo testInfo) throws Exception {
try (CopilotClient client = ctx.createClient()) {
CopilotSession session = client.createSession(config).get();

// Regression check for https://github.com/github/copilot-sdk/issues/1194:
// the reject decision must round-trip through the CLI with its discriminator
// intact so the agent surfaces the user-rejected error to the model.
final boolean[] userRejectedToolCall = {false};
session.on(ToolExecutionCompleteEvent.class, evt -> {
if (!evt.getData().success() && evt.getData().error() != null && evt.getData().error().message() != null
&& evt.getData().error().message().toLowerCase().contains("user rejected")) {
userRejectedToolCall[0] = true;
}
});

String originalContent = "protected content";
Path testFile = ctx.getWorkDir().resolve("protected.txt");
Files.writeString(testFile, originalContent);
Expand All @@ -120,6 +131,9 @@ void testDenyPermission(TestInfo testInfo) throws Exception {
new MessageOptions().setPrompt("Edit protected.txt and replace 'protected' with 'hacked'."))
.get(60, TimeUnit.SECONDS);

assertTrue(userRejectedToolCall[0],
"Expected a tool.execution_complete event whose error indicates the user rejected the call.");

// Verify the file was NOT modified
String content = Files.readString(testFile);
assertEquals(originalContent, content, "File should not have been modified");
Expand Down
Loading