Enhance CLI build process and strong-name sign .NET SDK#4
Merged
Conversation
…ation (#1776) * fix(rust): backdate extracted CLI mtime to stop self-invalidation When `bundled-cli` is off, `build.rs` watches the extracted CLI binary via `cargo:rerun-if-changed` so a deleted cache binary forces a re-extract. On a cold cache the same build script *creates* that binary mid-build, after the download — so its mtime ends up newer than cargo's build-script `output` reference (stamped when the script was spawned). The next identical `cargo` invocation then sees the watched file as "changed", reruns build.rs, recompiles the SDK crate, and relinks every downstream crate (observed ~9 min of wasted CI on a second cargo invocation in the same job). Backdate the staged binary's mtime to the Unix epoch before the atomic rename (rename preserves mtime), so it lands unambiguously older than any real build reference and a no-change rebuild stays a true no-op. Best-effort: on error we emit a `cargo:warning` and continue, reverting to the prior redundant-rebuild behaviour rather than breaking the build. The deleted-file recovery contract is untouched — a missing file still can't be stat'd, so cargo still reruns. Embed mode (`bundled-cli` on) is unaffected: it emits no `rerun-if-changed` on any build-created file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor(rust): write staging binary through a single file handle Address review: open the staging file once and perform the write, permission-set, and mtime-backdate on one handle instead of reopening it for each step. Write and chmod failures stay fatal; the epoch backdate stays best-effort (warn and continue). Behavior is otherwise unchanged: the extracted binary still lands epoch-dated so a no-change rebuild is a true no-op. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the canonical .NET Open.snk key to strong-name sign the GitHub.Copilot.SDK assembly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This pull request introduces support for client-side interception of LLM inference requests in the .NET Copilot SDK, enabling advanced scenarios such as BYOK (Bring Your Own Key) or custom model routing. It also adds new polyfills for .NET Standard 2.0 compatibility and improves process cleanup logic. Additionally, comprehensive end-to-end tests are included for the new request interception feature.
LLM Inference Request Interception:
RequestHandlerproperty toCopilotClientOptions, allowing clients to intercept and handle all LLM inference HTTP/WebSocket requests via a customCopilotRequestHandlerimplementation. This enables scenarios like BYOK and custom model routing. [1] [2] [3] [4] [5]Process Cleanup and Runtime Shutdown:
.NET Standard 2.0 Polyfills:
DownlevelExtensions.csfor missing .NET Standard 2.0 APIs, includingEncoding.GetString(ReadOnlySpan<byte>), cancellableHttpContent.ReadAsStreamAsync, and WebSocket extensions for span-based send/receive methods and aValueWebSocketReceiveResultstruct. [1] [2]Testing:
CopilotRequestCancelErrorE2ETests) covering error and cancellation scenarios for custom LLM inference handlers, ensuring robust handling of thrown exceptions and runtime-initiated request cancellations.Assembly Signing:
GitHub.Copilot.SDKassembly by specifying anOpen.snkkey file and settingSignAssemblyto true.