Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/workflows/build-props-lib-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Headless tests for the repo's dependency on GitHub.Copilot.SDK's MSBuild
# contract (tests/build_props/ci/CopilotSdkContract.Tests.ps1): the reviewed SDK
# version, and the CI-only CopilotSkipCliDownload default in Directory.Build.props.
# version, the CI-only CopilotSkipCliDownload default in Directory.Build.props, and
# the offline fallback in src/Reactor.Cli/CopilotRuntime.targets.
#
# This workflow exists because nothing else can catch that contract breaking. The
# ordinary matrix runs with the native CLI download already skipped, so it stays
Expand All @@ -19,6 +20,8 @@ on:
# A GitHub.Copilot.SDK version bump can change or drop the MSBuild contract
# Directory.Build.props depends on, and no other job would notice.
- 'Directory.Packages.props'
- 'src/Reactor.Cli/CopilotRuntime.targets'
- 'src/Reactor.Cli/Reactor.Cli.csproj'
- 'tests/build_props/ci/**'
- '.github/workflows/build-props-lib-tests.yml'
pull_request:
Expand All @@ -27,6 +30,8 @@ on:
# A GitHub.Copilot.SDK version bump can change or drop the MSBuild contract
# Directory.Build.props depends on, and no other job would notice.
- 'Directory.Packages.props'
- 'src/Reactor.Cli/CopilotRuntime.targets'
- 'src/Reactor.Cli/Reactor.Cli.csproj'
- 'tests/build_props/ci/**'
- '.github/workflows/build-props-lib-tests.yml'

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,15 @@ Conventions for contributors:

### Fixed

- `mur` builds from source without network access. When the Copilot runtime download
fails, the build skips it with warning `REACTORCLI001` instead of failing with `MSB3923`.
`mur loc translate` no longer needs the bundled runtime either, which the release builds
of `mur` never included: it uses the full path in `COPILOT_CLI_PATH` or a Copilot CLI
installed with `winget install GitHub.Copilot`. If it has no runtime, or the runtime
fails to start, it reports that once with how to fix it, instead of failing every batch.
`COPILOT_CLI_PATH` must now be a full path. `mur doctor` shows which runtime the command
uses (issue #1133).

- A pooled `TextBlock`, `Border`, `Grid`, `StackPanel`, `Image` or other non-Button control
no longer keeps the previous renter's `.WithFlyout(...)` flyout. On any control, including a
`Button`, dropping `.WithFlyout(...)` on an update now removes the flyout instead of leaving it
Expand All @@ -306,6 +315,7 @@ Conventions for contributors:
`.WithFlyout(element)`, with no code fix (`REACTOR_MOD_002` on a control the pool doesn't
recycle). Builds using `TreatWarningsAsErrors` may need to move those writes to
`.WithFlyout(...)` (issue #1753).

- `bootstrap.ps1` preserves the downloaded Copilot runtime's dot-files when packing
`mur`, instead of failing Release packaging with NU5119 (issue #1507).

Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ Keep credentials in your user NuGet config. The script never writes them to the
- Point the download at a mirror of the release files with the `CopilotCliReleaseBaseUrl` MSBuild property or the `COPILOT_CLI_DOWNLOAD_BASE_URL` environment variable.
- Use a binary you downloaded yourself with `CopilotCliBinaryPath`.

`CopilotSkipCliDownload=true` also gets the build going, but only to compile. It leaves out the native binary, and `mur loc translate` and the two Copilot SDK samples need that binary at run time. CI sets it because CI never runs those paths.
`src/Reactor.Cli` doesn't need either one to build. If it can't download the runtime, it skips it with warning `REACTORCLI001` (the `MSB3923` warning before it gives the reason) and builds anyway. All of `mur` works; `mur loc translate` then uses the full path in `COPILOT_CLI_PATH` or a Copilot CLI you install with `winget install GitHub.Copilot`, and `mur doctor` shows which one. Pass `-p:CopilotSkipCliDownload=false` to make a failed download an error again. `CopilotRuntimeProbeTimeoutSeconds` (default 30) bounds the check.

`CopilotSkipCliDownload=true` also gets the build going, but only to compile. It leaves out the native binary, so `mur loc translate` falls back the same way, and the two Copilot SDK samples need that binary or their own fallback at run time. CI sets it because CI never runs those paths.

### After `git pull`

Expand Down
18 changes: 12 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,24 @@

src/Reactor.Cli `mur loc translate` constructs
CopilotTranslationProvider (TranslateCommand.cs),
which does `new CopilotClient()` and StartAsync()
against the native binary.
which starts a CopilotClient against the native
binary.
samples/apps/widget-creator generation pipeline
samples/apps/demo-script-tool generation pipeline

Skipping the download locally therefore makes `mur loc translate` and both samples
fail at run time, with an error that points at the missing binary rather than at the
property that removed it. When the download itself is what is failing, redirect it
instead with the SDK's CopilotCliReleaseBaseUrl property (or the
Without the binary, `mur loc translate` falls back to COPILOT_CLI_PATH or an installed
Copilot CLI and otherwise fails with a message that says how to fix it
(Loc/CopilotRuntimeLocator.cs, issue #1133). widget-creator has a similar run-time
fallback; demo-script-tool has none, so skipping the download locally makes it fail at
run time with an error that points at the missing binary rather than at the property
that removed it. When the download itself is what is failing,
redirect it instead with the SDK's CopilotCliReleaseBaseUrl property (or the
COPILOT_CLI_DOWNLOAD_BASE_URL environment variable), or point CopilotCliBinaryPath
at a pre-downloaded binary. Anyone can still override CopilotSkipCliDownload
explicitly when they genuinely only need a compile.

src/Reactor.Cli builds even without that: src/Reactor.Cli/CopilotRuntime.targets skips
the download with warning REACTORCLI001 when the release host is unreachable.
-->
<PropertyGroup Condition="'$(CopilotSkipCliDownload)' == '' and '$(CI)' == 'true'">
<CopilotSkipCliDownload>true</CopilotSkipCliDownload>
Expand Down
14 changes: 14 additions & 0 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,20 @@ Invoke-ReactorWithRestoreEnvironment `
if ($cliPackExit -ne 0) { Fail 'dotnet pack failed for Reactor.Cli' }
Write-Ok "Packed Microsoft.UI.Reactor.Cli -> $feed"

# When the Copilot runtime download fails, the pack still succeeds with warning
# REACTORCLI001 (issue #1133). Say so here, where it can't scroll past unnoticed.
$cliPackage = Join-Path $feed "Microsoft.UI.Reactor.Cli.$cliLocalVersion.nupkg"
if (Test-Path -LiteralPath $cliPackage) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [IO.Compression.ZipFile]::OpenRead($cliPackage)
try { $hasRuntime = [bool]($zip.Entries.FullName -match '/runtimes/[^/]+/native/copilot\.exe$') } finally { $zip.Dispose() }
if (-not $hasRuntime) {
Write-Host ' [warn] mur was packed without the Copilot runtime (see REACTORCLI001 above).' -ForegroundColor Yellow
Write-Host ' `mur loc translate` will use COPILOT_CLI_PATH or an installed Copilot CLI' -ForegroundColor Yellow
Write-Host ' (winget install GitHub.Copilot); rerun bootstrap with network access to bundle it.' -ForegroundColor Yellow
}
}

# ---------------------------------------------------------------------------
# 3. Install / update the global tool
# ---------------------------------------------------------------------------
Expand Down
14 changes: 13 additions & 1 deletion docs/_pipeline/templates/mur-cli.md.dt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ You can also set it with the `COPILOT_MODEL` environment variable. Each
translation is marked as an AI draft that needs review. See
[Localization](localization.md) for the full workflow.

`mur loc translate` also needs the Copilot runtime. The `mur` in the release
skill kit doesn't include it, and neither does a `mur` you build from source
without network access. For those, install the Copilot CLI with
`winget install GitHub.Copilot`. The command looks for a runtime in this order:

1. The full path in `COPILOT_CLI_PATH`, if that variable is set.
2. The runtime bundled with `mur`.
3. A Copilot CLI installed with WinGet or by the GitHub CLI.

An installed CLI must be a version that works with the runtime `mur` was built
for. `mur doctor` shows which runtime the command uses.

## Help for AI agents

| Command | What it does |
Expand All @@ -166,7 +178,7 @@ with an error when you run them anywhere else.
| `mur pack-local` | Pack the framework from your working tree into `<repo>/local-nupkgs/`. Options: `--version` (default `0.0.0-local`), `--configuration` (default `Debug`). |
| `mur clean-local` | Remove the local packages, their NuGet cache entries, and old local templates. |
| `mur upgrade` | After `git pull`: pack the framework again, install the template pack if it is missing, and refresh the agent plugin and the Visual Studio extension. Options: `--skip-plugin`, `--skip-vs-extension`. |
| `mur doctor` | Check the .NET SDK, `mur`, the local packages, the template pack, and the agent plugin. Add `--verbose` for more detail. |
| `mur doctor` | Check the .NET SDK, `mur`, the local packages, the template pack, the Copilot runtime that `mur loc translate` uses, and the agent plugin. Add `--verbose` for more detail. |

`mur upgrade` does not update `mur` itself, because a running program can't
replace its own file. Run `./bootstrap.ps1` again for that.
Expand Down
14 changes: 13 additions & 1 deletion docs/guide/mur-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ You can also set it with the `COPILOT_MODEL` environment variable. Each
translation is marked as an AI draft that needs review. See
[Localization](localization.md) for the full workflow.

`mur loc translate` also needs the Copilot runtime. The `mur` in the release
skill kit doesn't include it, and neither does a `mur` you build from source
without network access. For those, install the Copilot CLI with
`winget install GitHub.Copilot`. The command looks for a runtime in this order:

1. The full path in `COPILOT_CLI_PATH`, if that variable is set.
2. The runtime bundled with `mur`.
3. A Copilot CLI installed with WinGet or by the GitHub CLI.

An installed CLI must be a version that works with the runtime `mur` was built
for. `mur doctor` shows which runtime the command uses.

## Help for AI agents

| Command | What it does |
Expand All @@ -156,7 +168,7 @@ with an error when you run them anywhere else.
| `mur pack-local` | Pack the framework from your working tree into `<repo>/local-nupkgs/`. Options: `--version` (default `0.0.0-local`), `--configuration` (default `Debug`). |
| `mur clean-local` | Remove the local packages, their NuGet cache entries, and old local templates. |
| `mur upgrade` | After `git pull`: pack the framework again, install the template pack if it is missing, and refresh the agent plugin and the Visual Studio extension. Options: `--skip-plugin`, `--skip-vs-extension`. |
| `mur doctor` | Check the .NET SDK, `mur`, the local packages, the template pack, and the agent plugin. Add `--verbose` for more detail. |
| `mur doctor` | Check the .NET SDK, `mur`, the local packages, the template pack, the Copilot runtime that `mur loc translate` uses, and the agent plugin. Add `--verbose` for more detail. |

`mur upgrade` does not update `mur` itself, because a running program can't
replace its own file. Run `./bootstrap.ps1` again for that.
Expand Down
10 changes: 5 additions & 5 deletions samples/apps/widget-creator/Services/CopilotSdkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ async Task<CopilotClient> GetClientAsync(CancellationToken ct)
{
if (_client is not null) return _client;
var options = new CopilotClientOptions();
// The SDK's default stdio transport looks ONLY for a CLI bundled next to
// the app (runtimes/<rid>/native/copilot.exe) and does not consult
// COPILOT_CLI_PATH. When the app was built without a bundled CLI (e.g.
// CopilotSkipCliDownload=true on a restricted network), resolve one at
// run time and pass it explicitly so generation still works.
// Without an explicit path the SDK uses COPILOT_CLI_PATH, then the CLI bundled next
// to the app (runtimes/<rid>/native). When the app was built without a bundled CLI (e.g.
// CopilotSkipCliDownload=true on a restricted network), resolve one at run time and
// pass it explicitly so generation still works. src/Reactor.Cli/Loc/CopilotRuntimeLocator.cs
// has its own copy of the install locations; keep the two in step.
var cliPath = ResolveCliPath();
if (cliPath is not null)
{
Expand Down
Loading
Loading