Skip to content

Upstream sync: session.setModel() and built-in tool override support#162

Merged
brunoborges merged 3 commits intomainfrom
copilot/sync-upstream-repo-again
Mar 3, 2026
Merged

Upstream sync: session.setModel() and built-in tool override support#162
brunoborges merged 3 commits intomainfrom
copilot/sync-upstream-repo-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Ports two features from upstream github/copilot-sdk (bd98e3a, f843c80). Commits dcd86c1/51baa25/b380a82/7460798 are release/changelog automation — not ported.

CopilotSession.setModel(String) — mid-session model switching

Calls session.model.switchTo RPC. Conversation history is preserved; new model takes effect on the next message.

session.setModel("gpt-4.1").get();
// next sendAndWait() uses gpt-4.1

ToolDefinition — override built-in CLI tools

New overridesBuiltInTool field (JSON: omitted when null) and createOverride() factory. Signals to the CLI that a name collision with a built-in tool (e.g. grep, read_file) is intentional. Existing create() is backward-compatible.

var customGrep = ToolDefinition.createOverride("grep", "Project-aware search", schema, handler);

Tests & docs

  • E2E test for built-in tool override using upstream snapshot tools/overrides_built_in_tool_with_custom_tool.yaml
  • Closed-session guard test for setModel()
  • Documentation in advanced.md for both features
  • .lastmerge updated to dcd86c1

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/working/files-to-index3919231755423702167.list --sourceArchiveDir=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/src --outputDir=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/trap/java which ot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot h which va/copilot-sdk-j--show-toplevel ot-sdk/test/harness/node_modules/@github/copilot-linux-x64/copilot curl�� modules/tsx/dist/loader.mjs which 0/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/sh .0.18-8/x64/bin/git which ava/target/copild78db830cbbf576f5e92ea5fc556c619a01461a0:src/test/java/com/github/copilot/sdk/ClosedSessionGuardTest.java node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[upstream-sync] Upstream sync: 6 new commits (2026-03-03)</issue_title>
<issue_description>The upstream github/copilot-sdk has 6 new commits since the last sync.

Commit Range

New Commits (most recent first)

  • dcd86c1 Add changelog for v0.1.30 (#642)
  • 51baa25 Improve changelog agent: prerelease support, formatting fixes, publish trigger (#641)
  • b380a82 Improve changelog agent output formatting (#640)
  • 7460798 Add release changelog agentic workflow (#638)
  • f843c80 Support overriding built-in tools (#636)
  • bd98e3a Add session.setModel() for mid-session model switching (#621)

Action Required

Please follow the agentic-merge-upstream prompt to port these changes into the Java SDK.

When done, create a Pull Request with the label upstream-sync.

Generated by Weekly Upstream Sync Agentic Workflow

  • expires on Mar 9, 2026, 5:50 PM UTC

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot AI changed the title [WIP] Synchronize with upstream repository for new commits Upstream sync: session.setModel() and built-in tool override support Mar 3, 2026
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@brunoborges brunoborges marked this pull request as ready for review March 3, 2026 18:27
@brunoborges brunoborges requested a review from edburns as a code owner March 3, 2026 18:27
@brunoborges brunoborges merged commit 558df64 into main Mar 3, 2026
6 checks passed
brunoborges added a commit that referenced this pull request Mar 3, 2026
…ntation-for-new-methods

Document missing PR #162 CopilotSession APIs in advanced guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upstream-sync] Upstream sync: 6 new commits (2026-03-03)

3 participants