Repository navigation
feat(copilot): SDK session options, skill tracking and image selection - #210
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 77.22% 77.48% +0.25%
==========================================
Files 47 47
Lines 3219 3256 +37
==========================================
+ Hits 2486 2523 +37
Misses 733 733
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Let CopilotBot use a repository's agent skills and run on any sandbox image: - session_options: extra kwargs forwarded to CopilotClient.create_session (skill_directories, custom_agents, mcp_servers, working_directory, ...). Keys are validated against the installed SDK; model, provider, streaming, hooks and system_message stay managed by CopilotBot. run() accepts per-run overrides. Only option names are logged. - invoked_skills: names of skills used in the last run (skill.invoked events); skill load/invoke events are logged. - image: container image of the auto-created environment. copilot-cli's Node.js 22 is installed for the distro read from /etc/os-release (NodeSource on Debian, checksum-verified nodejs.org build on Azure Linux, which only packages Node 20; Debian's steps when the distro is unknown; unsupported distros fail before running). - Integration test: the agent upgrades util-linux in an Azure Linux checkout using its AGENTS.md and azldev-* skills (READ_ONLY by default, AZURELINUX_KEEP_CHANGES=1 to keep the changes). - Docs: session options and Azure Linux skills example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> # Conflicts: # docs/advanced/bots/copilot-bot.md # src/microbots/bot/CopilotBot.py # test/bot/test_copilot_bot.py
Review follow-up: CopilotBot had its own per-distro Node.js/copilot-cli install table and matching logic, duplicating the distro-aware tool command resolution (#205). Move it into the normal tool model: - New tool_definitions/copilot-cli.yaml: Node.js 22 per distro (NodeSource on Debian; checksum-verified nodejs.org build on Azure Linux, which only packages Node 20) and the pinned @github/copilot@1.0.39 CLI, verified with `copilot --version`. It has no usage instructions, since it is infrastructure rather than a tool for the model. - CopilotBot._install_copilot_cli() installs and verifies that tool; _NODE_INSTALL_COMMANDS, _COPILOT_CLI_PACKAGE and _node_install_commands are removed. Unsupported distros now raise UnsupportedDistroError, and an undetectable distro falls back to the first (Debian) entry. - The headless server start, token injection and readiness check stay in CopilotBot; the host-side SDK stays the `ghcp` pip extra. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bala (0xba1a)
force-pushed
the
bala/copilot-skills
branch
from
November 2, 2026 11:01
d10632c to
a07968b
Compare
…to 1.0.105 github-copilot-sdk 1.x pins the copilot-cli release it targets (CLI_VERSION in copilot/_cli_version.py); 1.0.28 targets 1.0.105. The 0.3.0 / 1.0.39 pair is incompatible with either newer half (0.3.0 cannot parse 1.0.105 responses; 1.0.39 lacks the 1.x `connect` RPC). - Connect with CopilotClient(connection=UriRuntimeConnection(...)), which replaces ExternalServerConfig. - Import PermissionHandler from copilot.session only and SessionEventType from the public copilot.session_events module; a pre-1.x SDK now fails with an explicit upgrade message. - Cross-reference the two pins in pyproject.toml and copilot-cli.yaml, let the ghcp CI job install the `ghcp` extra instead of repeating the pin, and add test_copilot_version_pins.py to check the pins (and, under `ghcp`, that the installed SDK targets the pinned CLI). - Replace the pre-0.3.0 SDK-layout tests with 1.x import/connection tests. - Make the session-options test independent of COPILOT_BYOK_MODEL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
copilot-cli 1.0.105 picks request settings (temperature, reasoning_effort, prompts, token limits) from the model name. For a BYOK deployment with a custom name, such as CI's Azure `mini-swe-agent-gpt5`, it falls back to generic defaults and sends temperature 0, which GPT-5 rejects. - New `model_id` parameter and COPILOT_BYOK_MODEL_ID env var, mapped to the SDK's provider `model_id`; the deployment name is kept as `wire_model`. - ghcp CI job: use the Responses wire API and COPILOT_BYOK_MODEL_ID=gpt-5. - Docs and unit tests for the new option. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Kavya Sree Kaitepalli (KavyaSree2610)
approved these changes
Nov 2, 2026
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.
Summary
Let CopilotBot use a repository's agent skills and run on any sandbox image. The motivating case is the Azure Linux repository: it ships
AGENTS.mdandazldev-*skills under.agents/skills, and with this PR CopilotBot can follow them to upgrade a component end to end.Changes
session_options: extra keyword arguments forwarded to the Copilot SDK'sCopilotClient.create_session, for exampleskill_directories,disabled_skills,custom_agents,mcp_serversorworking_directory.create_sessionsignature; unknown keys raiseValueError.model,provider,streaming,hooksandsystem_messagestay managed by CopilotBot and are rejected.run(session_options=...)overrides them for one run without changing the bot's defaults.invoked_skills: after a run, lists the skills the agent used, taken from the SDK'sskill.invokedevents. Skill load and invoke events are also logged.image: the container image of the sandbox CopilotBot creates, for exampleAZURELINUX_IMAGE. Passing bothimageandenvironmentraisesValueError.tool_definitions/copilot-cli.yaml, using the normal distro-aware tool model (feat(tools): distro-aware tool commands #205) instead of install code inside CopilotBot.SHASUMS256.txt.@github/copilot@1.0.105, verified withcopilot --version. It must match the CLI that the pinnedgithub-copilot-sdktargets; see below.UnsupportedDistroErrorbefore anything runs.additional_tooland adds nothing to the model's prompt.microbots[ghcp]pip extra.CLI_VERSIONincopilot/_cli_version.py). The old and new halves don't mix: SDK 0.3.0 can't parse CLI 1.0.105 responses, and CLI 1.0.39 lacks theconnectRPC that SDK 1.x calls.CopilotClient(connection=UriRuntimeConnection(...)), which replacesExternalServerConfig, and importsSessionEventTypefrom the publiccopilot.session_events. An SDK older than 1.x now fails with an explicit upgrade message, and thecopilot.typesfallback for SDKs before 0.3.0 is gone.pyproject.toml(ghcpextra) andcopilot-cli.yamleach carry a comment to update the other. The ghcp CI job installs theghcpextra instead of repeating the version.test/bot/test_copilot_version_pins.pyverifies both pins are exact. Under theghcpmarker, it also verifies the installed SDK matches the pin and targets the pinned CLI version.model_idfor BYOK deployments with custom names: new parameter andCOPILOT_BYOK_MODEL_IDenv var, mapped to the SDK's providermodel_id; the deployment name stays the wire model.temperatureandreasoning_effortfrom the model name. For CI's Azure deploymentmini-swe-agent-gpt5, it fell back to generic defaults and senttemperature: 0, which GPT-5 rejects.COPILOT_BYOK_MODEL_ID=gpt-5.wire_api="responses"alone fixes it, and so doesmodel_idalone. With CI's settings, allghcptests pass.Testing
invoked_skillstracking, reset on each run.imageforwarding and rejection together withenvironment;copilot-cli.yamlresolution per distro (Node install, pinned CLI, no usage instructions);_install_copilot_clidriving the tool, and rejecting unsupported distros.UriRuntimeConnectionto the container IP and CLI port; a pre-1.x SDK is rejected), a fullrun()through the 1.x session API, and the version-pin tests.model_id: provider config in each BYOK path (explicit credentials, env vars, token provider) and through the constructor; unset by default.main, including under-n autoas CI runs them. The session-options test that failed occasionally before was depending onCOPILOT_BYOK_MODELin the environment; it no longer does.main.copilot-cli.yamlworks on both stock images (DEBIAN_IMAGE,AZURELINUX_IMAGE) with Node 22. With SDK 1.0.28 and CLI 1.0.105, the liveghcpCopilotBot task on Debian passes.test/bot/test_copilot_bot_azurelinux_skills.py(markedintegration,slow,ghcp).READ_ONLYonAZURELINUX_IMAGEwithsudo_access=True, installsrpm/mock/azldev(feat(tools): rpm, mock and azldev tool definitions #209), and points the session at the checkout's.agents/skills.util-linux.gpt-5.6-sol: passed with SDK 1.0.28 and CLI 1.0.105 in about 12 minutes (and before the upgrade, with 0.3.0 and 1.0.39). The agent used theazldev,azldev-comp-tomlandazldev-update-componentskills, upgradedutil-linuxfrom 2.41.5 to 2.42.4 inside the sandbox, never ransudo, and left the host checkout unchanged.gpt-5.6-solneedsCOPILOT_BYOK_WIRE_API=responses. Over the defaultcompletionsAPI, the CLI now sendsreasoning_efforttogether with function tools, and the endpoint rejects that combination.AZURELINUX_KEEP_CHANGES=1to mount the checkoutREAD_WRITEand keep the agent's changes.Stack
imageon the bots.sudofor the sandbox agent.rpm/mock/azldevtool definitions.