From addf4429ff07b7dfa4a832a92a90860bfdfc6895 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 09:14:59 -0400 Subject: [PATCH 01/18] Add workflow issue triage 6787 (#11) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add backward compatibility support for constructor accessibility on abstract base types (#9484) ## Problem Regenerating SDKs from TypeSpec (previously from autorest) changes constructor accessibility on abstract base types, breaking existing code. Example from Azure.Search.Documents: **Previous (autorest):** ```csharp public abstract partial class SearchIndexerDataIdentity { public SearchIndexerDataIdentity() { } } ``` **Current (TypeSpec without fix):** ```csharp public abstract partial class SearchIndexerDataIdentity { private protected SearchIndexerDataIdentity(string odataType) { } // Constructor is private protected instead of public } ``` ## Changes ### Core Implementation - **TypeProvider.ProcessTypeForBackCompatibility**: Extended to process constructors in addition to methods - **TypeProvider.BuildConstructorsForBackCompatibility**: New virtual method for constructor backward compatibility logic - **ModelProvider.BuildConstructorsForBackCompatibility**: Changes constructor modifiers from `private protected` to `public` on abstract base types when the last contract had a public constructor with matching parameters ### Approach This implementation changes the accessibility modifier on existing constructors rather than generating new ones. It only applies when: 1. The type is an abstract base type 2. The last contract had a public constructor 3. The current version generates a `private protected` constructor with matching parameters (same count, types, and names) ### Generated Code ```csharp public abstract partial class SearchIndexerDataIdentity { /// Initializes a new instance of SearchIndexerDataIdentity. public SearchIndexerDataIdentity(string odataType) { OdataType = odataType; } } ``` ## Testing - Added `BackCompat_AbstractTypeConstructorAccessibility` test that verifies constructor modifiers change from `private protected` to `public` - All 1231 tests pass - Updated documentation with new "Model Constructors" section
Original prompt ---- *This section details on the original issue you should resolve* [Bug]: Backward Compatibility not generating pre-existing public constructors ### Describe the bug Pre-existing public constructors should not be missing from the generated code. This should be another Back Compat scenario. See [Backward Compatibility Support](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/docs/backward-compatibility.md) for more details. Generating Azure.Search.Documents have the issue where a public constructor is missing, for instance, this is what the previously generated code from autorest looks like: ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // #nullable disable using System; using System.Collections.Generic; namespace Azure.Search.Documents.Indexes.Models { /// /// Abstract base type for data identities. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// public abstract partial class SearchIndexerDataIdentity { /// /// Keeps track of any properties unknown to the library. /// /// To assign an object to the value of this property use . /// /// /// To assign an already formatted json string to this property use . /// /// /// Examples: /// /// /// BinaryData.FromObjectAsJson("foo") /// Creates a payload of "foo". /// /// /// BinaryData.FromString("\"foo\"") /// Creates a payload of "foo". /// /// /// BinaryData.FromObjectAsJson(new { key = "value" }) /// Creates a payload of { "key": "value" }. /// /// /// BinaryData.FromString("{\"key\": \"value\"}") /// Creates a payload of { "key": "value" }. /// /// /// /// private protected IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . public SearchIndexerDataIdentity() { } /// Initializes a new instance of . /// A URI fragment specifying the type of identity. /// Keeps track of any properties unknown to the library. internal SearchIndexerDataIdentity(string oDataType, IDictionary serializedAdditionalRawData) { ODataType = oDataType; _serializedAdditionalRawData = serializedAdditionalRawData; } /// A URI fragment specifying the type of identity. internal string ODataType { get; set; } } } ``` and the new generated model looks like: ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // #nullable disable using System; using System.Collections.Generic; namespace Azure.Search.Documents.Models { /// /// Abstract base type for data identities. /// Please note this is the abstract base class. The derived classes available for instantiation are: and . /// public abstract partial class SearchIndexerDataIdentity { /// Keeps track of any properties unknown to the library. private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// A URI fragment specifying the type of identity. private protected SearchIndexerDataIdentity(string odataType) { OdataType = odataType; } /// Initializes a new instance of . ...
- Fixes microsoft/typespec#9483 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JonathanCrd <17486462+JonathanCrd@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov * Remove unused `program` param from `isArrayModelType` and `isRecordModelType` (#9336) ## Summary Added overloads to `isArrayModelType` and `isRecordModelType` that don't require the unused program parameter. The old signature is deprecated but still works for backward compatibility. ## Usage ```javascript // New (preferred) isArrayModelType(type) isRecordModelType(type) // Old (deprecated, still works) isArrayModelType(program, type) isRecordModelType(program, type) ``` * Input Type Updates for Xml Serialization Support (#9489) Adds updates to the input types in preparation for adding xml serialization support. contributes to : https://github.com/microsoft/typespec/issues/5645 * [python] correctly deserialize xml errors (#9488) Co-authored-by: iscai-msft * [specs] add xml error response test (#9499) Co-authored-by: iscai-msft * Api Version Parameter Reinjection (#9493) This pull request improves how API version parameters are handled, specifically ensuring that API version query parameters are correctly reinjected during pagination scenarios. It also adds a test to validate this behavior. **Pagination and Parameter Reinjection Improvements:** * Added logic to ensure API version parameters (those marked as `IsApiVersion`) are preserved and reinjected across pagination requests in the `GetReinjectedParametersMap` method of `RestClientProvider`. * Updated the `ShouldSkipReinjectedParameter` method to skip both `maxpagesize` and `api-version` parameters when determining which parameters to reinject, preventing unnecessary reinjection of these special parameters. * Defined a constant for the API version parameter name (`ApiVersionParameterName`) to improve maintainability and clarity. **Testing Enhancements:** * Added a new unit test, `TestApiVersionParameterReinjectedInCreateNextRequestMethod`, to verify that the generated client code correctly reinjects the `api-version` parameter during pagination. Solves: https://github.com/microsoft/typespec/issues/9492 * Support 3xx redirect status codes in http-client-csharp generator (#9498) ## Plan: Add support for 302 redirect in http-client-csharp - [x] Understand the issue from migration blocker document - [x] Identify root cause in RestClientProvider.GetClassifier - [x] Update GetSuccessStatusCodes to include 3xx status codes - [x] Add test case for 302 redirect in http-client-csharp - [x] Validate test passes with changes - [x] Run broader test suite to ensure no regressions - [x] Code review and address feedback - [x] COMPLETE ### Summary Successfully added support for HTTP 3xx redirect status codes (including 302) to the http-client-csharp emitter. ### Changes Made 1. **RestClientProvider.cs** (1 line changed): - Line 862: Changed from `statusCode < 300` to `statusCode < 400` - Allows 3xx redirect status codes to be treated as success responses 2. **Unit test**: - Added `Validate3xxRedirectStatusCode` test in `RestClientProviderTests.cs` to verify 302 redirect support - Test validates proper pipeline message classifier creation for 3xx status codes - Test validates that the CreateRequest method properly references and uses the classifier property - Test is self-contained and uses InputFactory to create test data ### Test Results βœ… All 1010 unit tests pass (Microsoft.TypeSpec.Generator.ClientModel.Tests) βœ… New test specifically validates 302 redirect functionality including CreateRequest method behavior βœ… No regressions in existing functionality ### Migration Blocker Resolution This resolves the migration blocker for Azure.Communication.ProgrammableConnectivity which uses 302 redirects in its OAuth authorization flow. The service can now migrate from the legacy emitter to http-client-csharp v1.0.0+.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add support for 302 redirect > See https://github.com/Azure/azure-sdk-for-net/blob/8401911d737002189207067dde4177ea94846126/sdk/communication/Azure.Communication.ProgrammableConnectivity/MIGRATION_BLOCKER.md > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9497 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Migrate Create-APIReview script from API Key to Azure AD authentication (#9501) - [x] Review Azure SDK PR #13235 pattern for removing API Key authentication - [x] Update Create-APIReview.ps1 to remove API Key parameter and add Bearer token authentication - Removed `$APIKey` parameter from script - Added `Get-ApiViewBearerToken()` function that acquires Azure AD tokens via `az account get-access-token` - Updated `Upload-SourceArtifact` to use Bearer token instead of API Key - Updated `Upload-ReviewTokenFile` to use Bearer token instead of API Key - Changed API endpoints from `UploadAutoReview` to `upload` and `CreateApiReview` to `create` (lowercase) - Changed HTTP method from GET to POST for the create endpoint - Improved error handling with more detailed error messages - [x] Update create-apireview.yml to use AzureCLI@2 task instead of Powershell@2 task - Changed task from `Powershell@2` to `AzureCLI@2` - Added `AzureServiceConnection` parameter with default value "APIView prod deployment" - Removed `-APIKey $(azuresdk-apiview-apikey)` argument - Removed `pwsh: true` (not needed with AzureCLI@2) - Added `azureSubscription`, `scriptType`, and `scriptLocation` inputs - [x] Address security concern: removed potentially sensitive token response from error logging
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Stop using Api Key in Create-ApiReview script > We can follow the same pattern as used in https://github.com/Azure/azure-sdk-tools/pull/13235 > > And apply those changes to https://github.com/microsoft/typespec/blob/main/eng/emitters/scripts/Create-APIReview.ps1 > > Also need to update https://github.com/microsoft/typespec/blob/main/eng/emitters/pipelines/templates/steps/create-apireview.yml > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9500 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Rename from "top" to "maxCount" in paging operations (#9505) This pull request updates the C# HTTP client generator to improve parameter naming consistency for paging operations. Specifically, it ensures that the "top" query parameter is renamed to "maxCount" in generated REST client methods, and adds a corresponding unit test to verify this behavior. Additionally, the `InputParameter.Update` method is enhanced to allow updating multiple fields at once. Solves: https://github.com/microsoft/typespec/issues/9502 * [python] release new version (#9507) * Fix optional Content-Type headers being transformed to enums (emitter-only) (#9495) Optional Content-Type headers were incorrectly transformed into extensible enums by the type converter. They must remain as constants. ## Changes **Emitter (type-converter.ts)** - Skip enum transformation for Content-Type headers, preserving constant type regardless of optionality **Emitter (operation-converter.ts)** - Pass header parameter to `fromSdkType` to enable Content-Type detection **Emitter Tests (operation-converter.test.ts)** - Added tests to verify Content-Type remains as constant type for both optional and required bodies ## Result Content-Type headers now remain as constants in the type model instead of being transformed to enums when the body parameter is optional. This prevents the enum transformation while preserving the constant type information for downstream processing. ## Note This PR focuses solely on the emitter-side fix to prevent unwanted enum transformation. Generator-side handling of optional Content-Type parameters (if needed for conditional setting) will be addressed separately.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Fix optional contentType issue > As described in https://github.com/Azure/azure-sdk-for-net/issues/55300, but the issue belongs in this repo. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9494 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov * Changes to .chronus shouldn't trigger core CI (#9496) Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com> * Allow configuring options in snapshot samples (#9460) To reduce changes in https://github.com/Azure/typespec-azure/pull/3836 * Astro utils updates (#9491) - Move EditorTabs component for reuse in typespec-azure - Make sure the tryit plugin works correctly when using ` * Bump System.ClientModel to 1.9.0 (#9519) Updates System.ClientModel package from 1.8.0 to 1.9.0 in both generator source and generated project templates. ## Changes - **Packages.Data.props**: Updated `System.ClientModel` to 1.9.0 and `System.Memory.Data` to 10.0.1 (transitive dependency requirement) - **NewProjectScaffolding.cs**: Updated generated project template to reference System.ClientModel 1.9.0 - Regenerated all test projects (74 .csproj files) to reflect the new package versions
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Bump SCM to 1.9.0 > Bump System.ClientModel package to 1.9.0 both in our [generator source](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/Packages.Data.props#L17) and in the generated project file. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9518 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * [python] release new version (#9525) * Bump tar from 7.5.3 to 7.5.7 in /packages/http-client-java (#9524) Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.3 to 7.5.7.
Commits
Maintainer changes

This version was pushed to npm by isaacs, a new releaser for tar since your current version.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar&package-manager=npm_and_yarn&previous-version=7.5.3&new-version=7.5.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix optional Content-Type header detection by unifying parameter processing (#9528) - [x] Understand the issue: The previous fix in PR #9495 added Content-Type header detection in `type-converter.ts`, but it relies on `sdkProperty` being passed to `fromSdkType`. The `fromHeaderParameter` function in `operation-converter.ts` doesn't pass the header parameter to `fromSdkType`, so the fix doesn't work. - [x] Fix `fromHeaderParameter` to pass the header parameter `p` to `fromSdkType` so the Content-Type detection can work - [x] Unify all parameter-processing functions to pass property instance to `fromSdkType`: - `fromQueryParameter` - `fromPathParameter` - `fromHeaderParameter` - `fromBodyParameter` - `updateMethodParameter` - [x] Investigated making `sdkProperty` required - not feasible as many callers have no property context (model base types, array/dict value types, etc.) - [x] Run existing tests to verify the fix works (all 177 tests pass) - [x] Fix CI formatting issues - [x] Run code review and security checks
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Fix optional contentType issue > As described in https://github.com/Azure/azure-sdk-for-net/issues/55300, but the issue belongs in this repo. > > The previous [fix ](https://github.com/microsoft/typespec/pull/9495) does not really fix the issue entirely. > Please fix this again following the root cause in this comment: https://github.com/microsoft/typespec/issues/9494#issuecomment-3822513806 > > ## Comments on the Issue (you are @copilot in this section) > > > @ArcturusZhang > I think this is not fixed. > The fix introduced an extra check to see if it is a content type header, by checking if the `sdkProperty` is not undefined, but in our code, when the `fromSdkType` is called converting the method parameters (for instance [here](https://github.com/microsoft/typespec/blob/f1a7649b3b53ab7d30488cf7274f813696cdf2d0/packages/http-client-csharp/emitter/src/lib/operation-converter.ts#L482)), the `sdkProperty` argument is never passed in. Therefore the fix is not actually running. > >
- Fixes microsoft/typespec#9494 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com> * Add backward compatibility for object-typed AdditionalProperties (#9516) ## βœ… Implementation Complete: Add backward compatibility support for object-typed AdditionalProperties ### Issue Resolved Successfully implemented backward compatibility for models with `IDictionary` AdditionalProperties (from old generator) that are now generated as `IDictionary` (in new generator). ### Final Solution **Core Approach: Matching Backing Field Types** The solution detects when a model previously had object-typed AdditionalProperties and creates the backing field with the appropriate type, ensuring perfect type alignment between field and property. ### Files Changed **packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ModelProvider.cs** - Added object dictionary type support alongside BinaryData - Added early backward compatibility detection via `ShouldUseObjectAdditionalProperties()` - Updated `BuildRawDataField()` to create field with object or BinaryData type based on backward compat needs - Updated property generation logic to use matching backing field type - Added comprehensive XML documentation - Fixed null-safety issues with IsFrameworkType checks **packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/ModelProviderTests.cs** - Added `TestBuildProperties_WithObjectAdditionalPropertiesBackwardCompatibility` test **packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/AdditionalPropertiesTest.cs** - Added comprehensive deserialization test verifying all code aspects - Added comprehensive serialization test verifying all code aspects - Both tests validate complete generated code with detailed assertions **packages/http-client-csharp/generator/docs/backward-compatibility.md** - Added new section "AdditionalProperties Type Preservation" - Documents the object-to-BinaryData migration scenario - Provides examples of before/after code - Explains serialization/deserialization behavior differences - Formatted with prettier (removed trailing whitespace) ### Test Results βœ… - **1232/1232** Microsoft.TypeSpec.Generator.Tests PASSED - **1014/1014** Microsoft.TypeSpec.Generator.ClientModel.Tests PASSED - **10/10** AdditionalPropertiesTest tests PASSED - **2/2** Serialization backward compatibility tests with comprehensive assertions PASSED ### Comprehensive Test Coverage **Deserialization test verifies:** - Variable declaration: `IDictionary additionalProperties` - Dictionary initialization: `ChangeTrackingDictionary()` - Property enumeration: `foreach (var prop in element.EnumerateObject())` - Property name checks: `prop.NameEquals("name"u8)` - Type-specific methods: `GetString()` for known properties, `GetObject()` for additional properties - Constructor call with proper parameters **Serialization test verifies:** - Format validation and error handling - Property name serialization: `writer.WritePropertyName("name"u8)` - Property value serialization: `writer.WriteStringValue(Name)` - Foreach iteration over AdditionalProperties - Key serialization: `writer.WritePropertyName(item.Key)` - Value serialization: `writer.WriteObjectValue(item.Value, options)` - Options.Format handling ### Backward Compatibility Guarantees | Scenario | Result | |----------|--------| | Existing library with object type | βœ… Maintains object type when regenerated | | New library without previous version | βœ… Uses BinaryData type (new default) | | Binary compatibility | βœ… Fully maintained - same types | | Source compatibility | βœ… Fully maintained - code compiles | | Serialization | βœ… Works with both types - fully verified | | Deserialization | βœ… Works with both types - fully verified | ### Ready for Merge This PR successfully resolves the issue with comprehensive test coverage and documentation updates.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add backcompat support for public AdditionalProperties property on models defined as object valued dictionary > In the old generator, we would generate AdditionalProperties as `IDictionary`. In the new generator, we use `IDictionary`. We will need to implement support for object for backwards compatibility. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9515 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix Content-Type header set when request content is optional (#9521) ## Fix Content-Type header setting in RestClient βœ… ### Summary Fixed an issue where Content-Type headers were set unconditionally, even when request content was optional and might be null. ### Changes Made - [x] Modified `RestClientProvider.BuildCreateRequestMethodBody` to detect and pass content parameter to `AppendHeaderParameters` - [x] Updated `AppendHeaderParameters` to wrap Content-Type header setting in `if (content != null)` check **only when body parameter is optional** - [x] Added comprehensive tests to verify the fix with full statement assertion - [x] Added test for required body parameter with assertion that Content-Type is NOT wrapped in if statement - [x] Removed unnecessary cast - ParameterProvider has implicit conversion to ValueExpression - [x] All 51 RestClientProvider tests passing ### Result **Before:** ```csharp // When body is optional request.Headers.Set("Content-Type", "application/json"); request.Content = content; // content could be null ``` **After (when body is optional):** ```csharp if (content != null) { request.Headers.Set("Content-Type", "application/json"); } request.Content = content; ``` **After (when body is required):** ```csharp request.Headers.Set("Content-Type", "application/json"); request.Content = content; // content is required, no null check needed ``` This ensures Content-Type headers are only wrapped in null checks when the request body parameter is actually optional, avoiding unnecessary checks for required parameters.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Content-Type setting in RestClient is not correct > Currently we have code generated like this https://github.com/Azure/azure-sdk-for-net/pull/55347#discussion_r2743823430. This isn't correct (obviously). We should instead be checking if the RequestContent is null when setting the Content-Type header. > > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9520 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * fix: date time offset formatting was culture variant for doc comments (#9538) while onboarding to the project, I noticed a failing unit test on windows (en-CA) locale. This is due to a variant behaviour on how dates are represented * ci: adds @shivangiReja and @joseharriaga to the csharp reviewers (#9539) while working on #9538 I noticed they were missing. Note: using teams here would make things easier * APIVersion and MaxpAgeSize Parameter handling (#9523) This pull request refactors how special query parameters, particularly API version and max page size, are detected and handled in the `RestClientProvider` class. The changes improve the flexibility and accuracy of parameter updates, especially for paging operations, by relying on parameter metadata rather than hardcoded string comparisons. Parameter handling improvements: * Refactored the logic for detecting API version and max page size parameters in `ShouldUpdateReinjectedParameter` to use parameter metadata (`IsApiVersion` and paging metadata) instead of comparing against hardcoded strings. * Updated the call to `ShouldUpdateReinjectedParameter` in `AppendQueryParameters` to pass the full `InputParameter` and `InputPagingServiceMethod`, enabling the new metadata-based logic. * Add support for array encoding with @encode(ArrayEncoding.*) decorator (#9430) This pull request adds support for custom array encoding formats in the C# HTTP client generator, allowing arrays to be serialized and deserialized using delimiters such as comma, space, pipe, or newline. The changes span the model, serialization logic, type conversion, and test coverage to ensure correct handling of these encodings. ### Array encoding support * Introduced an optional `encode` property to `InputModelProperty` and related types to specify the desired array encoding (e.g., `commaDelimited`, `spaceDelimited`, etc.). This is reflected in the type definitions, model constructors, and JSON serialization/deserialization logic. * Updated the type converter (`type-converter.ts`) to propagate the `encode` property from SDK model properties into the input model. ### Serialization and deserialization logic * Added custom serialization and deserialization methods in `MrwSerializationTypeDefinition.cs` to handle arrays with specified encodings. These methods join or split array elements using the appropriate delimiter and handle both string and primitive element types. ### Test coverage * Added new tests in `EncodeArrayTests.cs` to verify correct serialization and deserialization for each supported encoding format (comma, space, pipe, newline). Implements: https://github.com/microsoft/typespec/issues/9028 * Bump tar from 7.5.6 to 7.5.7 in /packages/http-client-csharp (#9544) Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.6 to 7.5.7.
Commits
Maintainer changes

This version was pushed to npm by isaacs, a new releaser for tar since your current version.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar&package-manager=npm_and_yarn&previous-version=7.5.6&new-version=7.5.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix duplicate discriminator property in derived types with matching serialized names (#9477) - [x] Investigate the issue and understand the root cause - [x] Write failing tests that reproduce the bug - [x] Fix the issue by comparing serialized names instead of C# property names for discriminator de-duplication - [x] Verify all related tests pass (1233 generator tests) - [x] Run code review and address feedback - [x] Add null checks for SerializedName as suggested in review - [x] Add verification that correct discriminator value is passed to base class ## Root Cause Analysis The bug occurs in `ModelProvider.BuildProperties()` where the check for duplicate discriminator properties only compared by C# property name (`property.Name`) instead of also checking the serialized name (`property.SerializedName`). When the base model has a discriminator property with a different C# name than the derived model's discriminator property (but the same wire name like `@odata.type`), the check failed and the discriminator property was incorrectly added to the derived class. ## Fix Added a HashSet of base discriminator serialized names and extended the check to skip discriminator properties that match by either: 1. C# property name (existing check) 2. Serialized name (new check) Added null checks for `SerializedName` as per code review feedback to ensure defensive coding practices.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: Duplicate Discriminator Property in Derived Types > ### Describe the bug > > ### Description > The TypeSpec C# generator creates a duplicate `OdataType` property in derived classes when the base class already defines it as the discriminator. This causes CS0108 "hides inherited member" compiler warnings/errors. > > ### Reproduction > In `ContentUnderstandingSkill.cs` (derived from `SearchIndexerSkill`): > > **Base class (`SearchIndexerSkill.cs`):** > ```csharp > internal string OdataType { get; set; } > ``` > > **Derived class (`ContentUnderstandingSkill.cs`) incorrectly re-declares:** > ```csharp > internal string OdataType { get; set; } = "#Microsoft.Skills.Util.ContentUnderstandingSkill"; > ``` > > The internal constructor also has a redundant parameter: > ```csharp > internal ContentUnderstandingSkill( > string odataType, // ? passed to base class > ..., > string odataType0) // ? duplicate, assigned to local OdataType > : base(odataType, ...) > { > // ... > OdataType = odataType0; // ? This shouldn't exist > } > ``` > > ### Expected Behavior > Derived types should NOT re-declare the discriminator property. The value should be set via the base class constructor only, which is already being done correctly in the public constructor: > > ```csharp > public ContentUnderstandingSkill(...) > : base("#Microsoft.Skills.Util.ContentUnderstandingSkill", inputs, outputs) > ``` > > ### Compiler Error > ``` > CS0108: 'ContentUnderstandingSkill.OdataType' hides inherited member 'SearchIndexerSkill.OdataType'. > Use the new keyword if hiding was intended. > ``` > > ### Root Cause > The TypeSpec definition likely has the `@odata.type` discriminator property appearing in both the base type and derived type definitions, or there's a conflict between the discriminator and a regular property with the same JSON name. > > ### Affected Types > - `ContentUnderstandingSkill` > - `ChatCompletionSkill` > - Potentially all derived skill types and any other polymorphic hierarchy with a discriminator property > > --- > > ### Reproduction > > Existing File with error : https://github.com/Azure/azure-sdk-for-net/blob/3df80e71cc22102f60910e9d188ca864ea18849d/sdk/search/Azure.Search.Documents/src/Generated/Models/ChatCompletionSkill.cs#L138C1-L139C1 > > Previous file: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/src/Generated/Models/ChatCompletionSkill.cs > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > This fix applies to packages\http-client-csharp > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9437 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JonathanCrd <17486462+JonathanCrd@users.noreply.github.com> Co-authored-by: Jonathan CΓ‘rdenas * [Python][Docs] Add architecture documentation for http-client-python emitter (#9274) - [x] Explore the http-client-python repository structure - [x] Understand the emitter and generator architecture - [x] Review existing documentation and structure - [x] Create comprehensive architecture documentation - [x] Add the documentation to the website - [x] Review and finalize documentation - [x] Fix ASCII diagram box alignment - [x] Add m2r transformation to emitter responsibilities - [x] Align directory structure comments - [x] Ensure all diagram right borders align at column 66 - [x] Align all # comments to column 43 in directory tree - [x] Simplify component details to reduce duplication - [x] Fix Prettier formatting issues
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [python] docs to introduce source code of http-client-python > Context: > http-client-python contains 2 part of code, > (1) first part is in folder "emitter" written by typescript which handle info from typespec-client-generator-code, then pass handled data to "generator/pygen" written by python to generate sdk. > (2) In pygen, it is pre-handled again in "preprocess" then pass to "codegen". In "codegen", "models" prepares all necessary info then "serializers" render files with template files of "templates" and parameter info from "models" to generated sdk file. > > Ask: > With up context, write a brief introduction to "http-client-python" so that developers could understand the repo and develop quickly. > > NOTE: > (1) context is just help you understand the repo but DO NOT be limited by context so you can read the files or code of this repo to make a good doc > > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9273 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: Yuchao Yan Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * http-client-java, bug fix on mock value for BinaryData (#9527) fix https://github.com/microsoft/typespec/issues/9508 * http-client-java, support File (#9530) https://github.com/microsoft/typespec/issues/9509 * Minify and gzip bundler output (#9536) Right now files targetted for playground usage are not minified. This makes the playground loading slower * Remove type and optionality constraints from @continuationToken decorator (#9078) The `@continuationToken` decorator enforced that properties be of type `string`, preventing nullable types like `string | null` and rejecting non-string types entirely. This constraint was unnecessarily restrictive for pagination patterns. ### Changes - **`packages/compiler/src/lib/paging.ts`**: Removed validation function from `continuationTokenDecorator` that enforced string type requirement - **`packages/compiler/test/decorators/paging.test.ts`**: Added tests covering nullable types, optional properties, and non-string types ### Usage The decorator now accepts any type without validation: ```typespec model ListPageInfo { @pageItems items: string[]; // Now supported: nullable non-optional @continuationToken endCursor: string | null; // Already worked, still works: optional @continuationToken token?: string; // Now supported: non-string types @continuationToken offset: int32; } ``` Backward compatible - all existing usage continues to work unchanged.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: Continuation token must allow nullable non optional fields > ### Describe the bug > > Currently `@continuationToken` supports only string type for the field. Like this. > > ```typespec > model ListPageInfo { > startCursor?: string; > > @continuationToken > endCursor?: string; > > hasNext: boolean; > hasPrev: boolean; > } > ``` > > While having optional field is fine, for typescript case, to enforce more consistent typing I prefer to make fields nullable instead, therefore compiler would highlight missing expected nullable field. > > Therefore `@continuationToken` should support more than field optionality way of representing the token which might be or might not be, but the field is always present otherwise. > > ### Reproduction > > ```typespec > model ListPageInfo { > startCursor?: string; > > @continuationToken > endCursor: string | null; > > hasNext: boolean; > hasPrev: boolean; > } > ``` > > decorator gives: > ```Cannot apply continuationToken decorator to string | null since it is not assignable to stringTypeSpec(decorator-wrong-target)``` > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > Remove the constraint that requires the target property of `@continuationToken` to be a string *and* the constraint that requires it to be a required property. Correct any tests and add new tests to verify that an optional property cna be marked with this decorator. > > ## Comments on the Issue (you are @copilot in this section) > > > @timotheeguerin > This feels resonable, not sure it should even force it to be a string > >
- Fixes microsoft/typespec#9044 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> Co-authored-by: Timothee Guerin * Fix PipelineMessageClassifier property caching to use ??= instead of = (#9556) PipelineMessageClassifier properties were reallocating on every access instead of caching in their backing fields due to using simple assignment. **Before:** ```csharp private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); ``` **After:** ```csharp private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); ``` ### Changes - **Generator**: Added `nullCoalesce: true` to `Assign()` call in `RestClientProvider.cs:356` - **Test data**: Updated expected output in 3 test files to match new `??=` pattern - **Generated samples**: Updated 10 files in `docs/samples` and `TestProjects` to reflect corrected generation The null-coalescing assignment ensures `Create()` is called once on first access rather than on every property access.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Don't reallocate PipelineMesssageClassifier properties on each access > We intended to cache the value in the backing field. > > https://github.com/Azure/azure-sdk-for-net/pull/54611#discussion_r2733976282 > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9555 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov * Fix listing files when multiople instance are loaded (#9320) fix #9313 --------- Co-authored-by: Mark Cowlishaw <1054056+markcowl@users.noreply.github.com> * Fix Openapi3.0 param with $ref schema and default (#9533) fix [#8781](https://github.com/microsoft/typespec/issues/8781) * Fix content-type consistency in payload/xml XmlErrorValue response (#9570) `XmlErrorValue.get()` returned `SimpleModel` without a content-type header (defaulting to `application/json`) while `XmlError` used `application/xml`. This inconsistency is unexpected for an XML payload spec. ### Changes - Wrap `SimpleModel` response with explicit `application/xml` content-type header to match the error response **Before:** ```tsp get(): SimpleModel | XmlError; ``` **After:** ```tsp get(): { @header("content-type") contentType: "application/xml"; @body body: SimpleModel; } | XmlError; ``` This follows the same pattern used by `XmlOperations` template elsewhere in the file. > [!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: > > - `telemetry.astro.build` > - Triggering command: `/usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node sion ebsite/src/content/docs/docs/emitters/openapi3/reference node e --no-emit sh rsioning/referentspd doc . --enable-experimental --output-dir ../../website/src/content/docs/d--output-dir node p/no ite..." --filter "!@typespec/monorepo" run regen-docs uname /node_modules/.bin/node && pnpm lint-tysh node _modules/pnpm/ditsx ./.scripts/regen-compiler-docs.ts tp/reference` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [spector] fix case for payload/xml > For https://github.com/microsoft/typespec/blob/afa236acbbaa468a8910e8fc4177828ed174d8ba/packages/http-specs/specs/payload/xml/main.tsp#L332, > - `SimpleModel` is not wrapped with content-type header "application/xml" then its default content-type is "application/json" > - `XmlError` defines content-type header as "application/xml" > > It is very strange that response and error response has such different content-type. > > **Expected behavor**: > > We expect `SimpleModel` shall also be wrapped with content-type "application/xml" to keep consistent with error response like other cases in this file > > **NOTE**: > > 1. DO add changelog under .chronus/changes > 2. DO necessary check before commit. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9569 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * [Python] optimize perf for test generation and sample generation (#9473) for https://github.com/microsoft/typespec/issues/9448 PR summary: - The main optimization is to cache the cost operation in `import_sample_cache` and `import_test_cache` so that they could be reused in test generation and sample generation. The more test/samples to generate, the more time to save. For example, cost time of SDK generation for Apimanagement is reduced from 47 minutes to 4 minutes. * [python] Remove deepcopy from import_serializer.py (#9551) For https://github.com/microsoft/typespec/issues/9486 Eliminating `deepcopy` can enhance the speed of generating the Python SDK for complex packages by 20%. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * [python] ignore all errors during error deserialization (#9573) Co-authored-by: iscai-msft * [python] bump for release (#9574) Co-authored-by: iscai-msft * [python][Doc] skill to help bump and release (#9424) According to https://code.visualstudio.com/docs/copilot/customization/agent-skills#_create-a-skill, we could add skill to help bump and release http-client-python * feat: Remove internal tag from openapi-versions property for emitter (#9584) follow up to #4946 now that both 3.1.0 and 3.2.0 are implemented, the property should be exposed. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Generator fix to handle apiVersion casing and multiple placeholders in URI path (#9561) Make paramMap look up case insensitive to avoid cases like ```"ApiVersion"``` in server parameters vs ```"apiVersion"```. Fix template for URI path to be compatible with multiple placeholders like ```"{Endpoint}/anomalydetector/{ApiVersion}"```. --------- Co-authored-by: Linh Phan * handled paging parameter casing (#9567) This pull request improves the handling of page size parameter names in the C# HTTP client generator to ensure correct casing and compatibility with previous contract versions. The changes introduce logic to preserve parameter casing from the previous contract when available and to normalize common variants (like "maxpagesize") to the standard "maxPageSize" otherwise. Comprehensive tests are added to verify this behavior. Resolves: https://github.com/Azure/azure-sdk-for-net/issues/54468 * Fix malformed namespace generation for unresolved types in customization code (#9578) ## Fix for Malformed Namespace Generation in Customization Code - [x] Understand root cause: Roslyn cannot resolve generated types in customization code, leading to malformed namespaces - [x] Move fix from TypeSymbolExtensions to CSharpTypeExtensions.EnsureNamespace per code review feedback - [x] Enhanced EnsureNamespace to look up types by name when spec property is null - [x] Handle edge case where types are renamed with CodeGenType attribute - [x] Add TypeProvidersByName dictionary for efficient name-based lookup - [x] Remove redundant code and unnecessary variables - [x] Add comprehensive tests validating the fix - [x] Validate with existing test suite - all 2260 tests pass (including 2 new tests) ### Changes Made **Modified:** `TypeFactory.cs` - Added `TypeProvidersByName` dictionary mapping C# type names to TypeProviders for efficient O(1) lookup - Populated dictionary when adding types to CSharpTypeMap in CreateModel and CreateEnum **Modified:** `CSharpTypeExtensions.cs` - Enhanced `EnsureNamespace` method to handle custom properties without corresponding spec properties - Added `TryFindCSharpTypeByName` with inline TypeFactory access for cleaner code - Returns properly qualified CSharpType by resolving through TypeProvidersByName **Added Tests:** `ModelCustomizationTests.cs` - `CanAddPropertyReferencingGeneratedType`: Validates custom property `IList` gets proper namespace "Sample.Models" - `CanAddPropertyReferencingRenamedGeneratedType`: Validates custom property referencing CodeGenType renamed type gets proper namespace - Both tests confirm namespaces are correctly resolved instead of being empty or malformed ### Testing All tests pass, confirming the fix resolves malformed namespace generation for customization code.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [http-client-csharp] malformed code is generated on some kind of customization code > Sometimes, in customized code, roslyn cannot analyze the correct namespace of some symbols (or maybe not?), and code like this is generated: > Image > > We need to fix this. > The above code was generated when we have the following customization: > Image > > To reproduce: > Prepare typespec: > ``` > model Foo { > bar?: Bar; > } > > model Bar { > b?: string; > } > ``` > In the generated code, add the following: > ``` > [CodeGenSerialization(nameof(Bars), "bars"] > public partial class Foo > { > public IList Bars {get;} > } > ``` > then generate the code. > > ## Comments on the Issue (you are @copilot in this section) > > > @JoshLove-msft > @ArcturusZhang can you please add repro instructions? > @ArcturusZhang > > [@ArcturusZhang](https://github.com/ArcturusZhang) can you please add repro instructions? > > added some reproduction steps. > @jorgerangel-msft > The root cause of this may be that we are not successfully reading the namespace of "non-primitive" generated types in the symbols therefore when we write them out, there are no namespaces. > >
- Fixes microsoft/typespec#9403 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix use segoe ui in website (#9586) fix #7727 Seems like we have to include those fonts * Fix: tag metadata not scopped to the service it was defined on (#9583) fix #8089 * [python] add support for `@clientOption("includeRootSlash")` (#9587) Co-authored-by: iscai-msft * Fix json schema crashing on usage of templates that cannot be named (#9580) fix [#9465](https://github.com/microsoft/typespec/issues/9465) * Update Node.js dependencies for http-client-java (#9591) Updates Node.js dependencies for `packages/http-client-java` to their latest versions. ## Changes - **@azure-tools/typespec-client-generator-core**: 0.64.5 β†’ 0.64.6 - **@microsoft/api-extractor**: ^7.56.0 β†’ ^7.56.2 Updated in: - Root `package.json` (devDependencies and peerDependencies) - Test packages (overrides): `generator/http-client-generator-test` and `generator/http-client-generator-clientcore-test` - Root `package-lock.json` ## Notes No code regeneration required as `http-specs` and `azure-http-specs` versions remain unchanged. --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: Weidong Xu * [python] release new version (#9592) * Stop building test files (#9333) fix https://github.com/microsoft/typespec/issues/9232 Refactor how our tsconfig are setup so it won't build the test files. Goal - tsconfig.json -> not used for building, don't include/exclude files so just can be used by IDE for checking non project files(vitest.config.ts, etc.) - tsconfig.build.json -> actual config used for building The change involve for most - rename tsconfig.json to tsconfig.build.json - rename tsconfig.config.json to tsconfig.json - change `tsc -p .` to `tsp -p tsconfig.build.json` * Add Spector tests for File type with content type variations (#9513) ## Final Changes - Ready for Merge βœ… ### Changelog Entry Added βœ… Added changelog entry using `pnpm change add`: - Package: `@typespec/http-specs` - Change type: **Feature** - Description: "Add Spector tests for File type with various content types (body and multipart)" ### Code Formatting βœ… Ran `pnpm format` to format the code according to project standards. ### Complete Test Coverage **Body Tests (8 scenarios in `/type/file`):** - βœ… Upload/download with specific content type (`image/png`) - βœ… Upload/download with JSON content type (`application/json`) - βœ… Upload/download with multiple content types (`image/png | image/jpeg`) - βœ… Upload/download with unspecified content type (sends `image/png` for testing) **Multipart Tests (3 scenarios in `/payload/multipart`):** - βœ… File with specific content type (inline) - βœ… File with required filename (model with template) - βœ… File array (inline) ### All PR Feedback Addressed 1. βœ… Moved multipart tests to `/payload/multipart` 2. βœ… Used inline `Http.File<>` syntax instead of model wrappers 3. βœ… Renamed to `FileWithRequiredFilename` with template argument 4. βœ… Removed unnecessary test 5. βœ… Added JSON content type test 6. βœ… Fixed default content type to use `image/png` 7. βœ… Formatted code with `pnpm format` 8. βœ… Added changelog entry with `pnpm change add` ### Validation - βœ… All 61 scenarios compile successfully - βœ… All mock APIs validated - βœ… Code properly formatted - βœ… Changelog entry created
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add spector test for File > NEed test for usage as body in request and response as well as in multipart. > > For the body test it should check with a specific content type. Another test should be with multiple content type > > Follow other binary payload and multipart test in packages/https-specs for example > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9504 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> * Fix the constant vs enum issue in content-type parameter (#9568) Fixes https://github.com/microsoft/typespec/issues/9566 * [python] Fix import for xml paging (#9571) PR summary: - fix import for xml paging image - add test case * Add XML Model Deserialization Support (#9545) Adds the initial XML deserialization support for models using MRW. contributes to: https://github.com/Azure/azure-sdk-for-net/issues/48062, https://github.com/microsoft/typespec/issues/5656, https://github.com/microsoft/typespec/issues/5861 fixes: https://github.com/microsoft/typespec/issues/5646 * Sample picker as drawer (#9535) Move samples to a drawer opening a sample gallary. This is to accomadate more sampels/consolidate with sampels from `packages/samples` image * Fix tsconfig.ws.json (#9598) 1. tspd shouldn't part of it anymore as it needs alloy to build 2. http-server-js wasn't migrated to tsconfig.build.json so this was incorrect(we can do that when we start using alloy there too) * Add methodParameterSegments to input parameter types for override decorator support (#9537) - [x] Add `methodParameterSegments` property to TypeScript input parameter types (InputQueryParameter, InputPathParameter, InputHeaderParameter, InputBodyParameter, InputEndpointParameter) - [x] Update TypeScript emitter to flow `methodParameterSegments` from TCGC to input parameters - [x] Add `MethodParameterSegments` property to C# InputParameter class and derived types - [x] Update C# serialization converters to handle the new property - [x] Test the changes to ensure data flows correctly from TCGC to C# - [x] Update to use methodParameterSegments (2D array) from TCGC - [x] Implement consumption of MethodParameterSegments in GetProtocolMethodArguments for proper parameter mapping - [x] Store complete segment path (e.g., ['Params', 'foo']) to enable property navigation for spread body scenarios - [x] Rename to MethodParameterSegments throughout to match TCGC naming - [x] Simplify fallback logic - spread parameters handled separately, fallback for legacy scenarios - [x] Use ModelProviderSnippets.GetPropertyExpression for proper property navigation with null conditionals - [x] Refactor GetProtocolMethodArguments to iterate through protocol parameters instead of convenience parameters - [x] Fix body parameter conversion to check protocol parameter location instead of source parameter location - [x] Add methodParameterSegments parameter to InputParameter.Update method for test support - [x] Fix body parameter wrapping to detect extracted property values via MethodParameterSegments path length - [x] Use implicit cast to RequestContent instead of explicit RequestContentApiSnippets.Create wrapper - [x] Add comprehensive unit tests for emitter (method-parameter-segments.test.ts) and generator (ScmMethodProviderCollectionTests.cs) - [x] Fix TypeScript compilation errors in test file (correct imports, type annotations, API usage)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add support for Override decorator > See https://github.com/Azure/azure-sdk-for-net/issues/51956 for the spector scenario, though this should be implemented in this repo in the unbranded generator. I am going to file a follow up issue asking that all non-Azure features are covered in the unbranded spector scenarios. There is nothing Azure specific about the override decorator. It is basically implemented in TCGC, but the one piece we need to handle in the C# generator is the conversion from the convenience method model to the protocol parameters. In order to do this mapping, we will need to flow through the correspondingMethodParams from TCGC. We should add this as a property on all of the types defined in the union here https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/emitter/src/type/input-type.ts#L177. We would then need to flow this through to the C# input types. The corresponding C# type for the property is [InputMethodParameter](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/InputTypes/InputMethodParameter.cs). This would need to be a property one each of the protocol parameter Input types. We would then need to use this mapping when calling the protocol methods to get the correct method arguments. > > ## Comments on the Issue (you are @copilot in this section) > > > @JoshLove-msft > This is blocked on needing more metadata - https://github.com/Azure/typespec-azure/issues/3488 > >
- Fixes microsoft/typespec#8898 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov * Enhance documentation for @typeChangedFrom and @returnTypeChangedFrom decorators (#9563) ## Plan: Improve Versioning Decorator Documentation - [x] Update JSDoc comments for `@typeChangedFrom` in decorators.tsp with: - More descriptive main description explaining its purpose - Better parameter descriptions - Example showing usage - [x] Update JSDoc comments for `@returnTypeChangedFrom` in decorators.tsp with: - More descriptive main description explaining its purpose - Better parameter descriptions - Example showing usage - [x] Regenerate the reference documentation - [x] Verify the generated documentation looks correct - [x] Add changeset file for CI (classified as 'internal' change)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [doc] The description of the decorators for versioning lacks the details on how to use it. > It would cause AI to provide the incorrect answer as it does not understand those decorators. > > E.g. https://typespec.io/docs/libraries/versioning/reference/decorators/#@TypeSpec.Versioning.typeChangedFrom > > Suggestion for: > @typeChangedFrom : declare that the type of a declaration has changed starting at a given version, while keeping earlier versions consistent with the previous type. > > version: One of service’s versions indicating when the change takes effect. > previousType: The old type used before the specified version. > > Please update the jsdoc comments for the versioning decorators to indicate what they do, then regenerate the reference docs for them. > > @typeChangedFrom( , ) indicates that the `type` of the decorated parameter or property was in versions before . > > @renamedFrom(, ) indicates that the decorated type used the name in versions before > > @returnTypeChangedFrom( , ) indicates that the return type of the decorated operation was in versions before . > > @madeOptional( ) indicates that the decorated parameter or property was required in versions before > > @added( < Version>) indicates that the decorated type does not exist in versions before . (Unless the type is decorated with `@added` referencing some earlier version) > > @removed() indicates that the decorated does not appear in or any version afterwards. (Unless the type is decorated with `@added` referencing a later version) > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9344 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Document GET as default HTTP verb for following nextLink URIs (#9562) The pagination documentation did not explicitly specify the HTTP verb for following `@nextLink` URIs. Based on Azure/typespec-azure#3377, nextLink should be treated as an opaque GET request. ## Changes - Added explicit guidance after the link pagination example stating that `@nextLink` and related decorators (`@prevLink`, `@firstLink`, `@lastLink`) should be followed using GET requests by default - Clarified in the "Handling of additional parameters" section that clients should use GET when following link URIs - Reinforced that link URIs are opaque and contain all necessary navigation information ## Example ```tsp @list op listPets(): { @pageItems pets: Pet[]; @nextLink next?: url; // Should be followed with GET request }; ``` The documentation now states: "For HTTP services, `@nextLink` (and other link decorators) should be followed using a GET request by default. The link URIs are expected to be treated as opaque URLs that contain all necessary information to navigate to the respective page."
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Document GET is the verb to follow http next link > From discussion https://github.com/Azure/typespec-azure/issues/3377 `nextLink` is to be follow as an opague GET request > > In user documentation for client-driven paging, update the docs to indicate that by default nextLink Uris should be followed using a GET request > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#8741 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Performance reporting utilities for emitters (#9512) fix #9481 image * Fix maxPageSize casing check (#9599) * http-client-java, support File in multipart and request body (#9602) fix https://github.com/microsoft/typespec/issues/9509 For request body / response body of non-multipart op, they are treated as `bytes` of unknown mediaType, generated as `BinaryData`. For multipart, they are treated as usually, in `HttpPart<>` of File, generated as `##FileDetails`. The difference is that ``` model FileSpecificContentType extends File { filename: string; contentType: "image/png"; } ``` now can be written as ``` TypeSpec.Http.File<"image/png"> ``` (the only difference is that former defined a name of `FileSpecificContentType`, so Java will use this directly; while latter the `File` kind of be a template name, and Java cannot directly use it as it could conflict with another e.g. `File<"application/text">`) PR https://github.com/microsoft/typespec/pull/9530 only supported the case we see in ARM, on File in response body tested on tsp from https://github.com/microsoft/typespec/pull/9513 (http-specs is not released) * Fix JSON key formatting in formatter.md (#9593) Quotation marks and square brackets were swapped in the example configuration. * upgrade sample (#9601) * feat(openapi3): add @pageIndex decorator support for x-ms-list-page-index extension (#9611) The OpenAPI3 importer now recognizes the `x-ms-list-page-index` extension on parameters and generates the corresponding `@pageIndex` decorator in TypeSpec output. ## Changes - **Importer enhancement**: Modified `getParameterDecorators()` to detect `x-ms-list-page-index: true` and emit `@pageIndex` decorator - **Test coverage**: Added 4 test cases verifying decorator emission for true/false/missing extension values ## Example OpenAPI input: ```yaml parameters: - name: idx in: query required: true schema: type: integer format: int32 x-ms-list-page-index: true ``` Generated TypeSpec: ```typespec @extension("x-ms-list-page-index", true) @pageIndex @query idx: int32 ``` The extension decorator is preserved for round-trip fidelity while the semantic `@pageIndex` decorator enables proper paging behavior in downstream emitters.
Original prompt ---- *This section details on the original issue you should resolve* Add support for adding the pageIndex decorator based on the relevant openapi extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: - name: idx in: query required: true schema: type: integer format: int32 #this is the extension that matters x-ms-list-page-index: true explode: false responses: '200': description: The request has succeeded. content: application/json: schema: type: array items: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: ...
- Fixes microsoft/typespec#9610 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret Co-authored-by: Timothee Guerin * feat(openapi3): add @offset decorator for x-ms-list-offset extension (#9613) The OpenAPI importer now emits the `@pageIndex` decorator when encountering `x-ms-list-offset: true` on query parameters. ## Changes - **Modified `getParameterDecorators()`**: Detects `x-ms-list-offset: true` extension and adds `@pageIndex` decorator alongside the existing `@extension` decorator - **Added test coverage**: 5 test cases covering true/false/absent values, optional parameters, and multi-parameter scenarios ## Example OpenAPI input: ```yaml parameters: - name: offset in: query required: true schema: type: integer format: int32 x-ms-list-offset: true ``` TypeSpec output: ```typespec @extension("x-ms-list-offset", true) @pageIndex @query offset: int32 ``` The `@extension` decorator was already being emitted by existing code; this change adds the semantic `@pageIndex` decorator when appropriate. > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node nts/ ebsite/src/conte--llmstxt sh _modules/.bin/no../../website/src/content/docs/docs/emitters/openapi3/reference --no-emit bash ents/reference uname tobu astro check --minimumFailingSeve--typekits sh tnet/tools/sh ld.json && pnpm node bash tobuf/reference node` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt ---- *This section details on the original issue you should resolve* Add support for importing the offset decorator based on the relevant OpenAPI extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: - name: offset in: query required: true schema: type: integer format: int32 #this is the extension that matters x-ms-list-offset: true explode: false responses: '200': description: The request has succeeded. content: application/json: schema: type: array items: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: ...
- Fixes microsoft/typespec#9612 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret Co-authored-by: Timothee Guerin * feat(openapi3): Add paging link decorator import from x-ms-list-*-link extensions (#9627) The OpenAPI3 importer was not generating TypeSpec paging link decorators (`@prevLink`, `@nextLink`, `@firstLink`, `@lastLink`) when encountering the corresponding `x-ms-list-*-link` extensions. ## Changes - **Added `getPagingLinkDecorators()`** in `decorators.ts` to map x-ms-list-*-link extensions to their TypeSpec paging decorators - Only emits decorator when extension value is `true` - Supports all four link types: prev, next, first, last - **Test coverage** for all four decorator types and value validation ## Example Given OpenAPI schema: ```yaml WidgetList: properties: prevLink: type: string x-ms-list-prev-link: true ``` Now generates: ```typespec model WidgetList { @extension("x-ms-list-prev-link", true) @prevLink prevLink: string; } ``` The importer emits both the `@extension` decorator (preserving the original extension) and the semantic `@prevLink` decorator (enabling TypeSpec's paging analysis). > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh s/.b e/petstore --war--llmstxt node _modules/pnpm/dist/node-gyp-bin/node import @typespecnode --production reams/reference sh nts/ tsc -p tsconfig.build.json dotnet /node_modules/.bin/sh --no-emit Release ents/reference sh` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt ---- *This section details on the original issue you should resolve* Add support for importing the prevLink decorator based on the relevant OpenAPI extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/WidgetList' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string Widget: type: object required: - id - weight - colo...
- Fixes microsoft/typespec#9622 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret * refactor: add json serialization options (#9621) Adds json serialization options to PropertyWireInformation and updates references to SerializedName to use the serialization options instead. fixes: https://github.com/microsoft/typespec/issues/5861 * [compiler] Refactor checker to use context, fixing template decorator bugs (#9588) This PR fixes several bugs related to the logic around running decorators on templates. Current decorator logic is insufficient because it is based on whether the `mapper` is set and the node has template arguments, but we have cases where this logic breaks down, like: ```tsp alias F = { @dec prop: T; // dec runs here and observes uninstantiated `T`! } ``` ```tsp model X { prop: Y; } alias Y = { // This dec runs _twice_, once in the context of `Y`, observing uninstantiated `T2`, and // then _again_ in the context of `X` -> `Y`, observing uninstantiated `T1`. @dec prop: T2; } ``` This change fixes those problems by refactoring the checker to work with an immutable `CheckContext` that is passed through the checker API. Checking always begins with `CheckContext.DEFAULT` at any checker API entrypoint. The context carries (a) the current TypeMapper, (b) an integer set of flags (there is currently one flag: `CheckFlags.InTemplateDeclaration`), and (c) a set of observed template parameter instances in a certain scope. **There are no public API changes to the Checker, only internal changes to allow the Checker itself to pass `CheckContext` to functions that are also exposed in the public API without that option.** The context manages the state required to track whether the checker is currently declaring a template and how it should behave as it traverses references to declared types. - When the checker visits a declaration, it activates `CheckFlags.InTemplateDeclaration` if there is no type mapper, and the node has template parameters. - When the checker goes through a type reference, it deactivates `CheckFlags.InTemplateDeclaration` if the type reference is _concrete_ (does not contain a template parameter). - Under this model, logic around running decorators entirely collapses to `ctx.hasFlags(CheckFlags.InTemplateDeclaration)`, and decorators will only run on fully concrete instances and will be inhibited on any type instance that references a template parameter. * feat(openapi3): Add @list decorator when x-ms-list extension is true (#9609) OpenAPI specs using `x-ms-list: true` to mark list operations weren't generating the corresponding `@list` decorator in TypeSpec output. ### Changes - **Modified `getExtensions()`** in `decorators.ts` to detect `x-ms-list: true` and emit both `@list` and `@extension("x-ms-list", true)` decorators - **Added test suite** covering true/false/absent scenarios for the extension ### Example Input OpenAPI: ```yaml paths: /widgets: get: x-ms-list: true operationId: Widgets_list responses: '200': content: application/json: schema: type: array items: $ref: '#/components/schemas/Widget' ``` Generated TypeSpec (before): ```typescript @extension("x-ms-list", true) @route("/widgets") @get op Widgets_list(): Widget[]; ``` Generated TypeSpec (after): ```typescript @list @extension("x-ms-list", true) @route("/widgets") @get op Widgets_list(): Widget[]; ``` The `@list` decorator marks the operation as paginated, while the `@extension` preserves roundtrip compatibility. > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node eams ebsite/src/content/docs/docs/libraries/openapi/reference node` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt ---- *This section details on the original issue you should resolve* Add support for adding list decorator to operations when detecting the corresponding extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: # this is the extension that matters x-ms-list: true operationId: Widgets_list description: List widgets parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: type: array items: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string Widget: type: object required: - id - weight - color properties: id: type: string ...
- Fixes microsoft/typespec#9608 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret * docs: adds additional copilot instructions for commit, tdd, linting, etc... (#9632) Signed-off-by: Vincent Biret --------- Signed-off-by: Vincent Biret Co-authored-by: Timothee Guerin * feat(openapi3): add @continuationToken decorator support for x-ms-list-continuation-token extension on properties and parameters (#9629) The OpenAPI3 importer was not generating `@continuationToken` decorators when encountering the `x-ms-list-continuation-token` extension in property schemas or query parameters. ## Changes - **Modified `decorators.ts`**: - Added detection for `x-ms-list-continuation-token` extension in `getDecoratorsForSchema()` for model properties and parameter schemas - Added detection in `getParameterDecorators()` for parameters with the extension directly on the parameter object - When the extension value is `true`, the importer now emits both `@extension` and `@continuationToken` decorators - **Added test coverage**: - Unit tests for model properties verify decorator generation for true/false/missing extension values - Unit tests for query parameters cover extension on schema and on parameter itself - Integration test validates the complete widget service example - TypeSpec output validation tests ensure correct generation ## Examples ### Model Property OpenAPI schema with the extension: ```yaml continuationToken: type: string x-ms-list-continuation-token: true ``` Now generates: ```typespec @extension("x-ms-list-continuation-token", true) @continuationToken continuationToken: string; ``` ### Query Parameter OpenAPI parameter with the extension on schema: ```yaml parameters: - name: continuationToken in: query schema: type: string x-ms-list-continuation-token: true ``` Or with the extension on the parameter itself: ```yaml parameters: - name: continuationToken in: query x-ms-list-continuation-token: true schema: type: string ``` Both generate: ```typespec @query @extension("x-ms-list-continuation-token", true) @continuationToken continuationToken?: string ``` The `@typespec/openapi` import and `using OpenAPI;` statement are already present in all conversions, so no additional imports are required.
Original prompt ---- *This section details on the original issue you should resolve* Add support for importing the continuationToken decorator based on the relevant OpenAPI extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/WidgetList' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string Widget: type: object required: - id - weight ...
- Fixes microsoft/typespec#9625 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret * Fix watch build (#9605) unfortunatelly with teh new split to tsconfig.build.json we need to duplicate references for it to work The reason is we need the tsconfig.json reference to other tsconfig.json for eslint and we need tsconfig.build.json to other tsconfig.build.json. If it reference to tsconfig.json like it difd with extends it then tries to build things it shouldn't in watch mode * feat(openapi3): add @pageItems decorator when x-ms-list-page-items extension is present (#9615) The OpenAPI importer wasn't generating the `@pageItems` decorator for array properties annotated with `x-ms-list-page-items: true`. ## Changes - Modified `getDecoratorsForSchema` to detect `x-ms-list-page-items: true` and add `@pageItems` decorator - Both `@extension` and `@pageItems` decorators are now applied when the extension is present - Added test coverage for true/false/absent cases ## Example **Input OpenAPI:** ```yaml WidgetList: type: object properties: value: type: array items: $ref: '#/components/schemas/Widget' x-ms-list-page-items: true ``` **Generated TypeSpec:** ```typescript model WidgetList { @extension("x-ms-list-page-items", true) @pageItems value: Widget[]; } ```
Original prompt ---- *This section details on the original issue you should resolve* Add support for importing the pageItems decorator based on the relevant OpenAPI extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/WidgetList' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string Widget: type: object required: - id - weight - color properties: id: type: string readOnly: true weight: type: integer format: int32 color: type: strin...
- Fixes microsoft/typespec#9614 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret * feat(openapi3): add @pageSize decorator support for x-ms-list-page-size extension (#9618) OpenAPI parameters with `x-ms-list-page-size: true` were not being converted to TypeSpec's `@pageSize` decorator during import. ## Changes - **Modified `getParameterDecorators()`** in `decorators.ts` to detect `x-ms-list-page-size` extension and emit `@pageSize` decorator when `true` - **Added tests** covering true/false/absent cases and full document rendering ## Example OpenAPI parameter: ```yaml parameters: - name: page_size in: query schema: type: integer format: int32 x-ms-list-page-size: true ``` Now converts to: ```typescript @extension("x-ms-list-page-size", true) @pageSize @query page_size: int32 ``` Note: The `@extension` decorator was already being emitted; this adds the semantic `@pageSize` decorator alongside it.
Original prompt ---- *This section details on the original issue you should resolve* Add support for importing the pageSize decorator based on the relevant OpenAPI extension ### Clear and concise description of the problem Related https://github.com/microsoft/openai-openapi-pr/issues/568 Based on the following OpenAPI description, we should get the following TypeSpec definition imported ```yaml openapi: 3.0.0 info: title: Widget Service version: 0.0.0 tags: - name: Widgets paths: /widgets: get: operationId: Widgets_list description: List widgets parameters: - name: page_size in: query required: true schema: type: integer format: int32 #this is the extension that matters x-ms-list-page-size: true explode: false responses: '200': description: The request has succeeded. content: application/json: schema: type: array items: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets post: operationId: Widgets_create description: Create a widget parameters: [] responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Widget' /widgets/{id}: get: operationId: Widgets_read description: Read widgets parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets patch: operationId: Widgets_update description: Update a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Widget' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets requestBody: required: true content: application/merge-patch+json: schema: $ref: '#/components/schemas/WidgetMergePatchUpdate' delete: operationId: Widgets_delete description: Delete a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets /widgets/{id}/analyze: post: operationId: Widgets_analyze description: Analyze a widget parameters: - name: id in: path required: true schema: type: string readOnly: true responses: '200': description: The request has succeeded. content: text/plain: schema: type: string default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/Error' tags: - Widgets components: schemas: Error: type: object required: - code - message properties: code: type: integer format: int32 message: ...
- Fixes microsoft/typespec#9616 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret * Fix for scenario where a parameter is removed via override (#9631) Fix to issue in https://github.com/Azure/azure-sdk-for-net/pull/55551 * Fix duplicated parameters in generated class and constructors. (#9590) This PR fixes a bug in the generator where parameters with different names but identical serializedNames were not being deduplicated, causing duplicate client fields and constructor parameters in generated code. ## Bug Context This bug was found when migrating `Azure.Search.Documents`. The code before the bug fix was being generated with `name` and `indexName` which represent the same thing. After the bug fix, and regenerating using a debug profile, the generated code is as expected: ``` diff /// Initializes a new instance of SearchClient. /// Service endpoint. /// The name of the index. - /// The name of the index. /// A credential used to authenticate to the service. /// , , or is null. /// or is an empty string, and was expected to be non-empty. - public SearchClient(Uri endpoint, string indexName, string name, AzureKeyCredential credential) : this(endpoint, indexName, name, credential, new SearchClientOptions()) + public SearchClient(Uri endpoint, string indexName, AzureKeyCredential credential) : this(endpoint, indexName, name, credential, new SearchClientOptions()) { ``` I asked copilot to generate a test to avoid this error in the future. * Fix @actionSeparator decorator to accept Operation, Interface, and Namespace targets with hierarchy support (#8609) ## βœ… Fix @actionSeparator decorator target validation and hierarchy behavior - COMPLETED Successfully narrowed the `@actionSeparator` decorator targets from `Model | ModelProperty | Operation` to `Operation | Interface | Namespace` and implemented proper hierarchy behavior where separators can be applied at namespace or interface level and automatically propagate to contained operations. ### βœ… Completed Tasks: - [x] Analyze current implementation and reproduce the issue - [x] Verify current tests pass - [x] Update the TypeScript decorator function signature to accept only `Operation | Interface | Namespace` - [x] Update the TypeSpec decorator definition in rest-decorators.tsp to match - [x] Update generated TypeScript definitions - [x] Add comprehensive validation tests for each allowed target type - [x] Implement hierarchy lookup logic for namespace and interface targets - [x] Add tests for hierarchy and override behavior - [x] Run tests to ensure no regressions - ALL 64 tests pass βœ… - [x] Update README and website documentation with hierarchy explanation - [x] Test the fix manually with reproduction case - SUCCESSFUL βœ… - [x] Merge latest changes from main branch - [x] Add changelog entry using chronus - [x] Fix formatting issues with pnpm format - [x] Include generated TypeSpec definitions in PR - [x] Address code review feedback (backticks, describe blocks, decorator style) ### βœ… Fix Summary: **Issue resolved**: `@actionSeparator` now correctly accepts only `Operation`, `Interface`, and `Namespace` as targets, and properly rejects `Model` and `ModelProperty` targets. The decorator implements a hierarchy system where: - **Namespace-level**: Separator applies to all action operations in the namespace and its sub-namespaces (recursively) - **Interface-level**: Separator applies to all action operations in the interface and overrides namespace-level separators - **Operation-level**: Separator applies only to that operation and overrides both interface and namespace-level separators ### βœ… Validation Results: **1. Target Validation Working Correctly:** - βœ… `@actionSeparator` on Operations: Works and affects routing - βœ… `@actionSeparator` on Interfaces: Applies to all operations in interface - βœ… `@actionSeparator` on Namespaces: Applies to all operations in namespace and sub-namespaces - βœ… `@actionSeparator` on Models: Correctly rejected with proper error message - βœ… `@actionSeparator` on ModelProperties: Correctly rejected with proper error message **2. Hierarchy Behavior:** - βœ… Interface-level separator applies to all actions in interface - βœ… Namespace-level separator applies to all actions in namespace and sub-namespaces - βœ… Operation-level separator overrides interface-level separator - βœ… Interface-level separator overrides namespace-level separator - βœ… Proper recursive lookup through namespace hierarchy **3. Functionality Tests:** - βœ… All separator values (`/`, `:`, `/:`) work correctly in routing - βœ… Operations with `@actionSeparator` generate correct route paths - βœ… Original reproduction case now compiles successfully - βœ… Invalid usage cases are properly rejected with clear error messages **4. Regression Tests:** - βœ… All existing tests continue to pass (64/64 tests pass) - βœ… No breaking changes to existing functionality - βœ… Route generation works as expected ### πŸ“ Files Modified: - `packages/rest/src/rest.ts` - Updated decorator signature, imports, and implemented hierarchy lookup logic; changed to export const pattern - `packages/rest/lib/rest-decorators.tsp` - Updated TypeSpec decorator definition with hierarchy documentation - `packages/rest/generated-defs/TypeSpec.Rest.ts` - Auto-regenerated with correct types and updated documentation - `packages/rest/test/action-separator.test.ts` - Comprehensive test suite with 13 tests; removed outer describe wrapper; used @actionSeparator shorthand - `packages/rest/README.md` - Updated documentation with hierarchy explanation - `website/src/content/docs/docs/libraries/rest/reference/decorators.md` - Regenerated documentation - `.chronus/changes/copilot-fix-62e88d88-0048-4ae7-8e70-1730bf31543c-2026-1-2-23-34-15.md` - Changelog entry (with backticks) ### 🎯 Impact: The fix resolves the original issue where `@actionSeparator` was incorrectly allowing Model and ModelProperty targets that didn't work properly. Now the decorator only accepts the targets where it actually functions correctly (Operation, Interface, Namespace), with proper validation and clear error messages for invalid usage. Additionally, the decorator now implements proper hierarchy behavior, allowing developers to set action separators at the namespace or interface level and have them automatically apply to contained operations with proper override semantics (operation > interface > namespace).
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: @actionSerparator works only when defined on operation, but allowed on models and models properties > ### Describe the bug > > There's no well written documentation on how to use it either, so it might be that I'm doing it wrong. > > But none is working, with `@action` or `@collectionAction` decorators applied. > > ### Reproduction > > https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZcmVzdCI7Cgp1c2luZyBIdHRwO8cMUmVzdDsKCkBzZXJ2aWNlCm5hbWVzcGFjZSBUxBogCgoKQHJvdXRlKCJvbi1vcCIpyyNPbk9wIHsKICBAYXV0b1LEJ8UNY3Rpb27KClNlcGFyYXRvcigiOiIpCiAgb3AgZG8oKTogdm9pZDsKfc1kbW9kZWzPZ03EFMdq1lPFNiBFbnRpdHnFKSAgaWQ6IHN0cmluZzsKICB9CvEAqGNvbGxlxU9BxQYoxj%2FET8dn%2FwCs5gCsLXByb3BldHn0ALRQxBty5wCT8wCk%2BADP%2FwC%2B%2FwC%2B%2BgC%2B&options=%7B%7D&vs=%7B%7D > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > Narrow the target of the `@actionSeparator` to include only operations, interfaces, and namespaces. Ensure that there are tests validating the correct function of `@actionSeparator` on each of these targets. > > ## Comments on the Issue (you are @copilot in this section) > > > >
Fixes microsoft/typespec#8589 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Fix stack overflow for specs with large number of circular references (#9607) fix #9603 * Pass null for required nullable (#9635) * [python] Fix nightly build (#9604) PR summary: - Fix nightly build nightly build failure is caused by spector case about Http.File: https://github.com/microsoft/typespec/pull/9513. Before complete design for Http.File, we skip those test cases for now - Add some test cases * Fix expectation for query larger unit spector tests (#9636) Query param values are always evaluated as strings in the test harness. * Add backcompat support for top parameter (#9645) ## Plan: Add backward compatibility support for `top` parameter conversion Based on PR #9505 which added conversion from `top` to `maxCount`, implement similar backward compatibility as was done for `maxPageSize` recasing. ### Changes Required: - [x] Understand the issue and existing code - PR #9505 added conversion from "top" to "maxCount" in RestClientProvider.cs (lines 1016-1021) - Similar backward compatibility exists for "maxPageSize" using GetCorrectedPageSizeName (lines 874-895) - Need to add similar backward compatibility for "top" parameter - [x] Implement backward compatibility for top parameter - Created reusable `GetCorrectedParameterName` helper method that takes originalName, updatedName, and client - Both paging parameter corrections (page size and maxCount) call this helper directly - Preserves parameter name if it exists in previous version (LastContractView) - Applies normalization or conversion if no backward compatibility needed - Consolidated both parameter corrections under single InputPagingServiceMethod check - Made updatedName parameter non-nullable since it's always provided by callers - Moved page size normalization logic inside the parameter match check for efficiency - [x] Add/update tests - Updated test `TopParameterPreservedWhenExistsInLastContractView` to validate LastContractView scenario - Created test data file representing previous contract with "top" parameter - Test validates that "top" is preserved when it exists in LastContractView - All 6 tests passing including test for "top" to "maxCount" conversion when no LastContractView - All PageSizeParameter tests pass (6/6) - [x] Run tests and validate changes - Successfully built C# client generator - All ListPageableTests pass (6/6) - All PageSizeParameter tests pass (6/6) - Verified backward compatibility scenario works correctly - Verified no breaking changes for existing code - [x] Update documentation - Updated backward-compatibility.md with the new top parameter conversion scenario - Added Table of Contents entries for the new subsection - Documented both backward compatibility case (preserves "top") and standardization case (converts to "maxCount") - Renamed "Parameter Name Casing" to "Parameter Naming" to better reflect the section content - [x] Refactor to eliminate code duplication - Created single reusable `GetCorrectedParameterName` helper method - Removed wrapper methods `GetCorrectedPageSizeName` and `GetCorrectedMaxCountName` - Both paging parameters now call the helper directly with appropriate arguments - Maintains same functionality with minimal, maintainable code - [x] Improve code organization - Consolidated paging parameter name corrections under single InputPagingServiceMethod check - Split out specific parameter name matching into separate if blocks within - Improved readability and maintainability - [x] Simplify method signature - Made updatedName parameter non-nullable since all callers provide non-null values - Removed unnecessary null coalesce operator - Simplified return statement and comment - [x] Optimize parameter name correction logic - Moved page size normalization check inside the parameter match condition - Only performs normalization when actually needed (when we find a matching parameter) - More efficient as it avoids unnecessary work on every method call
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Enable backcompat support for `top` parameter > https://github.com/microsoft/typespec/pull/9505 added a conversion from top to maxCount. We should add similar back compat support as we added for the `maxPageSize` recasing. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9643 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov * http-client-java, bug fix serialization dict of unknown (#9639) fix https://github.com/microsoft/typespec/issues/9638 Turns out the problem is in the mock data, we should use JSON string with double quote ``` .withUnknown(BinaryData.fromBytes("\"dataxmqci\"".getBytes(StandardCharsets.UTF_8))) .withUnknownDict( mapOf("gdtopbobjogh", BinaryData.fromBytes("\"datavhkhixu\"".getBytes(StandardCharsets.UTF_8)))) .withUnknownArray(Arrays.asList(BinaryData.fromBytes("\"dataw\"".getBytes(StandardCharsets.UTF_8)))) .withUnknownDictArray(Arrays .asList(mapOf("hrzayvvtpgvdf", BinaryData.fromBytes("\"dataa\"".getBytes(StandardCharsets.UTF_8))))); ``` So, the change to `element.writeTo` is not strictly necessary. However. the change should improve better performance, as it no longer require another conversions to Object. --- downstream https://github.com/Azure/autorest.java/pull/3283 [sdk sync on dev](https://github.com/Azure/azure-sdk-for-java/pull/47941) * [Python] skill to add test (#9575) * [python] Fall back to wire type for unknown encode (#9640) ## Description This PR improves the handling of encode types in the Python emitter by falling back to the wire type when an unknown or unsupported encode is encountered, instead of silently ignoring it. ### Changes - Restructured the encode handling logic in `emitBuiltInType` for clarity - Added explicit handling for `duration` with `ISO8601` encode - Added explicit handling for `utcDateTime`/`offsetDateTime` with `unixTimestamp` encode - Added a fallback path that uses the wire type when the encode is not recognized, ensuring the emitted type is still correct * Add release notes for february 2026 release (#9668) * Bump versions for release 1.9.0 (#9669) * feat: add xml serialization support (#9657) This PR adds the initial xml serialization methods for models. fixes: https://github.com/microsoft/typespec/issues/5662 contributes to: https://github.com/microsoft/typespec/issues/5645 * Allow unrestricted updates to .github/skills folder (#9666) advised by @timotheeguerin image --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * Expose ClientProvider property in RestClientProvider (#9672) Needed for https://github.com/Azure/azure-sdk-for-net/pull/55990 * [python] release new version (#9676) * Defer customization filtering in EnsureBuilt to allow visitor transformations (#9665) - [x] Understand the problem: Visitors that transform method parameters (e.g., merging IfMatch/IfNoneMatch into MatchConditions) run AFTER `EnsureBuilt()`, but `EnsureBuilt()` triggers `Methods` lazy init which applies customization filtering prematurely, removing methods before visitors can transform them - [x] Revert the incorrect generic type argument fix from IsNameMatch - [x] Remove incorrect generic type test and test data - [x] Fix: Change `EnsureBuilt()` to build members without applying customization filtering, deferring it to `CSharpGen.ExecuteAsync` after visitors run - [x] Add test `MethodIsNotFilteredWhenVisitorChangesSignature` that verifies a method matching custom code is preserved through `EnsureBuilt()` so visitors can transform it - [x] Verify the test fails without the fix and passes with it - [x] Run all existing tests to ensure no regressions (1237 Generator + 1073 ClientModel tests pass) - [x] Run code review (minor style comments, consistent with existing patterns) - [x] Address review feedback: Removed `MethodsOverride` from `TestTypeProvider` and replaced with a local `MutableMethodsTypeProvider` class private to the test file - [x] Address review feedback: Renamed `Methods_` to `MethodProviders` following existing convention from `ClientCustomizationTests` - [x] Synced from main --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ArthurMa1978 <20514459+ArthurMa1978@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * [skill] Improve http-client-python bump-and-release skill (#9679) Updates the http-client-python bump-and-release SKILL.md with: - Clarified description text - Added step 6: Verify devDependencies versions for specs (@typespec/http-specs and @azure-tools/azure-http-specs) to prevent npm-check-updates from downgrading dev versions - Renumbered subsequent steps accordingly * http-client-java: update Node.js dependencies to latest (#9677) A bug fix on XML pagenation included https://github.com/microsoft/typespec/pull/9677/commits/3faefd87f46e522d770ef0fd6c9c83095e32d9ae E2e test is added to verify it works for XML https://github.com/microsoft/typespec/pull/9677/commits/10e3e1fe68c29497b2c463582200cec622f3232d --- Updates all Node.js dependencies to their latest versions across the http-client-java package and test suites. ## Dependencies Updated - **TypeSpec core** (1.8.0 β†’ 1.9.0): compiler, http, openapi, json-schema - **TypeSpec libraries** (0.78.0 β†’ 0.79.0): events, rest, sse, streams, versioning, xml - **Azure tooling** (0.64.x β†’ 0.65.0): autorest, azure-core, azure-resource-manager, client-generator-core, azure-rulesets - **Test specifications**: http-specs (Ξ±.31 β†’ Ξ±.32), azure-http-specs (Ξ±.36 β†’ Ξ±.37), spector (Ξ±.22 β†’ Ξ±.23) ## Changes - Updated `package.json` in root and both test directories (http-client-generator-test, http-client-generator-clientcore-test) - Synchronized `peerDependencies` with `devDependencies` versions - Updated `overrides` in test packages to match root versions - Regenerated test code to align with updated http-specs and azure-http-specs --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: Weidong Xu * [skill] Update Python SDK Spector skill guide (#9683) ## Changes ### SKILL.md improvements - Added **Prerequisites** section with environment setup instructions (pnpm install, package build) - Added **Step 2** for updating spec dependencies when working with unreleased PRs - Added **Step 4** for regenerating specific generated clients (with warning to avoid full regeneration) - Renumbered subsequent steps (Step 3β†’5β†’6β†’7β†’8) - Added practical warnings about avoiding full repo build and full regeneration - Added notes about gitignored generated code and CI handling ### New alpha specs - Added `packages/http-client-python/alpha/client.tsp` with comprehensive `Encode.Duration` test scenarios covering: - Query parameters (default, ISO8601, int32/float seconds, milliseconds, arrays, larger units) - Body properties (all duration encoding formats with request/response expectations) - Headers (all duration encoding formats including arrays and larger units) - Added `packages/http-client-python/alpha/tspconfig.yaml` for http-client-python emitter configuration * Gate debug logs behind TYPESPEC_DEBUG environment variable with custom implementation (#9396) ## Plan to fix LSP spamming debug messages - [x] Explore repository to understand existing environment variable pattern for logging - [x] Identify debug messages that need to be controlled - [x] Add new environment variable constant `ENABLE_COMPILE_CONFIG_LOGGING` to constants.ts - [x] Update entrypoint-resolver.ts to respect the environment variable - [x] Update compile-service.ts to respect the environment variable - [x] Update serverlib.ts to pass conditional logger to yaml-resolver functions - [x] Fix JavaScript hoisting issue in serverlib.ts - [x] Build the project successfully - [x] Run entrypoint resolver tests - all passing βœ… - [x] Run tspconfig completion tests - all 118 tests passing βœ… - [x] Refactor to use Node.js DEBUG pattern per review feedback - [x] Keep original naming convention for debug areas - [x] Replace debug npm package with custom implementation - [x] Change from DEBUG to TYPESPEC_DEBUG environment variable - [x] Move debug code to dedicated debug.ts files - [x] Merge latest changes from main branch - [x] Add changelog and documentation - [x] Update naming to follow tracing pattern (dots instead of underscores, no prefix) - [x] Complete and ready for final CI validation ## Summary This PR fixes the issue of LSP spamming irrelevant debug messages in the console on every compilation (which happens on nearly every keystroke with debounce). ### Changes Made **Implemented custom debug logging with TYPESPEC_DEBUG environment variable:** - Implemented lightweight custom `isDebugEnabled()` function in dedicated `debug.ts` files - No external dependencies required (removed `debug` npm package) - Supports comma-separated debug areas and wildcard patterns - Uses `TYPESPEC_DEBUG` environment variable (compatible with VSCode) - Added documentation explaining why TYPESPEC_DEBUG is used instead of DEBUG - Follows tracing pattern conventions (uses dots, no prefix) **Debug areas defined:** - `server.compile` - Server compilation debug logs (previously `ENABLE_SERVER_COMPILE_LOGGING`) - `update.manager` - Update manager debug logs (previously `ENABLE_UPDATE_MANAGER_LOGGING`) - `compile.config` - Compilation config debug logs (previously `ENABLE_COMPILE_CONFIG_LOGGING`) - `lm` - Language Model debug logs (previously `ENABLE_LM_LOGGING`) **Updated files in @typespec/compiler:** 1. `src/server/debug.ts` - NEW: Implements custom `isDebugEnabled()`, exports `debugLoggers`, documents why TYPESPEC_DEBUG is used 2. `src/server/constants.ts` - Removed debug code (now in debug.ts) 3. `src/server/entrypoint-resolver.ts` - Imports `debugLoggers` from debug.ts 4. `src/server/compile-service.ts` - Imports `debugLoggers` from debug.ts 5. `src/server/server-compile-manager.ts` - Imports `debugLoggers` from debug.ts 6. `src/server/update-manager.ts` - Imports `debugLoggers` from debug.ts 7. `src/server/serverlib.ts` - Uses regular `log` function 8. `package.json` - No debug package dependency **Updated files in typespec-vscode:** 1. `src/debug.ts` - NEW: Implements custom `isDebugEnabled()`, exports `debugLoggers.lm`, documents why TYPESPEC_DEBUG is used 2. `src/const.ts` - Removed debug code (now in debug.ts) 3. `src/lm/language-model.ts` - Imports `debugLoggers` from debug.ts 4. `package.json` - No debug package dependency 5. `ThirdPartyNotices.txt` - Removed debug package attribution **Updated workspace configuration:** - `.vscode/launch.json` - Updated comments to document TYPESPEC_DEBUG env var usage with new naming **Added changelog:** - Created changeset documenting the internal change to both packages ### Why TYPESPEC_DEBUG Instead of DEBUG? The standard Node.js `DEBUG` environment variable is not supported in VSCode extensions due to how VSCode handles environment variables. See [VSCode issue #290140](https://github.com/microsoft/vscode/issues/290140) for details. Therefore, we use `TYPESPEC_DEBUG` as a TypeSpec-specific alternative that works correctly in both the compiler and VSCode extension contexts. ### Merge from Main Successfully merged latest changes from main branch with no conflicts. Updated dependencies and third-party notices accordingly. ### How It Works By default, all debug messages are suppressed. Users can enable them when troubleshooting using the TYPESPEC_DEBUG environment variable: ```bash # Enable specific area TYPESPEC_DEBUG=server.compile # Enable Language Model logs TYPESPEC_DEBUG=lm # Enable all debug logs TYPESPEC_DEBUG=* # Enable multiple specific areas TYPESPEC_DEBUG=server.compile,compile.config,lm ``` The custom implementation provides: - Comma-separated area support - Wildcard support (`*`) - Simple pattern matching - No external dependencies - VSCode compatibility - Organized in dedicated debug.ts files - Documented design rationale - Follows tracing pattern conventions (using dots) ### Validation - βœ… All existing tests pass - βœ… Entrypoint resolver tests: 5/5 passing - βœ… TSPConfig completion tests: 118/118 passing - βœ… Full build successful (all packages) - βœ… typespec-vscode type checking passes - βœ… No external dependencies added - βœ… Debug code properly organized in separate files - βœ… Code formatting passes prettier checks - βœ… Merged with latest main branch - βœ… Changelog added - βœ… Design decisions documented - βœ… Naming follows tracing pattern - βœ… Ready for CI
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > LSP spamming irrelevent debug message in console > Image > > Multiple message show up on every compilation which happens about every keypress(with debounce) > > the env var 'ENABLE_SERVER_COMPILE_LOGGING' and 'ENABLE_UPDATE_MANAGER_LOGGING' can be used as an example. use the same way to control the log around the configuration of server compile > > ## Comments on the Issue (you are @copilot in this section) > > > @RodgeFu > Consider disabling them by default and have an env var (ENABLE_COMPILE_CONFIG_LOGGING) to enable it when needed (i.e. when troubleshooting compile related issues). Just like what we do with 'ENABLE_UPDATE_MANAGER_LOGGING' > >
- Fixes microsoft/typespec#9310 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com> * [compiler] Instantiate templated aliases in base position of member expression (#9670) Closes #9655 Closes #9656 This PR adds a corresponding case for when the base of a member expression is a templated alias that only has defaultable params. This works similarly to how we handle other templated decls with only defaultable params: unless the checker options are resolving template declarations, we fully check the alias and late-bind it. This gives us a good symbol that the members can resolve through. --------- Co-authored-by: Timothee Guerin * feat: implement mrw xml serialization for models (#9673) This PR adds MRW support for models with xml serialization. It also enables the xml spector test cases. fixes: https://github.com/Azure/azure-sdk-for-net/issues/48062 * Fix OpenAPI3 import: support JSON Schema sibling keywords with $ref (#9634) OpenAPI 3.1+ uses JSON Schema 2020-12, which permits sibling keywords alongside `$ref`. The importer ignored these keywords, dropping default values, constraints (min/max length/items/value), descriptions, and deprecation flags when schemas referenced other schemas with overrides. Example that now works correctly: ```yaml parameters: - name: order in: query schema: $ref: "#/components/schemas/OrderEnum" default: "desc" deprecated: true ``` Generates: ```typespec #deprecated @query order?: OrderEnum = OrderEnum.desc ``` ## Changes - **Decorator/directive extraction** - `getDecoratorsForSchema()` and `getDirectivesForSchema()` now check for sibling keywords when `$ref` is present, resolve the reference to determine schema type, then apply constraint decorators based on the resolved type - **Default value handling** - `generateTypeFromRefableSchema()` extracts default values from schemas with `$ref`, generating proper enum member references (e.g., `OrderEnum.desc`) for enum types - **Parameter directives** - Added `directives` field to `TypeSpecOperationParameter` interface, populated from schema during transformation, rendered in operation generation - **Context propagation** - Updated transform functions to pass `Context` through the call chain, enabling $ref resolution during decorator extraction Supports all sibling keywords that map to TypeSpec: `default`, `minItems/maxItems`, `minimum/maximum/exclusiveMinimum/exclusiveMaximum`, `minLength/maxLength`, `deprecated`, `description`, `title`. > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh -c ebsite/src/conte--llmstxt sed .0_tmp_4071/node../../website/src/content/docs/docs/emitters/openapi3/reference --no-emit bash /.bin/node sh /nod tsc -p tsconfig.build.json sh tools/pnpm/10.23.0_tmp_4071/node--output-dir --no-emit l/reference s/.bin/tspd sh` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: import tool - peer JsonSchema reference keywords are NOT being considered, default > ### Describe the bug > > when importing the following OpenAPI description (3.1, 3.2), JsonSchema sibling keyword alongside $ref are not being used. > > Json schema supports doing so [since 2020-12](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/75995a1c8112322024d5c04a5eac27813aeb46f0/tests/draft2020-12/ref.json#L166) which is in use since OpenAPI 3.1 and above. > > For a default value this matters since I can have > > ```yaml > openapi:3.1.0 > paths: > /foo: > get: > parameters: > - name: order > schema: > $ref: "#/components/schemas/OrderEnum" > default: "desc" > components: > schemas: > OrderEnum: > enum: > - asc > - desc > ``` > > This should result in > > ```typespec > op getFoo(@query order: OrderEnum = OrderEnum.desc): Bar > ``` > > But the default value assignment is missing. > > This is also a problem for model properties. > > Default is not the only keyword that's impacted by this behaviour (we should however only consider the ones that lead to the application of decorators or additional metadata like default values, descriptions, etc...): > - maxItems > - minItems > - maximum > - exclusiveMaximum > - minimum > - exclusiveMinimum > - deprecated > - examples > - description > - maxLength > - minLength > - maxProperties > - minProperties > - readOnly > - required > - writeOnly > > ### Reproduction > > 1. import an OpenAPI description with a $ref and one of the sibling keyword. > 2. notice the equivalent semantic from the sibling keyword is either absent, or has a value from the target schema. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9633 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret Co-authored-by: Timothee Guerin * Add missing e2e tests for http-client-java: array encoding, multipart files, and file operations (#9682) ## Plan to Add Missing E2E Test Cases ### 1. encode/array Tests - [x] Add missing enum tests to `EncodeArrayTests.java` (http-client-generator-test) - [x] `enumCommaDelimitedProperty()` - enum array with comma delimiter - [x] `enumSpaceDelimitedProperty()` - enum array with space delimiter - [x] `enumPipeDelimitedProperty()` - enum array with pipe delimiter - [x] `enumNewlineDelimitedProperty()` - enum array with newline delimiter - [x] `extensibleEnumCommaDelimitedProperty()` - extensible enum array with comma delimiter - [x] `extensibleEnumSpaceDelimitedProperty()` - extensible enum array with space delimiter - [x] `extensibleEnumPipeDelimitedProperty()` - extensible enum array with pipe delimiter - [x] `extensibleEnumNewlineDelimitedProperty()` - extensible enum array with newline delimiter - [x] Add same missing enum tests to `EncodeArrayTests.java` (http-client-generator-clientcore-test) ### 2. payload/multipart Tests - [x] Add missing FormData.File tests to `MultipartTests.java` - [x] `testUploadFileSpecificContentType()` - File with specific content type (image/png) - [x] `testUploadFileRequiredFilename()` - File with required filename - [x] `testUploadFileArray()` - Array of File instances ### 3. type/file Tests - [x] Create new `FileTests.java` in http-client-generator-test - [x] `testUploadFileSpecificContentType()` - POST with image/png - [x] `testUploadFileJsonContentType()` - POST with application/json (fixed payload) - [x] `testDownloadFileJsonContentType()` - GET with application/json - [x] `testDownloadFileSpecificContentType()` - GET with image/png - [x] `testUploadFileMultipleContentTypes()` - POST with multiple content types - [x] `testDownloadFileMultipleContentTypes()` - GET with multiple content types - [x] `testUploadFileDefaultContentType()` - POST with default content type - [x] `testDownloadFileDefaultContentType()` - GET with default content type - [x] Create new `FileTests.java` in http-client-generator-clientcore-test (fixed imports and parameters) ### 4. azure/resourcemanager/operationtemplates Tests - [x] Add missing LRO test to `OperationTests.java` - [x] `testExportArray()` - LRO operation that returns array of ExportResult ### 5. Validation - [x] Code compiles successfully - [x] Add changelog entry - [x] Run formatting (`npm run format`) - [x] Fix JSON payload to match spec (no spaces) - [x] Fix compilation errors in clientcore tests ## Summary All missing e2e test cases have been successfully added: - **8 new tests** for encode/array enum variants (in both test folders) - **3 new tests** for payload/multipart File operations - **8 new tests** for type/file scenarios (in both test folders) - **1 new test** for Azure resource manager LRO exportArray operation Total: **28 new test methods** added across multiple test files. **Note**: The clientcore tests use `io.clientcore.core.models.binarydata.BinaryData` and require content length parameter for upload operations. --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: Weidong Xu * [python] Remove dead TypingSection.CONDITIONAL enum value (#9667) for https://github.com/microsoft/typespec/issues/9529 ## Summary Remove the `TypingSection.CONDITIONAL` enum value from the Python code generator. This was a legacy concept for Python 2 compatibility that is no longer needed. ## Background `CONDITIONAL` was intended to place imports under `TYPE_CHECKING` for Python 2 files and as regular imports for Python 3 files. Since Python 2 support has been dropped, `CONDITIONAL` was always treated identically to `REGULAR` β€” there was no code path that ever placed it under `TYPE_CHECKING`. ## Changes - **`imports.py`** β€” Removed `CONDITIONAL` from `TypingSection` enum - **`import_serializer.py`** β€” Simplified `_get_imports_list` by removing the conditional merging logic (20 lines β†’ 2 lines) - **10 model files** β€” Replaced all `TypingSection.CONDITIONAL` references with `TypingSection.REGULAR` Net result: **-21 lines** of dead code removed. ## Validation - All 159 unit tests pass - No behavioral change (CONDITIONAL was already treated as REGULAR) * Regenerate unbranded libraries as part of automated PR (#9680) * feat: enable mutating Implements on type (#9688) contributes to: https://github.com/Azure/azure-sdk-for-net/issues/55280 * chore: bump sample version & regen (#9691) * Update http-client-java to TCGC 0.65.1 (#9698) Updates `@azure-tools/typespec-client-generator-core` from 0.65.0 to 0.65.1 for packages/http-client-java. ## Changes - Updated devDependency: `@azure-tools/typespec-client-generator-core` 0.65.0 β†’ 0.65.1 - Updated peerDependency range: `>=0.65.0 <1.0.0` β†’ `>=0.65.1 <1.0.0` - Updated overrides in test packages (http-client-generator-test, http-client-generator-clientcore-test) to 0.65.1 - Updated package-lock.json with new dependency resolution No http-specs or azure-http-specs updates, so test code regeneration was not required. --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: Weidong Xu * Add @ChenxiJiang333 to Python CODEOWNERS (#9699) Add @ChenxiJiang333 to Python CODEOWNERS * Add XML model test cases for enum and datetime properties (#9660) Adds test coverage for XML payloads containing models with enum and datetime properties to `packages/http-specs/specs/payload/xml`. ## Changes ### ModelWithEnum - **New model type**: `ModelWithEnum` with single `status` property of extensible union type - **Enum definition**: `Status` union with "pending", "success", "error" variants - **Operations**: GET/PUT endpoints at `/payload/xml/modelWithEnum` - **Mock API**: Scenario handlers for both operations with "success" status value **Example payload:** ```xml success ``` The extensible union allows any string value beyond the defined variants, following TypeSpec's standard enum pattern. ### ModelWithDatetime - **New model type**: `ModelWithDatetime` with datetime properties using different encodings - **Properties**: - `rfc3339` with `@encode(DateTimeKnownEncoding.rfc3339)` decorator - `rfc7231` with `@encode(DateTimeKnownEncoding.rfc7231)` decorator - **Operations**: GET/PUT endpoints at `/payload/xml/modelWithDatetime` - **Mock API**: Scenario handlers for both operations testing both datetime encoding formats **Example payload:** ```xml 2022-08-26T18:38:00.000Z Fri, 26 Aug 2022 14:38:00 GMT ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [specs] New test case for XML model with enum property > We need a new test case in [https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/payload/xml/main.tsp](https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/payload/xml/main.tsp) to cover the scenario of an XML payload that is a model with a single property defined as an enum. > A possible example payload could look like: > ```xml > > success > > ``` > Where "status" is an extensible union with the following values: "pending", "success", "error". > The scenario should support both GET and PUT operations. > > NOTE: > > - DO add changelog in https://github.com/microsoft/typespec/tree/main/.chronus/changes > - DO run command https://github.com/microsoft/typespec/blob/664978b3cf7399e43e2823d3a69043203e740109/packages/http-specs/package.json#L14 under https://github.com/microsoft/typespec/blob/main/packages/http-specs to check all ci items. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9659 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com> Co-authored-by: Timothee Guerin * Filter serialization providers (#9703) * Support relative urls in next link (#9705) Fixes https://github.com/Azure/azure-sdk-for-net/issues/55989 Fixing in the unbranded emitter as using relative next links is a general REST scenario. * Add XML serialization round-trip tests to ModelReaderWriter validation (#9704) Adds XML serialization coverage to existing ModelReaderWriter (MRW) test infrastructure, fully covering both `Tree` and `XmlAdvancedModel` models with round-trip tests. ## Changes ### Test Infrastructure Improvements - **LocalModelXmlTests.cs**: New base class for XML-specific round-trip tests - Provides 4 XML test methods for format "X" serialization - Overrides `RoundTripTest` to validate XML using XElement parsing instead of JSON equivalency checks - Follows same pattern as `LocalModelJsonTests` for consistency - **ModelTests.RoundTripTest**: Enhanced base test method to detect XML payloads - Automatically skips JSON equivalency check for XML payloads (detected by `<` prefix) - Enables XML wire format tests to work correctly for both JSON and XML models - **TestResponseHeaders**: Added `SetHeader` method to enable setting HTTP headers in tests - **CastStrategy**: Enhanced to automatically set Content-Type header based on payload format - Detects JSON payloads (`{` or `[` prefix) β†’ sets `application/json` - Detects XML payloads (`<` prefix) β†’ sets `application/xml` - Enables models with dual-format cast operators to determine correct format automatically ### Test Coverage - **TreeXmlTests**: Comprehensive test suite validating Tree model - Extends `LocalModelJsonTests` since Tree's wire format is JSON - 19 JSON tests (J and W formats) + 4 XML-specific tests - All 23 tests passing βœ… - Validates XML element serialization/deserialization and discriminated type inheritance - **XmlAdvancedModelXmlTests**: Comprehensive test suite validating XmlAdvancedModel - Extends `LocalModelXmlTests` since XmlAdvancedModel is XML-only - 11 standard tests (J and W formats) + 4 XML-specific tests - All 15 tests passing βœ… - Validates complex XML features: attributes, nested models, arrays, dictionaries, enums, namespaces - Tests DateTime, TimeSpan, BinaryData formats, collection-of-collections ### Test Data - Added XML and JSON test data files under `TestData/Tree/` and `TestData/XmlAdvancedModel/` - Updated `.csproj` to include `.xml` files in test output alongside existing `.json` files - XmlAdvancedModel test data generated programmatically from actual serialization to ensure compatibility ## Results - βœ… TreeXmlTests: All 23 tests passing - βœ… XmlAdvancedModelXmlTests: All 15 tests passing - βœ… All existing MRW tests continue to pass (95 tests) - βœ… All generator tests passing (1139/1139 ClientModel tests) - βœ… Test infrastructure improvements benefit all future XML model testing - βœ… Both required models (Tree and XmlAdvancedModel) fully covered
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add MRW XML Serialization Tests > As part of the XML serialization support, it would be nice to update the [existing](https://github.com/microsoft/typespec/tree/main/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation) MRW tests to include testing the xml serialization for models. > > We should at a min, cover round tripping these two models: [Tree](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.cs) & [XmlAdvancedModel](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs). > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9534 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Bump qs from 6.14.1 to 6.14.2 in /packages/http-client-java (#9709) Bumps [qs](https://github.com/ljharb/qs) from 6.14.1 to 6.14.2.
Changelog

Sourced from qs's changelog.

6.14.2

  • [Fix] parse: mark overflow objects for indexed notation exceeding arrayLimit (#546)
  • [Fix] arrayLimit means max count, not max index, in combine/merge/parseArrayValue
  • [Fix] parse: throw on arrayLimit exceeded with indexed notation when throwOnLimitExceeded is true (#529)
  • [Fix] parse: enforce arrayLimit on comma-parsed values
  • [Fix] parse: fix error message to reflect arrayLimit as max index; remove extraneous comments (#545)
  • [Robustness] avoid .push, use void
  • [readme] document that addQueryPrefix does not add ? to empty output (#418)
  • [readme] clarify parseArrays and arrayLimit documentation (#543)
  • [readme] replace runkit CI badge with shields.io check-runs badge
  • [meta] fix changelog typo (arrayLength β†’ arrayLimit)
  • [actions] fix rebase workflow permissions
Commits
  • bdcf0c7 v6.14.2
  • 294db90 [readme] document that addQueryPrefix does not add ? to empty output
  • 5c308e5 [readme] clarify parseArrays and arrayLimit documentation
  • 6addf8c [Fix] parse: mark overflow objects for indexed notation exceeding arrayLimit
  • cfc108f [Fix] arrayLimit means max count, not max index, in combine/merge/`pars...
  • febb644 [Fix] parse: throw on arrayLimit exceeded with indexed notation when `thr...
  • f6a7abf [Fix] parse: enforce arrayLimit on comma-parsed values
  • fbc5206 [Fix] parse: fix error message to reflect arrayLimit as max index; remove e...
  • 1b9a8b4 [actions] fix rebase workflow permissions
  • 2a35775 [meta] fix changelog typo (arrayLength β†’ arrayLimit)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=qs&package-manager=npm_and_yarn&previous-version=6.14.1&new-version=6.14.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Dedup canonical view (#9710) * Enable customizing model base type to non-generated external types (#9375) - [x] Understand the problem: Models can't customize base type to non-generated types from external assemblies - [x] Analyze the BuildBaseModelProvider method in ModelProvider.cs - [x] Identify that when CustomCodeView has a base type with a namespace (external type), it needs to be looked up from Roslyn's type symbol - [x] Modify BuildBaseModelProvider to return null for external base types (handled by BaseTypeProvider) - [x] Add BuildBaseTypeProvider method to create NamedTypeSymbolProvider for external base types - [x] Cache external base type providers in CSharpTypeMap for future lookups - [x] Create comprehensive test CanCustomizeBaseModelToExternalType that validates the fix - [x] Run test to verify the changes work correctly - [x] Run broader test suite to ensure no regressions (2172 tests passed) - [x] Address code review feedback - add SystemObjectTypeProvider for truly external types - [x] Add test case for customizing base model to system type (System.Exception) - [x] Make test assertions more specific based on test setup - [x] Update test to use actual system type (System.Exception) instead of custom external type - [x] Refactor to use FindForTypeInCustomization instead of manual GetTypeByMetadataName - [x] Regenerate Sample-TypeSpec after main branch merge - [x] All 1238 generator tests pass
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > unable to customize base type of generated model to a non-generated type > In mgmt, we have a requirement to mitigate breaking changes regarding base type of a non-generated model, such as a system object type. > > ```csharp > public partial class KeyVaultData : Azure.ResourceManager.TrackedResourceData > ``` > The customized base type is [Azure.ResourceManager.Models.TrackedResourceData](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/src/Common/Generated/Models/TrackedResourceData.cs), which is not generated during the current generation. > > But in MTG, we have the check to ensure the custom base type is either from input model or generated model. > https://github.com/microsoft/typespec/blob/9f01672ff76130414b77af07c6cd53e339e6d85a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ModelProvider.cs#L250-L267 > > I think the issue here is, we don't have a provider to represent such kind of type, such as [InheritableSystemObjectModelProvider](https://github.com/Azure/azure-sdk-for-net/blob/main/eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/InheritableSystemObjectModelProvider.cs) in mgmt. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9234 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: live1206 <5196139+live1206@users.noreply.github.com> Co-authored-by: Wei Hu * [python] Refactor regenerate script to extract shared utilities into regenerate-common module (#9711) for https://github.com/microsoft/typespec/issues/9696 * [python] Add Python mock API test for Azure Core Page withRelativeNextLink scenario (#9685) Adds Python SDK test coverage for the new `Azure_Core_Page_withRelativeNextLink` Spector scenario from [Azure/typespec-azure#3922](https://github.com/Azure/typespec-azure/pull/3922), which tests pagination with relative nextLink URLs that clients must resolve against the service endpoint. - **Dependency bump**: `@azure-tools/azure-http-specs` β†’ `0.1.0-alpha.38-dev.2` to pick up the new scenario - **Sync test**: `test_list_with_relative_next_link` in `test_azure_core_page.py` - **Async test**: `test_list_with_relative_next_link` in `test_azure_core_page_async.py` - **Changelog**: internal change entry for `@typespec/http-client-python` Both tests paginate across two pages and assert `id`, `name`, and `etag` for each returned `User`: ```python def test_list_with_relative_next_link(client: PageClient): result = list(client.with_relative_next_link()) assert len(result) == 2 assert result[0].id == 1 assert result[0].name == "User1" assert result[1].id == 2 assert result[1].name == "User2" ``` > [!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: > > - `https://api.github.com/repos/Azure/typespec-azure/pulls/3922` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js` (http block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
--- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * Fix relative next link bug (#9716) * Enable PR trigger for http-client-csharp publish pipeline (#9719) The publish pipeline could not be triggered from PRs via `/azp run` due to `pr: none` configuration. ## Changes - Configured PR trigger in `packages/http-client-csharp/eng/pipeline/publish.yml` to mirror the main trigger (branches: main, paths: packages/http-client-csharp/ excluding eng/) ## Behavior Users can now manually trigger via `/azp run` or the pipeline runs automatically when PRs modify http-client-csharp code. When run from PRs, publishing targets internal feeds only. Public publishing and CreateAzureSdkForNetPR stage remain conditional on main branch or explicit parameter.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add ability to run publish pipeline from PR > We should be able to run https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/eng/pipeline/publish.yml via /azp run command. I think we need to fill out the pr trigger. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9718 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix: Use client.apiVersions as source of truth for API version enum generation (#9715) ## Fix ApiVersionEnum Missing Existing Members βœ… ### Problem When adding new API versions to a TypeSpec service, the C# emitter was losing existing versions. The `parseApiVersions()` function was reading from `sdkPackage.enums` instead of `client.apiVersions`, which TCGC correctly populates with all versions from the `@versioned` enum. ### Root Cause The `parseApiVersions()` function had logic that: 1. For multi-service clients, used `client.apiVersions` βœ… 2. **For single-service with API version enum, read from `apiVersionEnum.values`** ❌ 3. Otherwise, fell back to `client.apiVersions` User confirmed that: - The TypeSpec spec has ALL versions in the @versioned enum - TCGC correctly returns all versions in `client.apiVersions` But the emitter was ignoring `client.apiVersions` and reading from `sdkPackage.enums` instead, which may not have all values populated correctly at that point. ### Solution Simplified `parseApiVersions()` to always use `client.apiVersions` as the source of truth: ```typescript function parseApiVersions(enums, rootClients) { // Always use client.apiVersions as the source of truth. return rootClients[0]?.apiVersions ?? []; } ``` ### Changes Made - [x] Fixed `parseApiVersions()` in http-client-csharp emitter - [x] Removed incorrect enum-reading logic - [x] Removed unused imports (`UsageFlags`, `containsMultiServiceClient`) - [x] Added comprehensive unit tests - [x] Fixed tests to properly use @versioned decorator with namespace wrapper - [x] Merged tests into existing describe block (removed duplicate) - [x] Simplified code comments to be more concise - [x] All tests passing βœ… - [x] Lint passing βœ… - [x] Full project builds successfully - [x] Code review completed with no issues - [x] Verified other emitters don't have this bug ### Tests Added Two new test cases in the existing `parseApiVersions` describe block in `client-model-builder.test.ts`: 1. **Test with 3 versions** (v1, v2, v3) - verifies all versions are preserved 2. **Test with date versions** (2023-01-01, 2024-01-01, 2025-01-01) - verifies order preservation Both tests follow the pattern from line 208 test: using `IsNamespaceNeeded: false` and defining a complete namespace with `@service` and `@versioned` decorators. ### Impact Analysis - **http-client-csharp**: βœ… Fixed - **http-client-python**: βœ… Not affected (already uses `client.apiVersions` directly) - **http-client-java**: βœ… Not affected (already uses `client.apiVersions` directly) ### Test & Lint Results ``` βœ“ All tests passing βœ“ Lint passing with no warnings ``` ### Files Changed - `packages/http-client-csharp/emitter/src/lib/client-model-builder.ts` (13 deletions, 5 additions) - `packages/http-client-csharp/emitter/test/Unit/client-model-builder.test.ts` (64 additions, 12 deletions) Ready for merge! πŸš€
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > ApiVersionEnum missing existing members > https://github.com/Azure/azure-rest-api-specs/pull/40036/changes is adding a new member, but when generating we lose the previous version. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9714 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Add ability to regen all from pipeline (#9720) Fixes https://github.com/microsoft/typespec/issues/8847 * [http-client-csharp] Consolidate duplicate MethodSignature comparison logic (#9692) Fixes https://github.com/microsoft/typespec/issues/9658 This PR removes duplicated method signature comparison logic by using a consolidated `MethodSignatureEqualityComparer` --- _Used AI to generate the following text based on the commit history_ ## Changes ### πŸ”§ Created Unified Comparer - Added `MethodSignatureBaseEqualityComparer` to `MethodSignatureBase` class - Consolidated all comparison logic including special operator handling (explicit vs implicit) - Exposed via `public static readonly IEqualityComparer SignatureComparer` ### 🧹 Eliminated Duplication in TypeProvider - Replaced ~40 lines of custom `IsMatch()` logic with single line delegation to base comparer - Removed duplicate helper methods (`IsNameMatch`, `GetFullMethodName`) ### πŸš€ Simplified MethodSignature Comparer - Removed redundant `MethodSignatureEqualityComparer` wrapper class - Changed to clean property: `MethodSignatureComparer => SignatureComparer` ### πŸ“ Updated References - Updated 4 references in `ClientProvider.cs` and `ModelFactoryProvider.cs` to maintain existing API ## Benefits βœ… **Single source of truth** - All method signature equality logic unified βœ… **Extended to constructors** - Base comparer now works for both methods and constructors βœ… **Eliminated ~50 lines** of duplicate code βœ… **Backward compatible** - No breaking changes to existing APIs βœ… **All tests pass** - Verified with full test suite (3,235 tests, 0 failures) ## Testing - [x] All existing tests pass - [x] Constructor signature matching scenarios validated - [x] Method signature comparison behavior unchanged * [python] Sync http-client-python dependencies with root package.json (#9713) Upgrades http-client-python dependencies to match root package.json versions for consistency across the monorepo. ## Dependencies Updated - **@types/node**: ~24.1.0 β†’ ~25.0.2 - **rimraf**: ~6.0.1 β†’ ~6.1.2 - **tsx**: ~4.19.1 β†’ ^4.21.0 - **typescript**: ~5.8.2 β†’ ~5.9.2 - **typescript-eslint**: ^8.21.0 β†’ ^8.49.0 - **vitest**: ^3.1.2 β†’ ^4.0.15 ## Changes - Updated `packages/http-client-python/package.json` with aligned versions - Regenerated `package-lock.json` via `npm install` - Added changelog entry with `changeKind: dependencies`
Original prompt update dependencies of packages/http-client-python/package.json. If they are found it package.json, upgrade to same version. NOTE: PR title shall starts with "[python]" [Chronological Review: - The user provided a timestamp and requested: **β€œclean all changes”**. - Assistant initiated a parallel tool call with: 1) `functions.report_intent` (intent logging), and 2) `functions.powershell` to run a git cleanup command chain. - PowerShell command executed: `git --no-pager status --short && git reset --hard HEAD && git clean -fd && git --no-pager status --short` - Tool output showed there was a modified file before reset (`M packages/http-client-python/package.json`), then successful hard reset to commit `efbf17ff8`, and successful completion (exit code 0). - Assistant then ran a second verification command: `git --no-pager status --short` which returned no output and exit code 0 (clean working tree). - Assistant called `functions.task_complete` with a summary indicating all tracked/untracked changes were removed and cleanliness verified. - Assistant replied to user: repo is clean. - User then asked for a structured conversation summary emphasizing recent commands/tool results.] [Intent Mapping: - Explicit user request #1: **β€œclean all changes”** (clear local tracked and untracked changes). - Explicit user request #2: Summarize conversation history with emphasis on recent commands/results and no additional tool calls. - Implicit expectation: confirm repo cleanliness after cleanup and provide a handoff-quality summary.] [Technical Inventory: - Version control: **Git**. - Commands used: `git status --short`, `git reset --hard HEAD`, `git clean -fd`. - Agent tooling: `multi_tool_use.parallel`, `functions.report_intent`, `functions.powershell`, `functions.task_complete`. - Environment note from user reminder: no SQL tables currently exist; SQL tool was not used.] [Code Archaeology: - Mentioned file: `packages/http-client-python/package.json` (was modified before cleanup). - No new code edits were made; all local edits were discarded. - Repository state restored to `HEAD` commit `efbf17ff8` with no remaining local diffs/untracked files.] [Progress Assessment: - Completed: workspace cleanup and verification. - Pending: none from original cleanup task. - New active task: produce detailed structured summary (current response).] [Context Validation: - Captured user goals, all tool calls, exact command strings, key outputs, and final repo state. - Captured immediate pre-summary state (cleanup completed, user requested summary). - Noted that summarization was user-triggered; no evidence of an actual runtime token-overflow event in the visible transcript.] [Recent Commands Analysis: - Last agent commands executed: - `functions.report_intent` with `intent: "Cleaning workspace"` β†’ result: β€œIntent logged”. - `functions.powershell` command chain for cleanup and status checks. - Follow-up `functions.powershell` with `git --no-pager status --short` for explicit verification. - `functions.task_complete` with cleanup summary. - Key tool results: - Pre-clean status included `M packages/http-client-python/package.json`. - `git reset --hard HEAD` succeeded: `HEAD is now at efbf17ff8 ...`. - Final status checks returned clean output (empty `git status --short`), exit code 0. - Immediate pre-summarization state: task already completed and user-confirmed response sent; then user requested this summary.] 1. Conversation Overview: - Primary Objectives: - User requested: **β€œclean all changes”**. - Later requested: **β€œSummarize the conversation history so far, paying special attention to the most recent agent commands and tool results...”** - Session Context: - Single operational task session: detect local changes, discard everything, verify clean state, report completion. - User Intent Evolution: - Started with repo cleanup. - Shifted to documentation/handoff summary of what was executed and what results were returned. 2. Technical Foundation: - Git CLI: - Used to inspect and forcibly restore working tree state. - Agent Tooling: - `multi_tool_use.parallel` for concurrent intent logging + shell action. - `functions.powershell` for command execution. - `functions.task_complete` for formal completion marker. - Workflow Pattern: - Execute destructive cleanup (`reset --hard` + `clean -fd`) then verify with explicit status check. - Environment Detail: - User reminder included SQL tool note (β€œNo tables currently exist...”), but no SQL operations were performed. 3. Codebase Status: - `packages/http-client-python/package.json`: - Purpose: package metadata/config for python HTTP client package. - Current State: previously modified; modification discarded by hard reset. - Key Code Segments: none discussed. - Dependencies: only r...
Created from Copilot CLI via the copilot delegate command. --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * publish http-client-java 0.7.0 (#9722) * Bump C# emitter dependencies to TypeSpec 1.9.0 (#9675) ## Plan: Bump C# emitter dependencies to TypeSpec 1.9.0 - [x] Update package.json dependencies to latest versions - [x] Update @typespec/compiler from 1.8.0 to 1.9.0 - [x] Update @typespec/http from 1.8.0 to 1.9.0 - [x] Update @typespec/openapi from 1.8.0 to 1.9.0 - [x] Update @typespec/rest from 0.78.0 to 0.79.0 - [x] Update @typespec/streams from 0.78.0 to 0.79.0 - [x] Update @typespec/versioning from 0.78.0 to 0.79.0 - [x] Update @azure-tools/typespec-client-generator-core from 0.64.4 to 0.65.1 - [x] Add @typespec/sse 0.79.0 (new peer dependency) - [x] Update @typespec/json-schema from 1.8.0 to 1.9.0 - [x] Update @typespec/library-linter from 0.78.0 to 0.79.0 - [x] Update @typespec/xml from 0.78.0 to 0.79.0 - [x] Update @azure-tools/azure-http-specs from 0.1.0-alpha.35 to 0.1.0-alpha.37 - [x] Update @typespec/http-specs from 0.1.0-alpha.30 to 0.1.0-alpha.32 - [x] Update @typespec/spector from 0.1.0-alpha.20 to 0.1.0-alpha.23 - [x] Add @azure-tools/typespec-azure-core 0.65.0 - [x] Update peerDependencies to match devDependencies versions - [x] Fix TypeScript compilation errors due to type changes in TCGC - [x] Update InputDateTimeType encode property to accept `DateTimeKnownEncoding | string` - [x] Update InputDurationType encode property to accept `DurationKnownEncoding | string` - [x] Convert C# encoding types to extensible string enums - [x] Convert DateTimeKnownEncoding from enum to extensible string enum (readonly struct pattern) - [x] Convert DurationKnownEncoding from enum to extensible string enum (readonly struct pattern) - [x] Maintain known encoding values as static properties (Rfc3339, Rfc7231, UnixTimestamp for DateTime; Iso8601, Seconds, Constant, Milliseconds for Duration) - [x] Add implicit string conversion to support custom encoding formats - [x] Update JSON converters to accept any string value instead of only known enums - [x] Update TypeFactory switch expressions to handle custom encodings with SerializationFormat.Default - [x] Use InvariantCultureIgnoreCase for string comparison (matching generated extensible enum pattern) - [x] Use StringComparer.InvariantCultureIgnoreCase for GetHashCode - [x] Add EditorBrowsable attributes to Equals and GetHashCode - [x] Update tests to work with extensible enum pattern - [x] Fix C# generator runtime error for enum array encoding - [x] Update MrwSerializationTypeDefinition to use PropertyInitializationType instead of FrameworkType for custom enum types - [x] Run npm install to update package-lock.json - [x] Run npm run build to ensure build succeeds - [x] Run npm test to ensure all tests pass (183 emitter tests, 80 Input tests, 1101 ClientModel tests, 15 Spector tests passed) - [x] Regenerate all test libraries using eng/scripts/Generate.ps1 - [x] All existing specs regenerated successfully - [x] Generated code compiles without errors - [x] Merge latest changes from main branch - [x] Resolved merge conflict in tspCodeModel.json - [x] Verified build succeeds after merge - [x] Verified tests pass after merge - [x] Verify all changes are working correctly
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Bump C# emitter dependencies > We should bump to the new typespec/compiler version 1.9.0 and all the other new versions for typespec packages. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9674 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: jolov * Fix XML serialization in convenience methods for dual-format models (#9712) ## Add logic to use XML serialization/deserialization in protocol methods based on the content-type ### Plan: - [x] Understand the issue and analyze the current implementation - [x] Add internal `ToBinaryContent(string format)` helper method to model serialization - [x] Update convenience method generation to detect content-type and use appropriate format - [x] Generate using statements for proper BinaryContent disposal - [x] Verify tests pass and validate generated code - [x] Add test scenario with Tree model used in both JSON and XML operations - [x] Address all code review feedback - [x] Add comprehensive unit tests with TestData validation - [x] Remove unused code and simplify test code - [x] Final code review and validation - [x] All review comments addressed βœ… ### Implementation Summary: **Problem:** When a model supports both JSON and XML serialization (e.g., Tree model with `@usage(Usage.xml | Usage.output | Usage.json)`), convenience methods were always using the wire format ("J" for JSON) through the implicit operator, even when the operation specified `@header contentType: "application/xml"`. This caused runtime failures when XML-formatted content was expected. **Solution:** 1. **Added internal `ToBinaryContent(string format)` method** to models that support both JSON and XML: - Located in `MrwSerializationTypeDefinition.cs` via `BuildToBinaryContentMethod()` - Method signature: `internal BinaryContent ToBinaryContent(string format)` - Creates `ModelReaderWriterOptions` with the specified format ("J" or "X") - Calls `BinaryContent.Create(this, options)` to serialize with the correct format - Method name and description dynamically use `RequestContentType.Name` 2. **Updated convenience method code generation** in `ScmMethodProviderCollection.cs`: - Added logic to `GetStackVariablesForProtocolParamConversion` to generate using declarations for proper resource disposal - Loops through operation's `RequestMediaTypes` to find JSON or XML content-type - Uses helper method `TryGetFormatArgumentForDualFormatModel` with `[NotNullWhen(true)]` for null safety - Uses constants `JsonMediaType` and `XmlMediaType` for media type strings - For body parameters that are models: - Checks if model supports both JSON and XML using cached model information - If dual-format model and operation specifies content-type: - Generates `using BinaryContent content = parameter.ToBinaryContent("X")` for XML operations - Generates `using BinaryContent content = parameter.ToBinaryContent("J")` for JSON operations - Uses `ModelReaderWriterOptionsSnippets.XmlFormat` and `.JsonFormat` for format values - Method invocation is dynamic using `To{RequestContentType.Name}` pattern - Otherwise uses implicit operator (existing behavior) - Removed unused variables for cleaner code **Example Generated Code:** ```csharp // XML operation: public virtual ClientResult UpdateTree(Tree tree, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tree, nameof(tree)); using BinaryContent content = tree.ToBinaryContent("X"); ClientResult result = UpdateTree(content, cancellationToken.ToRequestOptions()); return ClientResult.FromValue((Tree)result, result.GetRawResponse()); } // JSON operation: public virtual ClientResult UpdateTreeAsJson(Tree tree, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tree, nameof(tree)); using BinaryContent content = tree.ToBinaryContent("J"); ClientResult result = UpdateTreeAsJson(content, cancellationToken.ToRequestOptions()); return ClientResult.FromValue((Tree)result, result.GetRawResponse()); } // Single-format operation (no ToBinaryContent): public virtual ClientResult CreateLiteral(Thing body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); return CreateLiteral(body, cancellationToken.ToRequestOptions()); } ``` **Testing:** - βœ… All tests pass (1147 ClientModel tests, 1244 generator tests, 838 spector tests, 75 input tests, 37 local tests = 3,341 total, 0 failures) - βœ… Code review passed with no issues - **Added comprehensive unit tests (8 new tests):** - TreeXmlTests (2 tests): Uses reflection to call internal ToBinaryContent method, directly accesses public MediaType property (application/json for "J", null/empty for "X") - MrwSerializationTypeDefinitionTests (3 tests): Validates ToBinaryContent method generation for dual-format models (positive) and single-format models (negative) - ScmMethodProviderCollectionTests (3 tests): Validates complete convenience method code using TestData files for XML/JSON dual-format and single-format scenarios - Generated code verified for Tree model with both XML and JSON operations - Sample-TypeSpec project demonstrates dual-format scenario with proper resource disposal: - Tree model supports both JSON and XML (default usage) - UpdateTree generates: `using BinaryContent content = tree.ToBinaryContent("X");` - UpdateTreeAsJson generates: `using BinaryContent content = tree.ToBinaryContent("J");` ### Security Summary No security vulnerabilities introduced. Changes are limited to code generation logic that: - Adds proper resource disposal (using statements) - Uses existing ModelReaderWriterOptions and BinaryContent APIs - No new external dependencies or network calls
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add logic to use XML serialization/deserialization in protocol methods based on the content-type > If `Content-Type` is `application/xml`, then we should use xml serialization. Will need to convert models to/from BinaryContent using the xml serialization. > > Edit: > We can construct an internal serialization helper to have the model serialize into either XML or JSON depending on the format requested: > > ```csharp > internal BinaryContent ToBinaryContent(string format) > { > ModelReaderWriterOptions options = new ModelReaderWriterOptions(format); > return BinaryContent.Create(this, options); > } > ``` > Then in the convenience method, we can supply the format depending on the operation's content type. "J" for json and "X" for xml content type: > > ```csharp > ClientResult result = UpdateTree(tree.ToBinaryContent("X"), cancellationToken.ToRequestOptions()); > ``` > > ## Comments on the Issue (you are @copilot in this section) > > > @JoshLove-msft > Blocked on the XML serialization support. > @jorgerangel-msft > @JoshLove-msft do you have more details on what this should entail? In the rare case an operation would support both json and xml, I have the content type check on the operator used for deserialization https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs#L103. For serializing to BinaryContent, it's a bit more tricky to do this via an operator since we don't have the contenttype info at runtime. > > For the protocol methods, library users can use MRW to choose what the model should be serialized to: ie `BinaryContent.Create(tree, new ModelReaderWriterOptions ("J"))` > @JoshLove-msft > I don't think a single operation would support both, but if a model supports both does the convenience method apply the correct options when calling the protocol? > @jorgerangel-msft > @JoshLove-msft ah okay, I understand the use case here now. This is something I missed then. If a model is used in an operation that supports json and also an operation that supports xml payloads, the convenience method for one of them would result in a runtime failure since we are using the explicit operator to serialize the payload. That operator is relying on the generated wire format which would be "J". > > I will think about how to fix this. I think maybe having a internal helper on the model's to let us switch betwen json/xml serialization depending on the content type might work, and not use the implicit operator in the convenience method. The deserialization should work with today's implementation though since the operator there checks the response's content type header. > >
- Fixes microsoft/typespec#5647 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: Jorge Rangel * Add http-client-csharp test coverage for XML pageable Spector scenarios (#9733) The recent addition of XML pagination scenarios to the Spector test suite (XmlPagination namespace) was not covered by http-client-csharp tests, despite generated client code existing. ## Changes - **Added `XmlPaginationTests.cs`** with 8 test methods covering: - `GetWithContinuation` - XML pagination with continuation token marker - `GetWithNextLink` - XML pagination with next link URL - Sync/async variants for both convenience and protocol methods - **XML response parsing** using `XDocument` to validate pet data structure and pagination behavior - **Extracted common `ExpectedPets` dictionary** to reduce duplication across test methods ## Example ```csharp [SpectorTest] public Task ConvenienceMethodWithContinuation() => Test(async (host) => { var client = new PageableClient(host, null); var result = client.GetXmlPaginationClient().GetWithContinuationAsync(); int count = 0; await foreach (var pet in result) { Assert.AreEqual((++count).ToString(), pet.Id); Assert.AreEqual(ExpectedPets[pet.Id], pet.Name); } Assert.AreEqual(4, count); }); ``` Tests follow existing Spector patterns and will run against the mock server in CI.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Adopt New XML Pageable Spector Scenarios > There are new [pageable](https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/payload/pageable/main.tsp) scenarios that were added to the latest spector tests. We should add test coverage for this now that xml serialization support is implemented. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9708 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Bump fast-xml-parser from 5.3.5 to 5.3.6 in /packages/http-client-csharp (#9737) Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.5 to 5.3.6.
Release notes

Sourced from fast-xml-parser's releases.

Entity security and performance

  • Improve security and performance of entity processing
    • new options maxEntitySize, maxExpansionDepth, maxTotalExpansions, maxExpandedLength, allowedTags,tagFilter
    • fast return when no edtity is present
    • improvement replacement logic to reduce number of calls

Full Changelog: https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.5...v5.3.6

Changelog

Sourced from fast-xml-parser's changelog.

Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.

5.3.6 / 2026-02-14

  • Improve security and performance of entity processing
    • new options maxEntitySize, maxExpansionDepth, maxTotalExpansions, maxExpandedLength, allowedTags,tagFilter
    • fast return when no edtity is present
    • improvement replacement logic to reduce number of calls

5.3.5 / 2026-02-08

  • fix: Escape regex char in entity name
  • update strnum to 2.1.2
  • add missing exports in CJS typings

5.3.4 / 2026-01-30

  • fix: handle HTML numeric and hex entities when out of range

5.3.3 / 2025-12-12

  • fix #775: transformTagName with allowBooleanAttributes adds an unnecessary attribute

5.3.2 / 2025-11-14

  • fix for import statement for v6

5.3.1 / 2025-11-03

5.3.0 / 2025-10-03

  • Use Uint8Array in place of Buffer in Parser

5.2.5 / 2025-06-08

  • Inform user to use fxp-cli instead of in-built CLI feature
  • Export typings for direct use

5.2.4 / 2025-06-06

  • fix (#747): fix EMPTY and ANY with ELEMENT in DOCTYPE

5.2.3 / 2025-05-11

  • fix (#747): support EMPTY and ANY with ELEMENT in DOCTYPE

5.2.2 / 2025-05-05

  • fix (#746): update strnum to fix parsing issues related to enotations

5.2.1 / 2025-04-22

  • fix: read DOCTYPE entity value correctly
  • read DOCTYPE NOTATION, ELEMENT exp but not using read values

5.2.0 / 2025-04-03

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fast-xml-parser&package-manager=npm_and_yarn&previous-version=5.3.5&new-version=5.3.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump tar from 7.5.7 to 7.5.9 in /packages/http-client-csharp (#9740) Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.7 to 7.5.9.
Commits
  • 1f0c2c9 7.5.9
  • fbb0851 build minified version as default export
  • 6b8eba0 7.5.8
  • 2cb1120 fix(unpack): improve UnpackSync symlink error "into" path accuracy
  • d18e4e1 fix: do not write linkpaths through symlinks
  • See full diff in compare view
Maintainer changes

This version was pushed to npm by isaacs, a new releaser for tar since your current version.

Install script changes

This version adds prepare script that runs during installation. Review the package contents before updating.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar&package-manager=npm_and_yarn&previous-version=7.5.7&new-version=7.5.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump qs from 6.14.1 to 6.14.2 in /packages/http-client-csharp (#9723) Bumps [qs](https://github.com/ljharb/qs) from 6.14.1 to 6.14.2.
Changelog

Sourced from qs's changelog.

6.14.2

  • [Fix] parse: mark overflow objects for indexed notation exceeding arrayLimit (#546)
  • [Fix] arrayLimit means max count, not max index, in combine/merge/parseArrayValue
  • [Fix] parse: throw on arrayLimit exceeded with indexed notation when throwOnLimitExceeded is true (#529)
  • [Fix] parse: enforce arrayLimit on comma-parsed values
  • [Fix] parse: fix error message to reflect arrayLimit as max index; remove extraneous comments (#545)
  • [Robustness] avoid .push, use void
  • [readme] document that addQueryPrefix does not add ? to empty output (#418)
  • [readme] clarify parseArrays and arrayLimit documentation (#543)
  • [readme] replace runkit CI badge with shields.io check-runs badge
  • [meta] fix changelog typo (arrayLength β†’ arrayLimit)
  • [actions] fix rebase workflow permissions
Commits
  • bdcf0c7 v6.14.2
  • 294db90 [readme] document that addQueryPrefix does not add ? to empty output
  • 5c308e5 [readme] clarify parseArrays and arrayLimit documentation
  • 6addf8c [Fix] parse: mark overflow objects for indexed notation exceeding arrayLimit
  • cfc108f [Fix] arrayLimit means max count, not max index, in combine/merge/`pars...
  • febb644 [Fix] parse: throw on arrayLimit exceeded with indexed notation when `thr...
  • f6a7abf [Fix] parse: enforce arrayLimit on comma-parsed values
  • fbc5206 [Fix] parse: fix error message to reflect arrayLimit as max index; remove e...
  • 1b9a8b4 [actions] fix rebase workflow permissions
  • 2a35775 [meta] fix changelog typo (arrayLength β†’ arrayLimit)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=qs&package-manager=npm_and_yarn&previous-version=6.14.1&new-version=6.14.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix XML serialization for nullable value types (#9736) ## Fix Incorrect XML Serialization Code for Nullable DateTimeOffset Properties ### Plan: - [x] Understand the issue: XML serialization code doesn't access `.Value` property for nullable value types - [x] Identify the fix location in `MrwSerializationTypeDefinition.Xml.cs` - [x] Modify `CreateXmlWriteValueStatement` to use `.Value` for nullable value types - [x] Create test cases to verify the fix - [x] Build and test the changes - [x] Verify generated code is correct - [x] Run comprehensive test suite - [x] Address review feedback: Apply NullableStructValue to all value types - [x] Address review feedback: Add test for customized nullable DateTimeOffset - [x] Regenerate test projects to fix CI failures - [x] Refactor tests to use TestData pattern ### Changes Made: #### Initial Fix (Commit 1 - 24ddf1a) 1. **Modified `MrwSerializationTypeDefinition.Xml.cs`**: - Updated `CreateXmlWriteValueStatement` to call `value.NullableStructValue(valueType)` for DateTimeOffset, TimeSpan, and byte[] types - This ensures `.Value` is accessed for nullable value types before passing to serialization methods - Applied to both `WriteStringValue` and `WriteBase64StringValue` calls 2. **Added Unit Tests**: - `XmlSerializationHandlesNullableDateTimeOffsetProperty`: Verifies nullable DateTimeOffset serialization - `XmlSerializationHandlesNullableTimeSpanProperty`: Verifies nullable TimeSpan serialization #### Review Feedback Changes (Commit 2 - ed670a4) 3. **Extended fix to all value types**: - Modified `CreateXmlSerializeValueExpression` to apply `NullableStructValue` before calling `CreateXmlSerializePrimitiveExpression` - This ensures ALL nullable value types (int?, bool?, etc.) correctly access `.Value`, not just DateTimeOffset/TimeSpan 4. **Added customization test**: - `CanSerializeCustomizedNullableDateTimeOffset`: Tests when a DateTimeOffset property is customized to be nullable via custom code - Verifies the fix works for properties that are made nullable through customization #### Test Project Regeneration (Commit 3 - e20eae2) 5. **Regenerated test projects**: - Ran `eng/scripts/Generate.ps1` to regenerate all test projects with the fix - XmlAdvancedModel now correctly generates `OptionalInt.Value` for nullable int property - Validates that the comprehensive fix works correctly in generated code #### Test Refactoring (Commit 4 - current) 6. **Refactored tests to use TestData pattern**: - Updated `XmlSerializationHandlesNullableDateTimeOffsetProperty` to use `MockMrwProvider` and compare against TestData file - Updated `XmlSerializationHandlesNullableTimeSpanProperty` to use `MockMrwProvider` and compare against TestData file - Created expected test data files demonstrating correct `.Value` accessor in generated code ### Test Results: - All 1,150 ClientModel tests pass βœ“ - 32 XML serialization tests pass (including 3 new tests) βœ“ - Generated test code correctly uses `.Value` for nullable value types βœ“ - Tests now use consistent TestData pattern for validation βœ“ ### Example **Before (incorrect):** ```csharp if (Optional.IsDefined(PolicyStartsOn)) { writer.WriteStartElement("Start"); writer.WriteStringValue(PolicyStartsOn, "O"); // Error: PolicyStartsOn is DateTimeOffset? writer.WriteEndElement(); } ``` **After (correct):** ```csharp if (Optional.IsDefined(PolicyStartsOn)) { writer.WriteStartElement("Start"); writer.WriteStringValue(PolicyStartsOn.Value, "O"); // Correct: Access .Value writer.WriteEndElement(); } ``` **Generated code example (int?):** ```csharp if (Optional.IsDefined(OptionalInt)) { writer.WriteStartElement("optionalInt"); writer.WriteValue(OptionalInt.Value); // Correct: Uses .Value for nullable int writer.WriteEndElement(); } ``` **Test data showing correct nullable DateTimeOffset:** ```csharp protected virtual void XmlModelWriteCore(global::System.Xml.XmlWriter writer, ...) { if (global::Sample.Optional.IsDefined(Timestamp)) { writer.WriteStartElement("timestamp"); writer.WriteStringValue(Timestamp.Value, "O"); // Correct: .Value accessor writer.WriteEndElement(); } } ``` ### Technical Details The fix uses the existing `NullableStructValue(CSharpType)` method which automatically: - Returns `value.Value` if the type is a nullable value type - Returns `value` unchanged if the type is not nullable - This ensures backward compatibility with non-nullable types
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Fix Incorrect XML Serialization Code for Nullable DateTimeOffset Properties > See the [storage library](https://github.com/Azure/azure-sdk-for-net/blob/530e40c3e987122cdc34669e38a87589061c9012/sdk/storage/Azure.Storage.Blobs/src/Models/BlobAccessPolicy.cs#L22) for an example. The `Start` and `Expiry` spec properties were customized to be `DateTimeOffset`. Our xml serialization code for this model is not correct, since we are not accessing the property's underlining value: > > ```csharp > if (Optional.IsDefined(PolicyStartsOn)) > { > writer.WriteStartElement("Start"); > writer.WriteStringValue(PolicyStartsOn, "O"); > writer.WriteEndElement(); > } > if (Optional.IsDefined(PolicyExpiresOn)) > { > writer.WriteStartElement("Expiry"); > writer.WriteStringValue(PolicyExpiresOn, "O"); > writer.WriteEndElement(); > } > ``` > > We should be calling `writer.WriteStringValue(PolicyStartsOn.Value, "O");`. > > In general, this applies to all nullable types. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9735 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Fix URI deserialization (#9743) * Bump TCGC (#9744) * [Typescript] update version for js api parser (#9661) This updated the api view parser package reference * feat(openapi3): import readOnly/writeOnly as visibility decorators (#9742) The import tool ignored `readOnly` and `writeOnly` properties, breaking import/emit symmetry since the emitter already generates these from `@visibility` decorators. ## Changes - **Type definitions**: Added missing `writeOnly` property to `OpenAPI3Schema` and `OpenAPISchema3_2` - **Import conversion**: - `readOnly: true` β†’ `@visibility(Lifecycle.Read)` - `writeOnly: true` β†’ `@visibility(Lifecycle.Create)` - Mutual exclusivity validation (warns and ignores both if both present) - **Tests**: Coverage for all scenarios including nested properties and arrays ## Example **Before:** ```yaml properties: id: type: string readOnly: true ``` ```typespec model Widget { id: string; // readOnly lost } ``` **After:** ```typespec model Widget { @visibility(Lifecycle.Read) id: string; } ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > import tool - support importing readonly and writeonly > ### Clear and concise description of the problem > > The import tool currently does not support importing `readOnly: true` or `writeOnly: true` as a visibility decorator. We should add support for that because the emitters support the decorator, so the import/emit process is not symmetrical today. > > Today the following OpenAPI descriptions > > ```yaml > components: > schemas: > Widget: > type: object > required: > - id > - weight > - color > properties: > id: > type: string > readOnly: true > weight: > type: integer > format: int32 > color: > type: string > enum: > - red > - blue > ``` > > or > > ```yaml > components: > schemas: > Widget: > type: object > required: > - id > - weight > - color > properties: > id: > type: string > writeOnly: true > weight: > type: integer > format: int32 > color: > type: string > enum: > - red > - blue > ``` > > both result to > > ```tsp > model Widget { > id: string; > > weight: int32; > color: "red" | "blue"; > } > ``` > > As if the read/write only properties are absent. > > It should instead result in > > ```diff > model Widget { > + @visibility(Lifecycle.Read) > id: string; > > weight: int32; > color: "red" | "blue"; > } > ``` > > In the case readOnly is present > > ```diff > model Widget { > + @visibility(Lifecycle.Create) > id: string; > > weight: int32; > color: "red" | "blue"; > } > ``` > > In the case writeOnly is present. > > Also those properties should be treated as mutually exclusive and an error should be reported + both ignored in case they are both present. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Read the [docs](https://typespec.io/docs/). > - [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate. > > use conventional commits. > run the formatting commands. > run the changelog command. > start by defining the unit tests first. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9741 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * fix: do not crash when no discriminator prop present (#9745) Fixes a new edge case where the discriminator property may be nul: ``` StackTrace: Object reference not set to an instance of an object. at Microsoft.TypeSpec.Generator.Providers.ModelProvider.EnsureDiscriminatorValueExpression() in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ModelProvider.cs:line 941 ``` * Support "duration-constant" encoding (#9746) * Rename XML model serialization helper method from `Write` to `WriteXml` (#9750) The private `Write(XmlWriter, ModelReaderWriterOptions, string)` helper method in XML model serialization collides with model properties named `Write` (e.g., Azure Storage's `BlobAnalyticsLogging.Write`), causing compile errors in generated code. ## Changes - **Core rename**: `XmlWriteMethodName` constant changed from `"Write"` to `"WriteXml"` in `MrwSerializationTypeDefinition.Xml.cs` - **Test filters updated**: `MockMrwProvider` and `FilteredMethodsTypeProvider` lambdas in `XmlSerializationTests.cs` updated to match both `"WriteXml"` (private helper) and `"Write"` (the `IPersistableModel.Write` explicit interface method) - **Test data files**: All expected output files updated with the new private helper method name `WriteXml`; the `IPersistableModel.Write` explicit interface method is preserved unchanged - **Generated files**: Sample-TypeSpec generated serialization files updated to reflect the rename ### Before / After ```csharp // Before β€” collides with model properties named "Write" private void Write(XmlWriter writer, ModelReaderWriterOptions options, string nameHint) { ... } // After private void WriteXml(XmlWriter writer, ModelReaderWriterOptions options, string nameHint) { ... } ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Rename Write Method in XML Model Serialization > The `Write` method name is too generic and it already is leading to a collision in [Storage](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/src/Models/BlobAnalyticsLogging.cs#L39) with one of the model's properties. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9748 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Better way to deal with manifests (#9752) Migration to ESRP release had to do some change to how the manifest was published which seems to be broken. So taking a different approach. Change so that each package publish its own manifest and the upload checks the version is not published and the dashboard config includes which manifest to load. This also allows us to get rid of 2 containers that were there for no reason * Add missing C# Spector test scenarios for Encode Array enum variants (#9759) - [x] Add 8 missing C# Spector test scenarios for Encode Array (enum and extensible enum variants) - [x] EnumCommaDelimited - [x] EnumSpaceDelimited - [x] EnumPipeDelimited - [x] EnumNewlineDelimited - [x] ExtensibleEnumCommaDelimited - [x] ExtensibleEnumSpaceDelimited - [x] ExtensibleEnumPipeDelimited - [x] ExtensibleEnumNewlineDelimited - [x] Build verified (0 errors, 0 warnings) - [x] Remove changelog entry (not needed for test-only change)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Adopt missing C# spector scenarios for Encode Array > Several new scenarios were added that we are missing https://[typespec.io](https://typespec.io/can-i-use/http/)/can-i-use/http/ > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9758 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix bug in method suppression matching involving generic constraints (#9761) * Respect table order (#9763) * Add ability to preview regen of spector scenarios (#9766) * Use linked versions of map and set (#9751) Replace usages of `HashMap` and `HashSet` with `LinkedHashMap` and `LinkedHashSet` to ensure consistent iteration order if the object is iterated over. * Don't hoist all subclient parameters to client (#9767) * Convert highlight comments to ins={} syntax (#9540) ## Convert highlight comments to ins={} syntax **Problem:** The `// highlight-start`, `// highlight-end`, and `// highlight-next-line` comments in tutorial documentation were not working - they were intended to highlight code changes between tutorial steps but weren't being rendered. **Solution:** Converted all highlight comments to use Expressive Code's `ins={}` metadata syntax to show added lines with green highlighting. **Changes:** - βœ… Converted all code blocks to use `ins={}` metadata syntax - βœ… Removed all `// highlight-start`, `// highlight-end`, and `// highlight-next-line` comments - βœ… Updated 7 tutorial documentation files - βœ… Formatted files with `pnpm format` - βœ… Uses Expressive Code's native text-markers plugin **Example Conversion:** Before: ```tsp import "@typespec/http"; using Http; // highlight-start @service(#{ title: "Pet Store", }) // highlight-end ``` After: ```tsp ins={4-7} import "@typespec/http"; using Http; @service(#{ title: "Pet Store", }) ``` **Result:** The `ins={}` syntax displays highlighted lines with green "added" highlighting, making it clear what was introduced in each tutorial step while keeping the code clean and copyable. **Files updated:** - `01-setup-basic-syntax.mdx` - `02-operations-responses.md` - `03-handling-errors.md` - `04-common-parameters.md` - `05-authentication.md` - `06-versioning.mdx` - `07-custom-response-models.md`
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Highlight comments not working > Image > > I believe they were supposed to show what was added in each code block but they seem broken now > > https://expressive-code.com/key-features/text-markers/ > > check why those comments in the website docs are not working. They should be highlighting the lines to show what was added between tutorial steps > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9490 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> * Bump TCGC dep (#9773) * [python] Fix XML deserialization for enum/datetime types and add mock API tests (#9724) - [x] Ensure prerequisites are met (pnpm install, package build) - [x] Identify the Spector case link (from PR #9660: `payload/xml` ModelWithEnum and ModelWithDatetime) - [x] Update `@typespec/http-specs` dependency to `0.1.0-alpha.33-dev.2` in `packages/http-client-python/package.json` - [x] Regenerate the `payload/xml` generated client - [x] Fix XML deserialization bug for enum (CaseInsensitiveEnumMeta) and datetime types in `model_base.py.jinja2` - [x] Add None check for `value.text` before passing to `_DESERIALIZE_MAPPING` / `_DESERIALIZE_MAPPING_WITHFORMAT` callables - [x] Implement sync tests in `generic_mock_api_tests/test_payload_xml.py` for ModelWithEnum and ModelWithDatetime - [x] Implement async tests in `generic_mock_api_tests/asynctests/test_payload_xml_async.py` for ModelWithEnum and ModelWithDatetime - [x] Format changed Python files with Black - [x] Validate tests locally (all 15 sync + 15 async tests pass) - [x] Add a changelog entry under `.chronus/changes` - [x] Run code review (no issues found) - [x] Run CodeQL security scan (no alerts) ## Security Summary No security vulnerabilities were introduced or discovered. --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com> * Bump fast-xml-parser from 5.3.5 to 5.3.6 in /packages/http-client-java (#9755) Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.5 to 5.3.6.
Release notes

Sourced from fast-xml-parser's releases.

Entity security and performance

  • Improve security and performance of entity processing
    • new options maxEntitySize, maxExpansionDepth, maxTotalExpansions, maxExpandedLength, allowedTags,tagFilter
    • fast return when no edtity is present
    • improvement replacement logic to reduce number of calls

Full Changelog: https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.5...v5.3.6

Changelog

Sourced from fast-xml-parser's changelog.

Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.

5.3.6 / 2026-02-14

  • Improve security and performance of entity processing
    • new options maxEntitySize, maxExpansionDepth, maxTotalExpansions, maxExpandedLength, allowedTags,tagFilter
    • fast return when no edtity is present
    • improvement replacement logic to reduce number of calls

5.3.5 / 2026-02-08

  • fix: Escape regex char in entity name
  • update strnum to 2.1.2
  • add missing exports in CJS typings

5.3.4 / 2026-01-30

  • fix: handle HTML numeric and hex entities when out of range

5.3.3 / 2025-12-12

  • fix #775: transformTagName with allowBooleanAttributes adds an unnecessary attribute

5.3.2 / 2025-11-14

  • fix for import statement for v6

5.3.1 / 2025-11-03

5.3.0 / 2025-10-03

  • Use Uint8Array in place of Buffer in Parser

5.2.5 / 2025-06-08

  • Inform user to use fxp-cli instead of in-built CLI feature
  • Export typings for direct use

5.2.4 / 2025-06-06

  • fix (#747): fix EMPTY and ANY with ELEMENT in DOCTYPE

5.2.3 / 2025-05-11

  • fix (#747): support EMPTY and ANY with ELEMENT in DOCTYPE

5.2.2 / 2025-05-05

  • fix (#746): update strnum to fix parsing issues related to enotations

5.2.1 / 2025-04-22

  • fix: read DOCTYPE entity value correctly
  • read DOCTYPE NOTATION, ELEMENT exp but not using read values

5.2.0 / 2025-04-03

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fast-xml-parser&package-manager=npm_and_yarn&previous-version=5.3.5&new-version=5.3.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump tar from 7.5.7 to 7.5.9 in /packages/http-client-java (#9754) Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.7 to 7.5.9.
Commits
  • 1f0c2c9 7.5.9
  • fbb0851 build minified version as default export
  • 6b8eba0 7.5.8
  • 2cb1120 fix(unpack): improve UnpackSync symlink error "into" path accuracy
  • d18e4e1 fix: do not write linkpaths through symlinks
  • See full diff in compare view
Maintainer changes

This version was pushed to npm by isaacs, a new releaser for tar since your current version.

Install script changes

This version adds prepare script that runs during installation. Review the package contents before updating.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar&package-manager=npm_and_yarn&previous-version=7.5.7&new-version=7.5.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * http-client-java, bug fix external type for enum (#9784) see local test https://github.com/microsoft/typespec/pull/9784/changes#diff-8a42120fbca0247cc0fb3ed0af8bfadc32e2ec88624e4fe828149720c8cbaa88 * Expose setOperation (#9686) Revive #8608 Fixes https://github.com/microsoft/typespec/issues/8511 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Fix: Don't report non-literal-string-template when interpolating ErrorType (#9641) - [x] Understand the issue: When interpolating an invalid reference in a string template, both `invalid-ref` and `non-literal-string-template` errors are reported - [x] Locate the code that reports `non-literal-string-template` error (in `string-template-utils.ts`) - [x] Add check to skip reporting `non-literal-string-template` when the type is ErrorType - [x] Add test case to verify the fix works - [x] Run existing tests to ensure no regressions (all 3564 tests passed) - [x] Verify the fix manually (confirmed only `invalid-ref` is shown for invalid references, and `non-literal-string-template` still appears for valid non-serializable types) - [x] Run format and lint (all passed) - [x] Add changeset for the fix - [x] Address PR review feedback: Use `isErrorType` helper function instead of manual check
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Interpolating an invalid reference include confusing error > ```tsp > const b = "Some ${bad}"; > ``` > > ``` > invalid-ref Unknown identifier bad > non-literal-string-template Value interpolated in this string template cannot be converted to a string. Only literal types can be automatically interpolated. > ``` > > [Playground Link](https://typespec.io/playground/?e=%40typespec%2Fopenapi3&options=%7B%7D&vs=%7B%7D&version=1.4.x&c=Y29uc3QgYiA9ICJTb21lICR7YmFkfSI7Cg%3D%3D) > > `non-literal-string-template` should probably not be reported if the interpolated type is already an errorType > > When reporting non-literal-string-template we should ignore ErrorType > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9606 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Timothee Guerin * Bump tar from 7.5.2 to 7.5.9 in /packages/http-client-python (#9783) Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.2 to 7.5.9.
Commits
Maintainer changes

This version was pushed to npm by isaacs, a new releaser for tar since your current version.

Install script changes

This version adds prepare script that runs during installation. Review the package contents before updating.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar&package-manager=npm_and_yarn&previous-version=7.5.2&new-version=7.5.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix byte[] property deserialization incorrectly using JSON array enumeration (#9788) - [x] Fix `byte[]` deserialization using `GetBytesFromBase64` instead of JSON array enumeration - [x] Remove changelog entry (per reviewer request) - [x] Update `byte[]` case in `CreateDeserializeValueExpression` to fully mirror `BinaryData` pattern - [x] Move byte[] deserialization tests into `MrwSerializationTypeDefinitionTests` using existing patterns (MockHelpers.LoadMockGenerator with createCSharpTypeCore) - [x] Remove separate `ByteArrayDeserializationTests.cs` file
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Generated deserialization code for property of byte[] is incorrect #55367 > https://github.com/Azure/azure-sdk-for-net/issues/55367 > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9787 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Add Spector test case for parameters/query spec (http-client-csharp) (#9790) Adds Spector test coverage for the `parameters/query` spec in the `http-client-csharp` emitter, which defines a single scenario: sending a constant query parameter value (`queryParam=constantValue`) via `POST /parameters/query/constant`. ## Changes - **`packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Parameters/Query/QueryTests.cs`** β€” new `QueryTests` class extending `SpectorTestBase` with a `Constant()` test that calls `QueryClient.GetConstantClient().PostAsync()` and asserts HTTP 204 - **`packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj`** β€” added `ProjectReference` for `Parameters.Query.csproj` so the test project can reference the generated client library
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Adopt parameters/query Spector Case > We should add a spector test case for https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/parameters/query/main.tsp > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9789 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Add AssertInRange, AssertNotNullOrWhiteSpace, and CheckNotNullOrEmpty to ArgumentDefinition (#9794) - [x] Add `BuildAssertNotNullOrWhiteSpace` method to `ArgumentDefinition.cs` - [x] Add `BuildAssertInRange` method to `ArgumentDefinition.cs` - [x] Add `BuildCheckNotNullOrEmpty` method to `ArgumentDefinition.cs` - [x] Update `BuildMethods()` to include the 3 new methods - [x] Update generated `TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/Argument.cs` - [x] Update `docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Internal/Argument.cs` - [x] Add tests to `ArgumentTests.cs` (10 new tests, all passing) - [x] Remove `ThrowArgumentOutOfRangeException` helper β€” inline `Throw` directly in `BuildAssertInRange` - [x] Build and verify tests pass (17 ArgumentTests pass)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add Additional Argument Internal Helper Methods > The .net autorest generator supported generated these internal helper methods, which are consumed by the .NET storage library: > > - [AssertInRange](https://github.com/Azure/azure-sdk-for-net/blob/f9ae421fb5a06e9678fe2ab95336145fdef96728/sdk/core/System.ClientModel/src/Internal/Argument.cs#L38) > - [AssertNotNullOrWhitespace](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/src/Generated/Internal/Argument.cs#L66) > - [CheckNotNullOrEmpty](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/src/Generated/Internal/Argument.cs#L115) > > We should update our generator to support generating these internal helper methods. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9793 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: Jorge Rangel * [python] pass decompress through in iter bytes (#9779) fixes #9764 --------- Co-authored-by: iscai-msft * Add `collectionHeaderPrefix` client option for dictionary request headers (#9799) - [x] Add `collectionHeaderPrefix?: string` to TypeScript `InputHeaderParameter` type - [x] Emit `collectionHeaderPrefix` from TCGC decorator with safe string type validation - [x] Use `p.__raw ?? NoTarget` for diagnostic target in `operation-converter.ts` - [x] Only parse `collectionHeaderPrefix` when header parameter is a dictionary type (unwraps nullable) - [x] Add `CollectionHeaderPrefix` property to C# `InputHeaderParameter` - [x] Deserialize `collectionHeaderPrefix` in `InputHeaderParameterConverter` - [x] Add abstract method `AddCollectionHeaders` to `HttpRequestApi` - [x] Implement `AddCollectionHeaders` in `PipelineRequestProvider` - [x] Add `Add(prefix, dict)` extension method to `PipelineRequestHeadersExtensionsDefinition` - [x] Handle `CollectionHeaderPrefix` in `RestClientProvider.AppendHeaderParameters` with `IsNullOrEmpty` check - [x] Add `collectionHeaderPrefix` to `InputFactory.HeaderParameter` test factory - [x] Add TypeScript test for `collectionHeaderPrefix` (positive case) - [x] Add TypeScript negative test for non-string `collectionHeaderPrefix` value + validate warning diagnostic is logged - [x] Add TypeScript test for non-dictionary header type returning `undefined` - [x] Update `ValidateAddMethodIsGenerated` to validate entire method (not just body) using `TypeProviderWriter` + `FilteredMethodsTypeProvider` - [x] Rename `TestCollectionHeaderPrefix_GeneratesAddWithPrefixCall` β†’ `TestCollectionHeaderPrefix_UsesAddWithPrefixCall` with `TestCase(true/false)` - [x] Remove changelog file from outside `http-client-csharp` folder - [x] Revert README.md (was not part of the required changes)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add Client Option for collectionHeaderPrefix > We need to add a new client option `collectionHeaderPrefix` that would only be applicable for dictionary request headers, that would be supplied via the `clientOption` decorator, ie. > ``` > alias MetadataHeaders = { > @header("x-ms-meta") > @clientOption("collectionHeaderPrefix", "x-ms-meta", "csharp") > metadata?: Record; > }; > ``` > The value of the option would be the prefix to use when adding the header to the request. When building the request, we would append the prefix to each key in the dictionary. In addition, we would need to add a new [HttpRequest](https://github.com/microsoft/typespec/blob/6a2cd4cc4393f24f8cd02c535c7b4abe4aa9e7d4/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/Abstractions/HttpRequestApi.cs#L20) API to allow generating an extension method to handle this: > > ```csharp > public static void Add(this PipelineRequestHeaders headers, string prefix, IDictionary headersToAdd) > { > foreach (var header in headersToAdd) > { > headers.Add(prefix + header.Key, header.Value); > } > } > ``` > > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9798 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * http-client-java, support apiVersions property in metadata.json (#9725) Fix https://github.com/Azure/autorest.java/issues/3265 Sample ``` {"flavor":"Azure","apiVersions":{"Azure.ResourceManager.MultiServiceOlderVersions.Compute":"2024-11-01","Azure.ResourceManager.MultiServiceOlderVersions.ComputeDisk":"2024-03-02"}, ``` --- Also affect pom.xml and other md file. E.g. for mixed version, description will now be ``` Package api-version Azure.ResourceManager.MultiServiceOlderVersions.Compute: 2024-11-01, Azure.ResourceManager.MultiServiceOlderVersions.ComputeDisk: 2024-03-02 ``` instead of ``` Package api-version 2024-11-01 ``` --- apiview JSON file is no longer generated * [compiler] Functions, reborn (#9060) This PR implements `fn` in TypeSpec. Functions are like decorators in that they are callable entities bound to implementations through the TypeSpec JavaScript host function interface. Functions are declared using `extern fn` and must bind to an implementation declared through a `$functions` export in a JS source file. Functions accept _and_ produce entities. Value arguments to functions are converted to JS values like decorator arguments are, and the inverse is also true for functions: returned JS values are converted to TSP Value entities through an "unmarshaling" process. This allows the implementation to be natural for JS developers while integrating with the TSP value space. Functions are _values_, not types. They can be assigned to `const` declarations. The _result of calling_ a function can be either a Type or a Value, but the function itself is a value. Functions can have a return type constraint. The default return type constraint of a function, if none is specified, is `unknown`. Functions can also return `void`, in which case JS functions that return `undefined` are specially accepted _as if_ they returned `voidType`. This allows JS void functions to bind naturally to TypeSpec functions that return `void`. Functions calls are evaluated at check-time. When a `CallExpression` is checked, where the callee is an instance of `FunctionValue`: - We first check the arguments to the function for compatibility with the function's signature. - We marshal the arguments to JS if necessary. - We call the underlying implementation to get the value it returns. - We unmarshal the return value to TypeSpec if necessary. - We check the unmarshaled entity for assignability to the return constraint. - The `CallExpression` checking result is the unmarshaled entity. Functions support mixed constraints (`Type | valueof Type`) in both parameter and return position. Like decorators, functions cannot serve as regular types and are only allowed to appear when resolving the target of a `CallExpression`. `model Foo { p: f }` where `f` is a `FunctionType` is not allowed, but `model Foo { p: f() }` is. Unlike decorators, function host bindings _MUST_ use `$functions`. Bare exported functions are not bound to JS source files. Functions appear in the type graph as `functionDeclarations` on a Namespace. The semantic walker has been updated to visit FunctionValue declarations. TSPD is updated to generate extern signatures for functions, like decorators. In addition to function _declarations_, this PR also adds syntax for function _types_. A function type is the signature of a function and does not contain an implementation (it is not _unique_ to a particular function declaration). Function types are only assignable to other function types and to the top type `unknown`. A function type is a type expression of the grammatical form `'fn' '(' ParameterList? ')' ('=>' MixedConstraint)?`. Like with a function declaration, the return type is implicitly `unknown` if not specified. Function types observe strict assignability rules that obey contravariance over parameter assignability. A function type F1 is assignable to a function type F2 if: - F1 is identical to F2; OR - The parameters of F2 are assignable to the parameters of F1, AND the return type of F1 is assignable to the return type of F2. Parameter assignability is determined by an algorithm that guarantees that each parameter in the source function (which is the _target_ of parameter assignability) is satisfied by a corresponding parameter in the target function (which is the _source_ of parameter assignability), given the following rules: - A required parameter with constraint T must be satisfied by a required parameter with constraint U, where U is assignable to T. A required parameter may not be satisfied by an optional parameter or an item of a rest parameter. - An optional parameter with constraint T _may_ be satisfied by any parameter (required, optional, or rest item) of type U, but if it is, U must be assignable to T. - If the target parameter list terminates with a rest entry (`...rest: T[]`) of array type `T[]`, then the type U of each subsequent parameter in the source parameter list (required, optional, or rest item) must be assignable to type T. Notably: - Rest parameters cannot assign to required parameters, since a rest parameter is effectively optional: `fn (x: valueof string)` does NOT assign to `fn(...rest: valueof string[])`. TypeScript allows this, but it creates soundness problems that we will need to be aware of if we decide to relax this restriction in the future. * Tweak agent instructions (#9805) - Add skill for formatting - Tweak the changelog generation to be cleaner * Fix deserialization code to pass ModelReaderWriterOptions to custom hook methods (#9801) - [x] Add helper method to check/build arguments for custom deserialization hooks - [x] Fix JSON deserialization hook to pass correct arguments based on hook signature - [x] Fix XML deserialization hook to pass correct arguments based on hook signature - [x] Make parameter matching resilient: `ref` params β†’ ref variable, known types matched by name, unknowns get `default` - [x] Use `CanonicalView` instead of `CustomCodeView` in `FindCustomHookMethod` - [x] Fix fallback path when hook method not found: preserve previous behavior `(firstArg, ByRef(refVariable))` - [x] Remove `xmlValueTypeName` parameter from `GetXmlDeserializationHookStatement`, infer from `ScopedApi.Type.Name` - [x] Add JSON test `CanCustomizeDeserializationMethodWithOptions` - [x] Add JSON test `CanCustomizeDeserializationMethodWithoutOptions` - [x] Add XML test `CanCustomizeDeserializationMethodWithOptions` - [x] Revert changelog file outside of http-client-csharp folder - [x] Run tests to validate changes (1164 tests pass)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [http-client-csharp] Generated deserialization code does not pass ModelReaderWriterOptions to custom hook methods > When a custom deserialization hook method (e.g., [DeserializeFunctionArgumentsValue](https://github.com/openai/openai-dotnet/blob/f786f16acc21df99774683115d39ad3eea4172ee/src/Custom/Responses/Items/FunctionTool/FunctionCallResponseItem.Serialization.cs#L26)) declares a `ModelReaderWriterOptions options` parameter, the generated deserialization code at the call site does not pass the `options` value through(e.g. [DeserializeFunctionArgumentsValue](https://github.com/openai/openai-dotnet/blob/f786f16acc21df99774683115d39ad3eea4172ee/src/Generated/Models/Responses/FunctionCallResponseItem.Serialization.cs#L127)). > > ### Expected behavior > > The generated code should forward the `options` parameter to the custom deserialization hook: > > ```csharp > DeserializeFunctionArgumentsValue(prop, ref functionArguments, options); > ``` > > ### Impact > > This forces custom deserialization hooks to hard-code `ModelSerializationExtensions.WireOptions` instead of flowing the caller-provided `options`, which may behave incorrectly in non-wire serialization scenarios. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9800 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * [python] add missing pylint disable for list of elements deserialization in paging callback (#9769) Co-authored-by: iscai-msft * [python] let client options on child clients override parent client (#9776) fixes #9757 --------- Co-authored-by: iscai-msft * Fix `__eq__` of `_MyMutableMapping` to use `isinstance` check (#9812) `_MyMutableMapping.__eq__` was constructing a new instance via `self.__class__(other)` for every comparison, which is expensive, can mask bugs by catching all exceptions, and produces surprising semantics (e.g., a model could compare equal to arbitrary objects if the constructor happens to accept them). Replace with a straightforward `isinstance` check: ```python def __eq__(self, other): if isinstance(other, _MyMutableMapping): return self._data == other._data return False ``` ### Remaining work - Existing tests that assert `model == dict_response` (plain dict) need updating β€” they will now return `False` as intended - Unit tests covering the new `__eq__` behavior need to be added - Changelog entry (`.chronus/changes/`, `changeKind: fix`) not yet added > [!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: > > - `cdn.jsdelivr.net` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/packages/http-client-python/node_modules/.bin/tsp compile /home/REDACTED/work/typespec/typespec/packages/http-client-python/node_modules/@typespec/http-specs/specs/type/array/main.tsp --emit /home/REDACTED/work/typespec/typespec/packages/http-client-python --option @typespec/http-client-python.package-name=typetest-array --option @typespec/http-client-python.namespace=typetest.array --option @typespec/http-client-python.use-pyodide=true --option @typespec/http-client-python.flavor=azure --option @typespec/http-client-python.generate-test=true --option @typespec/http-client-python.generate-sample=true --option @typespec/http-client-python.emitter-output-dir=/home/REDACTED/work/typespec/typespec/packages/http-client-python/generator/test/azure/generated/typetest-array` (dns block) > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/packages/http-client-python/node_modules/.bin/tsp compile /home/REDACTED/work/typespec/typespec/packages/http-client-python/node_modules/@typespec/http-specs/specs/type/model/inheritance/recursive/main.tsp --emit /home/REDACTED/work/typespec/typespec/packages/http-client-python --option @typespec/http-client-python.package-name=typetest-model-recursive --option @typespec/http-client-python.namespace=typetest.model.recursive --option @typespec/http-client-python.use-pyodide=true --option @typespec/http-client-python.flavor=azure --option @typespec/http-client-python.generate-test=true --option @typespec/http-client-python.generate-sample=true --option @typespec/http-client-python.emitter-output-dir=/home/REDACTED/work/typespec/typespec/packages/http-client-python/generator/test/azure/generated/typetest-model-recursive` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
--- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * [python] release new version (#9814) * Update eng scripts for new azure-sdk-for-net package management folder structure (#9808) `eng/Packages.Data.props` in azure-sdk-for-net was split into multiple files. Generator packages now live in `eng/centralpackagemanagement/Directory.Generation.Packages.props`. ## Changes - **`Submit-AzureSdkForNetPr.ps1`** β€” Update `$propsFilePath`/`$packagesDataPropsPath` path construction, error/warning messages, PR body text, and git add list - **`RegenPreview.ps1`** β€” Update `$packagesDataPropsPath` path variables (2 occurrences), git restore list, and all descriptive comments - **`RegenPreview.psm1`** β€” Update `$packagesDataPropsPath` path variable, all `Write-Host` log messages referencing the file, and function/parameter documentation - **`docs/RegenPreview.md`** β€” Update documentation references to match new path
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Update Eng Upgrade/Regen Scripts to Account for New Pkg Mgmt Folder Structure > The folder structure of the package management files changed in https://github.com/Azure/azure-sdk-for-net/pull/55609. We need to update the existing scripts in https://github.com/microsoft/typespec/tree/main/packages/http-client-csharp/eng/scripts to account for this folder change. In particular, the `eng/Packages.Data.props" file was split into multiple files. For the generator packages, we now want to target [this file](https://github.com/Azure/azure-sdk-for-net/blob/main/eng/centralpackagemanagement/Directory.Generation.Packages.props) > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9807 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * [Automated] Merge release/feb-2026 into main (#9825) Backmerges `release/feb-2026` hotfix changes into `main`. ## Changes from release/feb-2026 - **Bug fix**: `Content-Type` header was being dropped from `HttpOperationResponseContent` response headers for `@head` operations β€” now preserved correctly (`packages/http/src/http-property.ts`, `responses.ts`) - **CHANGELOG + version**: `@typespec/http` bumped to `1.9.1` with release notes added
Original prompt > Create a PR in `microsoft/typespec` to merge `release/feb-2026` back into `main`, strictly following the repository’s contributing guidelines. > > Requirements: > - First, read and follow `CONTRIBUTING.md` and any relevant docs (e.g., release/branching/backport documentation) to ensure the PR meets all project conventions. > - Determine the required merge strategy and any required PR title/body format, labels, or checklists. > - If there are conflicts when merging `release/feb-2026` into `main`, resolve them in a way consistent with the repo’s guidelines. > - Ensure CI passes and update any release notes/changelog files if the contributing/release docs require it when merging release branches. > - The PR should be from `release/feb-2026` into `main`. > > Context: > - Current date: 2026-02-26 > - User: timotheeguerin > > Deliverables: > - Open the PR with a clear, guideline-compliant title and description. > - Summarize key steps taken and any conflicts resolved. >
*This pull request was created from Copilot chat.* > --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Timothee Guerin * fix(openapi3): preserve array constraints on nullable arrays defined with anyOf + null (#9802) `tsp-openapi3` silently drops array constraints (`minItems`, `maxItems`) when the array property is nullable via `anyOf: [{type: "array", ...}, {type: "null"}]`. Constraints placed on the outer schema level were ignored because no top-level `type` field meant `effectiveType` was never set to `"array"`, so `getArraySchemaDecorators` was never called. ## Changes - **`decorators.ts`** β€” After the existing `effectiveType` inference logic, add a fallback: if `effectiveType` is still `undefined` and the schema has `anyOf`/`oneOf`, check for a single non-null typed member and use its type as `effectiveType`. This routes nullable array schemas into the `"array"` switch branch, correctly applying `minItems`/`maxItems` from the outer schema. - **`convert-openapi3-doc.test.ts`** β€” Add a test covering nullable array properties with both `minItems` and `maxItems` constraints using `anyOf` + `null`. ### Before / After Input: ```yaml bar: anyOf: - type: array items: type: string - type: 'null' minItems: 2 maxItems: 10 ``` Before: ```tsp bar: string[] | null; ``` After: ```tsp @minItems(2) @maxItems(10) bar: string[] | null; ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: tsp-openapi3 ignores schema details for nullable array > ### Describe the bug > > For the input: > ```yaml > openapi: 3.2.0 > info: > title: (title) > version: 0.0.0 > tags: [] > paths: {} > components: > schemas: > Foo: > type: object > required: > - bar > properties: > bar: > anyOf: > - type: array > items: > type: string > - type: 'null' > minItems: 2 > > ``` > Running `tsp-openapi3` generates the following: > ```tsp > import "@typespec/http"; > import "@typespec/openapi"; > import "@typespec/openapi3"; > > using Http; > using OpenAPI; > > @service(#{ title: "(title)" }) > @info(#{ version: "0.0.0" }) > namespace title; > > model Foo { > bar: string[] | null; > } > ``` > Where the appropriate representation for the model would be: > ```tsp > model Foo { > @minItems(2) > bar: string[] | null; > } > ``` > > As an extra detail, if we remove the nullability from the input: > ```yaml > openapi: 3.2.0 > info: > title: (title) > version: 0.0.0 > tags: [] > paths: {} > components: > schemas: > Foo: > type: object > required: > - bar > properties: > bar: > type: array > items: > type: string > minItems: 2 > ``` > The tool properly generates: > ```tsp > import "@typespec/http"; > import "@typespec/openapi"; > import "@typespec/openapi3"; > > using Http; > using OpenAPI; > > @service(#{ title: "(title)" }) > @info(#{ version: "0.0.0" }) > namespace title; > > model Foo { > @minItems(2) bar: string[]; > } > ``` > > ### Reproduction > > All details are provided in the description. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > start by implementing unit tests first > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9795 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Migrate init templates to createTester API and update ESLint to latest standard (#9596) ## Migration Complete: Update init templates to use new testing framework βœ… - [x] Update library-ts template files - [x] Update `test-host.ts.mu` to use `createTester` with `node:test` and correct path resolution - [x] Update `decorators.test.ts.mu` to use new tester pattern with proper type assertions - [x] Update `eslint.config.js` to use `defineConfig` from `eslint/config` with `typescript-eslint` package - [x] Update `package.json` to use `typescript-eslint` instead of separate packages - [x] Update emitter-ts template files - [x] Update `test-host.ts.mu` to use `createTester` with `node:test` and correct path resolution - [x] Update `hello.test.ts` to use `node:test` instead of `vitest` - [x] Update `eslint.config.js` to use `defineConfig` from `eslint/config` with `typescript-eslint` package - [x] Update `package.json` to use `typescript-eslint` instead of separate packages - [x] Regenerate snapshots in `__snapshots__` directory - [x] Addressed all feedback: - [x] Reverted vitest to node:test (bare minimum) - [x] Updated eslint to latest standard with `defineConfig` - [x] Added changelog - [x] Fixed E2E test failures ## Changes Made 1. Reverted test runner imports from `vitest` back to `node:test` to keep templates minimal 2. Fixed path resolution: Changed `resolvePath(import.meta.dirname, "..")` to `resolvePath(import.meta.dirname, "../..")` to account for `dist/test/` structure 3. Removed duplicate `emit` option in emitter test-host (already in `.emit()` chain) 4. **Updated ESLint configuration to latest standard:** - Replaced `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` with unified `typescript-eslint` package (v8.49.0) - Uses `defineConfig` from `eslint/config` instead of `tsEslint.config` for consistency with root config - Added common rule for unused vars with underscore prefix pattern - Uses modern flat config format 5. **Added changeset** for the compiler package documenting the internal changes 6. **Fixed library-ts template tests:** - Removed `.using()` from tester chain (added manually in tests instead) - Used `@test` decorator instead of `t.code` templates for simpler, more reliable tests - Fixed type assertions to use `as unknown as { test: Operation; program: Program }` - All template E2E tests now pass ## Summary Successfully migrated both library-ts and emitter-ts init templates to the new `createTester` testing framework while keeping templates minimal and using the latest ESLint standards with `defineConfig` from `eslint/config`. All E2E tests passing.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Update init templates to use new testing framework > the library and emitter init templates use the createTestHost still we should migrate to createTester > > Migrate the compiler init templates to the new tester. Use this doc on how to do it https://typespec.io/docs/extending-typespec/testing/#migrate-from-test-host > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9594 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Timothee Guerin * Add codefix support in the TypeSpec playground (#9819) - [x] Export `resolveCodeFix` from `packages/compiler/src/index.ts` - [x] Add `updateDiagnosticsForCodeFixes()` function and working code action provider in `packages/playground/src/services.ts` - [x] Update `packages/playground/src/react/playground.tsx` to call `updateDiagnosticsForCodeFixes()` after each compilation - [x] Split changelog into separate entries for compiler and playground - [x] Build and lint pass, CodeQL security check clean
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Codefixes in the playground > PR here https://github.com/microsoft/typespec/pull/2888 add codefixes support but due to how the language server and playground differ in reporting diagnostic we cannot easily make use of the codefixes in the playground. > So separating that implementation > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#2917 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Timothee Guerin * Move integration tester from typespec-azure (#9642) Azure pr https://github.com/microsoft/typespec/pull/9642 Changes apart from just moving the files: - Load the config form the cwd in `.typespec-integration/config.yaml` - Default clone and wd is `.typespec-integration/temp` * Expand pkg-pr-new tryit link to standalone packages (#9553) Add support for python and csharp emitter to pkg-pr-new when files from those packages are modified image * Fix XML serialization for model collections (#9826) - [x] 1. Add `nameHint` parameter to `WriteObjectValue` for `XmlWriter` in `ModelSerializationExtensionsDefinition.Xml.cs` - [x] 2. Update `ModelSerializationExtensionsSnippets.Xml.cs` to support `nameHint` parameter - [x] 3. Add new XML `FromEnumerable` overload in `BinaryContentHelperDefinition.cs` with `rootNameHint` and `childNameHint` - [x] 4. Update `BinaryContentHelperSnippets.cs` with new `FromEnumerable` overload for XML - [x] 5. Update `ScmMethodProviderCollection.cs` serialization path to use XML `FromEnumerable` when content type is XML and body is list - [x] 6. Update `ScmMethodProviderCollection.cs` deserialization path to use XDocument-based XML deserialization when response content type is XML - [x] 7. Address review feedback (round 1) - [x] 8. Address review feedback (round 2) - [x] 9. Make `BinaryContentHelperDefinition` class public - [x] 10. Use `AddRange` in `ModelSerializationExtensionsDefinition.Xml.cs` - [x] 11. Fix variable naming in `FromEnumerable` XML method (stream0/writer0/stream1 β†’ stream/writer) and add test - [x] 12. Regenerate generated libraries with `eng/scripts/Generate.ps1` - [x] 13. Run tests and validate changes - [x] 14. Update test to validate entire FromEnumerable method including signature using TypeProviderWriter - [x] 15. Address review feedback (round 3): use AddRange in BinaryContentHelperDefinition.cs, revert Generate.ps1, simplify test to validate only FromEnumerable method (signature + body) - [ ] 16. Run code review and security checks
Original prompt ---- *This section details on the original issue you should resolve* Fix XML Serialization For Model Collections Consider this operation: ``` @Xml.name("SignedIdentifiers") model SignedIdentifiers is SignedIdentifier[]; /** The signed identifier. */ @Xml.name("SignedIdentifier") model SignedIdentifier { /** The unique ID for the signed identifier. */ @Xml.name("Id") id: string; } @post op Foo(@body body: SignedIdentifiers, @header contentType: "application/xml"): void; @get @route("/foo") op GetFoo(): { @header contentType: "application/xml"; @body body: SignedIdentifiers; }; ``` Since the request and response payload bodies are model collections, we cannot use ModelReaderWriter directly to serialize. We need to update our BinaryContentHelper and ModelSerializationExtensions to correctly handle this case. For BinaryContentHelper, we need to generate this new helper method: ```csharp public static BinaryContent FromEnumerable(IEnumerable enumerable, string rootNameHint, string childNameHint) where T : notnull { using (MemoryStream stream = new MemoryStream(256)) { using (XmlWriter writer = XmlWriter.Create(stream, ModelSerializationExtensions.XmlWriterSettings)) { writer.WriteStartElement(rootNameHint); foreach (var item in enumerable) { writer.WriteObjectValue(item, ModelSerializationExtensions.WireOptions, childNameHint); } writer.WriteEndElement(); } if (stream.Position > int.MaxValue) { return BinaryContent.Create(BinaryData.FromStream(stream)); } else { return BinaryContent.Create(new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position))); } } } ``` In the generated conv method, we then need to call this helper and pass in the both the serialized name of the collection and the serialized name of it's model elements: ```csharp public virtual ClientResult Foo(IEnumerable body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using BinaryContent content = BinaryContentHelper.FromEnumerable(body, "SignedIdentifiers", "SignedIdentifier"); return Foo(content, cancellationToken.ToRequestOptions()); } ``` The ModelSerializationExtension's `WriteObjectValue` method for XML writer will need to be updated to this: ```csharp public static void WriteObjectValue(this XmlWriter writer, T value, ModelReaderWriterOptions options = null, string nameHint = null) { switch (value) { case IPersistableModel persistableModel: BinaryData data = ModelReaderWriter.Write(persistableModel, options ?? WireOptions, SampleTypeSpecContext.Default); using (Stream stream = data.ToStream()) { using (XmlReader reader = XmlReader.Create(stream, XmlReaderSettings)) { reader.MoveToContent(); if (nameHint != null) { writer.WriteStartElement(nameHint); reader.ReadStartElement(); while (reader.NodeType != XmlNodeType.EndElement) { writer.WriteNode(reader, true); } writer.WriteEndElement(); } else { reader.ReadStartElement(); while (reader.NodeType != XmlNodeType.EndElement) { writer.WriteNode(reader, true); } } } } return; } } ``` For deserialization, we need to update the generated conv method to handle deserializing the payload directly: ```csharp public virtual ClientResult> GetFoo(CancellationToken cancellationToken = default) { ClientResult result = GetFoo(cancellationToken.ToRequestOptions()); IReadOnlyList value = default; BinaryData data = result.GetRawResponse().Content; using Stream stream = data.ToStream(); XDocument document = XDocument.Load(stream, LoadOptions.PreserveWhitespace); if (document.Element("SignedIdentifiers") is XElement signedIdentifiersElement) { List array = new List(); foreach (XElement item in signedIdentifiersElement.Elements("SignedIdentifier")) { ...
- Fixes microsoft/typespec#9824 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: Jorge Rangel * Bump rollup from 4.57.1 to 4.59.0 in /packages/http-client-python (#9820) Bumps [rollup](https://github.com/rollup/rollup) from 4.57.1 to 4.59.0.
Release notes

Sourced from rollup's releases.

v4.59.0

4.59.0

2026-02-22

Features

  • Throw when the generated bundle contains paths that would leave the output directory (#6276)

Pull Requests

v4.58.0

4.58.0

2026-02-20

Features

  • Also support __NO_SIDE_EFFECTS__ annotation before variable declarations declaring function expressions (#6272)

Pull Requests

Changelog

Sourced from rollup's changelog.

4.59.0

2026-02-22

Features

  • Throw when the generated bundle contains paths that would leave the output directory (#6276)

Pull Requests

4.58.0

2026-02-20

Features

  • Also support __NO_SIDE_EFFECTS__ annotation before variable declarations declaring function expressions (#6272)

Pull Requests

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rollup&package-manager=npm_and_yarn&previous-version=4.57.1&new-version=4.59.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/microsoft/typespec/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump TCGC to 0.65.4 in http-client-csharp (#9831) Bumps `@azure-tools/typespec-client-generator-core` from `0.65.3` to `0.65.4` in the `http-client-csharp` emitter. `0.65.4` is a patch release that fixes an incorrect cross-namespace naming collision check. ## Changes - **`package.json`**: `devDependencies` updated to `0.65.4`; `peerDependencies` lower bound raised from `>=0.65.3` to `>=0.65.4` - **`package-lock.json`**: Regenerated to reflect the new resolved version
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Bump TCGC to 0.65.4 > We need to bump the tcgc to version [0.65.4](https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/CHANGELOG.md#0654) in the http-client-csharp emitter. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9830 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * build: use .net global.json for ci (#9834) * [python] add skill to diff changes with upstream (#9828) Co-authored-by: iscai-msft Co-authored-by: Claude Opus 4.5 * fix: handle duplicate method signatures in BuildCurrentMethodSignatures (#9836) Replace ToDictionary with TryAdd loop in ClientProvider.BuildCurrentMethodSignatures to gracefully handle duplicate method signatures. This prevents an ArgumentException when multiple methods share the same signature (e.g. overloaded operations with different body types producing identical protocol method signatures). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: enable additional encode duration tests (#9839) * Fix tpm build order (#9837) Recent pr adding tpm to build all packages including standalone ones seems to not work well into building the upstream dependencies. This should fix it. * http-client-java, warning on not spread json-merge-patch payload (#9844) for https://github.com/Azure/azure-sdk-for-java/pull/47952#discussion_r2866937701 image * Docs: Fix useAuth example highlighted line (#9865) ## Switch highlight comment to correct line **Problem:** On [Example: Enforcing Authentication on Specific Operations](https://typespec.io/docs/getting-started/getting-started-rest/05-authentication/#example-enforcing-authentication-on-specific-operations), into the Authentication documentation, the `@useAuth(BearerAuth)` should be highlighted. But, the delete route declaration is highlighted instead: image **Solution:** Modified `ins={104}` to `ins={103}` * Extensible enum generation (#7993) Match generation of extensible enums form c# client emitter https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ProvisioningState.cs * Upgrade dependencies (#9838) Retry without eslint as the other one causing OOM in linting. https://github.com/Azure/typespec-azure/pull/3986 * Add backcompat target for client (#9721) * [compiler]`internal` symbols (#9762) This PR enables libraries to define `internal` symbols that cannot be referenced from outside the same project scope. `internal` can apply to any declaration _except_ **namespace**. Internality is a property of _symbols_, not of _types_. A Type that is declared `internal` can be used from a different package, but can't be referred to by name. This allows you to use an alias to publicly expose an `internal` declaration: ```tsp internal model X {} // Totally fine -- the model itself isn't internal, only the _symbol_ `X` is. alias Public = X; ``` Resolution logic for symbols declared with `internal` is: - Resolution is **allowed** if the source location is in the compiler stdlib or is synthetic (programmatic through `checker.resolveTypeReference` or otherwise synthetic). - Resolution is **allowed** if the source location is a library, and the target symbol was declared within that same library. - Resolution is **allowed** if the source location is the user project, and the target symbol was declared within the user project. - Resolution is otherwise **disallowed**. **Notes**: - To preserve backwards compatibility, `internal` is allowed as the name of a model property, since it is allowed as one now. The logic for this also allows **`extern`** to be a model property name, which isn't currently allowed. Implementation: - Refactors parser a bit to handle modifiers on all declarations. - Adds `SymbolFlags.Internal`, which binds to a symbol if the corresponding declaration has `ModifierFlags.Internal`. - Access control is enforced in `resolveTypeReferenceSymInternal` when resolving a type reference. Access control must pass for any referenced symbol. * Add section for Typespec customization guidance (#9429) * Add support for OAS 3.2 nested tags via parent field in @tagMetadata (#9577) ## Add support for OAS 3.2 Nested Tags - [x] Update TypeSpec.OpenAPI.TagMetadata model to include `parent` field in decorators.tsp - [x] Update generated TypeScript types for TagMetadata interface - [x] Add parent field handling to resolveDocumentTags() in openapi.ts - For OpenAPI 3.2: emit `parent` field natively - For OpenAPI 3.0/3.1: **drop the field entirely** (not supported in these versions) - [x] Add comprehensive tests for parent field in 3.0, 3.1, and 3.2 - [x] Update documentation with examples - [x] Address review feedback to drop field instead of converting to x-parent - [x] Run pnpm format to fix formatting issues - [x] Add changeset for release notes ## Summary This PR adds support for OpenAPI 3.2 nested tags by introducing a `parent` field in the `@tagMetadata` decorator. **Changes**: 8 files, 106 insertions, 8 deletions The implementation correctly handles version differences: - **OpenAPI 3.2**: Emits `parent` field natively - **OpenAPI 3.0/3.1**: Drops the `parent` field entirely (not supported in these versions)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add support for OAS 3.2 Nested Tags > ### Clear and concise description of the problem > > According to OAS 3.2 spec tags now can have parent field, allowing to create tags hierarchy. > > https://spec.openapis.org/oas/v3.2.0.html#tag-object > > I couldn't find any documentation around it and seems like it wasn't yet implemented. > > I'm proposing to to extend default ```@tag``` decorator to accept now variadic amount of strings. > > ```typespec > @tag("parent1", "parent2", "actual-tag") > op myop(): void > ``` > > In this case all strings will represent hierarchy path. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Read the [docs](https://typespec.io/docs/). > - [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate. > > we need to add support for `parent` in `@tagMetadata` decorator. Note that this property only is supported in openapi 3.2, when emitting 3.0 or 3.1 it should be dropped. > > ## Comments on the Issue (you are @copilot in this section) > > > @timotheeguerin > that might more be part of the `@tagMetadata` > > Like this but without the `x-` > [playground](https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=aW1wb3J0ICJAdHlwZXNwZWMvb3BlbmFwaSI7Cgp1c2luZyBPcGVuQVBJOwoKQHNlcnZpY2UKQHRhZ01ldGFkYXRhKCJwZXQiLCAjewogIGRlc2NyaXB0aW9uOiAiUGV0Igp9Kc8vY2HXL0PEGQogIGB4LXBhcmVudGA6IMZdxEVuYW1lc3BhY2UgTXnkAIx0YWfGTCkKb3AgdGVzdCgpOiBzdHJpbmc7&options=%7B%7D&vs=%7B%7D) > > ```tsp > @service > @tagMetadata("pet", #{ > description: "Pet" > }) > @tagMetadata("cat", #{ > description: "Cat", > `x-parent`: "pet", > }) > namespace My; > > @tag("cat") > op test(): string; > ``` > @timotheeguerin > Oh I wouldn't say it's done, we still need to allow putting parent directly without `x-`. And what does that mean for 3.1 and 3.0. One option is to add the x- if someone try to use it but emit 3.0 or 3.1 > >
- Fixes microsoft/typespec#9510 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Timothee Guerin * Playground config as yaml (#9843) * Parallel loading of libs (#9760) * Fix symbol in decorator state not being displayed (#9617) fix https://github.com/Azure/typespec-azure/issues/534 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> * Emitter options cli info (#9829) Add a new functionality to `tsp info` that you can use with `tsp info ` which will give you the details of the options. Also plugs in when using `--help` with `tsp compile . --emit --help` image render nested options image * Use apiview.org temporarily (#9870) * Add spector update skill (#9871) * Fix: write MethodSignature.NonDocumentComment during code generation (#9873) - [x] Add `NonDocumentComment` writing in `WriteMethodDeclarationNoScope` in `CodeWriter.cs` - write it as a `// comment` line before the method attributes - [x] Add a test in `CodeWriterTests.cs` to verify `NonDocumentComment` is written correctly - [x] Run tests to verify the fix works (39/39 passing) - [x] Remove unnecessary changelog entry
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > MethodSignature.NonDocumentComment is not used > The purpose of this is to provide a short comment as opposed to XML ref docs for a method. We should either use it or remove it. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#6193 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix customization guidance text docs (#9877) * Add Partial and Abstract modifiers to MethodSignatureModifiers enum (#9864) `MethodSignatureModifiers` lacks `Partial` and `Abstract` flags, preventing generators from emitting partial or abstract methods in generated code. ### Changes - **`MethodSignatureModifiers.cs`** β€” Added `Partial = 8192` and `Abstract = 16384` flags - **`CodeWriter.cs`** β€” Write `partial` and `abstract` keywords in method declarations; handle partial/abstract methods with no body (emit declaration + semicolon instead of braces) - **`MethodProvider.cs`** β€” New constructor `MethodProvider(signature, enclosingType)` for bodiless method declarations (partial/abstract); fixed `Accept` to handle null `BodyStatements` when `BodyExpression` is also null ### Usage ```csharp // Partial method with body (implementing declaration) var method = new MethodProvider( new MethodSignature("DefineAdditionalProperties", null, MethodSignatureModifiers.Private | MethodSignatureModifiers.Partial, returnType: null, returnDescription: null, parameters: []), MethodBodyStatement.Empty, enclosingType); // Partial method without body (defining declaration) var method = new MethodProvider( new MethodSignature("DefineAdditionalProperties", null, MethodSignatureModifiers.Private | MethodSignatureModifiers.Partial, returnType: null, returnDescription: null, parameters: []), enclosingType); // Abstract method without body var method = new MethodProvider( new MethodSignature("GetDefaultOptions", null, MethodSignatureModifiers.Protected | MethodSignatureModifiers.Abstract, returnType: typeof(string), returnDescription: null, parameters: []), enclosingType); ``` Generates respectively: ```csharp private partial void DefineAdditionalProperties() { } private partial void DefineAdditionalProperties(); protected abstract string GetDefaultOptions(); ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add Partial modifier to MethodSignatureModifiers enum > ## Feature Request > > **MethodSignatureModifiers** in `Microsoft.TypeSpec.Generator.Primitives` does not include a \Partial\ flag. > > This prevents generators from emitting `partial` methods (e.g., `private partial void DefineAdditionalProperties()`) which are useful as extension points for customization in generated code. > > ### Proposed Change > > Add `Partial` to the `MethodSignatureModifiers` flags enum so that generators can declare partial methods via `MethodSignature`. > > ### Use Case > > The Azure Provisioning generator needs to emit a `private partial void DefineAdditionalProperties()` method in generated resource classes, allowing users to add additional property definitions in their own partial class files. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9863 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com> * Export extensible-enum for csharp (#9879) This pull request addresses a missing export for the extensible enum feature in C# and refactors related type and function names to avoid confliction. The main focus is to ensure that the extensible enum component is properly exported and its interface is accurately named. **Extensible Enum Export and Refactoring:** * Added a missing export for the extensible enum component in the C# emitter framework's index file (`packages/emitter-framework/src/csharp/components/index.ts`). * Renamed the interface from `EnumDeclarationProps` to `ExtensibleEnumDeclarationProps` in `extensible-enum.tsx` to avoid confiliction. * Updated the `ExtensibleEnumDeclaration` function to use the new `ExtensibleEnumDeclarationProps` interface. **Documentation and Change Tracking:** * Added a change log entry documenting the fix for the missing export in the `.chronus/changes/export-extensible-enum-2026-2-3-14-47-18.md` file. * Upgrade to eslint 10 (#9730) Notable eslint 10 which added a few more rules to the recommended ruleset. This actually found a few bugs/piece of dead code. * Fix to customized base type (#9885) Fixes https://github.com/microsoft/typespec/issues/9880 * Remove patch-implicit-optional warning (#9887) Remove the transitional warning that was added for the 1.0.0 migration period. The warning is past its planned November 2025 removal date. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Allow @typespec/openapi3 to receive more than one `file-type`. (#9890) This pull request enhances the OpenAPI emitter to support generating output files in multiple formats (YAML and JSON) simultaneously, rather than just one. It introduces the ability to specify an array of file types and updates the output file naming logic to accommodate this new feature. Comprehensive tests have been added to verify the correct behavior for various scenarios. ### Multi-format output support * The `file-type` option in `OpenAPI3EmitterOptions` can now be a single value or an array, allowing emission of both YAML and JSON files in one run. The schema and documentation were updated accordingly. [[1]](diffhunk://#diff-8e754a0b416c6b7edef4116e4cb37b7371a566271225792e901c19f47ad81277L8-R13) [[2]](diffhunk://#diff-8e754a0b416c6b7edef4116e4cb37b7371a566271225792e901c19f47ad81277R133-R151) [[3]](diffhunk://#diff-8e754a0b416c6b7edef4116e4cb37b7371a566271225792e901c19f47ad81277R162-R165) * The output file name logic now uses the `{file-type}` variable when multiple formats are specified, ensuring distinct filenames for each format. The default value and documentation for `output-file` were updated to reflect this. [[1]](diffhunk://#diff-8e754a0b416c6b7edef4116e4cb37b7371a566271225792e901c19f47ad81277L21-R22) [[2]](diffhunk://#diff-4bd1bb3341678026ea12e18757a3631f1c0f3458023775995aa78261df388ae0L209-R224) ### Emitter logic updates * The emitter now iterates over all specified file types, generating the appropriate output for each service and version. The logic for resolving output file names and serializing documents was updated to handle multiple formats. [[1]](diffhunk://#diff-4bd1bb3341678026ea12e18757a3631f1c0f3458023775995aa78261df388ae0R374-R396) [[2]](diffhunk://#diff-4bd1bb3341678026ea12e18757a3631f1c0f3458023775995aa78261df388ae0L601-R623) * The resolved emitter options and related interfaces were updated to use `fileTypes: FileType[]` instead of a single `fileType`. ### Testing * New tests were added to verify multi-format output, custom output file naming, and correct handling for multiple services and versioned services. These tests ensure that both YAML and JSON files are emitted as expected in all scenarios. * Fix CI preview failing when modifying private packages (#9900) - [x] Fix `getPublishablePackages` to exclude private packages (reading `package.json`) - [x] Add `isPrivate` field to `PackageInfo` interface - [x] Consolidate duplicate code: `utils/packages.ts` is now the canonical shared module; `tpm/packages.ts` re-exports from it and only adds `CRITICAL_PACKAGES` - [x] Fix lint error: add `eslint-disable-next-line no-console` before `console.warn` - [x] Fix formatting: collapse `getPublishablePackages` filter to single line per prettier
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Ci preview is failing when modifying private packages > The pkg-pr-new script must not be excluding private packages. Might be due to the change to tpm for standalone emitter and using a common helper > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9899 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> * Use tabs and fix background for tier selection (#9904) image When a table doesn't have any scenario for the selected tier it will also not be shown * docs: add note that copilot-instructions do not apply to emitter packages (#9912) The root `copilot-instructions.md` describes pnpm-based workflows that don't apply to `http-client-csharp`, `http-client-java`, and `http-client-python` β€” these packages are excluded from the pnpm workspace and do not require using pnpm. ## Changes - Added a prominent `[!IMPORTANT]` callout near the top of `.github/copilot-instructions.md` explicitly stating these instructions don't cover the emitter packages (links to their dedicated instruction files are already present at the bottom of the document)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Add note that repo copilot-instructions do not apply to emitter packages > https://github.com/microsoft/typespec/blob/main/.github/copilot-instructions.md does not apply to emitter packages. These packages generally don't use change logs or require using pnpm. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9911 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * [http-client-csharp] Introduce mechanism to disable inherited visitors (#9908) Derived generators inherit all visitors registered by ancestor generators via `base.Configure()`, with no way to opt out of specific ones. This adds `RemoveVisitor` overloads to `CodeModelGenerator` to address this. ## Changes - **`RemoveVisitor()`** β€” removes all visitors of exactly type `T` from the list (exact type match, not polymorphic; derived visitor types are unaffected) - **`RemoveVisitor(string visitorTypeName)`** β€” removes all visitors whose type name matches the given string; useful when the visitor type is not publicly accessible ## Usage ```csharp protected override void Configure() { base.Configure(); // registers ancestor visitors // Remove by type (when the visitor type is publicly accessible) RemoveVisitor(); // Remove by name (when the visitor type is internal or otherwise not public) RemoveVisitor("SomeInternalVisitor"); } ``` Exact-type matching is intentional for the generic overload: a derived generator that subclasses a visitor won't have its own visitor accidentally removed when disabling the base type. The string overload matches by `Type.Name`.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [http-client-csharp] Introduce a mechanism to disable a visitor from dependencies > now Mgmt Generator as a dependency, it gets the visitors in MTG and Azure Generator. > Something is different in DPG and MPG, therefore there are some visitors we would not need. > Could we introduce a mechanism to disable a inherited visitor? > > ## Comments on the Issue (you are @copilot in this section) > > > @ArcturusZhang > Since the issue that drove us to require this feature has been resolved by a recent update, this should not have high priority. But I think this kind of flexibility is nice to have. > >
- Fixes microsoft/typespec#9415 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * fix: Allow setting custom registry for tsp install (#9803) - [x] Move the "Environment Variables" section to the end of `website/src/content/docs/docs/handbook/cli.md` - [x] Run `pnpm format` to ensure no formatting issues - [x] Remove the `NODE_TLS_REJECT_UNAUTHORIZED` tip and example from the documentation
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: Internal compiler error TypeError: fetch failed. > ### Describe the bug > > On a laptop from work, behind a corporate firewall, which does SSL offloading, `fetchPackageManifest` fails due to `Error: unable to get local issuer certificate` > .. code: UNABLE_TO_GET_ISSUER_CERT_LOCALLY > > On our machines NPM points to an internal NPM-registry and we run with `npm config set strict-ssl false`. > > Direct outbound connections are blocked. > > > How do I configure tsp to ignore certifcate-errors? > > > > > > ### Reproduction > > ``` > √ Initialize a new project here?: Yes > √ Select a project template: Generic REST API > √ Enter a project name: typespec-poc > √ What emitters do you want to use?: OpenAPI 3.1 document [@typespec/openapi3] > > Γ— Installing dependencies > Internal compiler error! > File issue at https://github.com/microsoft/typespec > > TypeError: fetch failed > at node:internal/deps/undici/undici:12618:11 > at process.processTicksAndRejections (node:internal/process/task_queues:95:5) > at async fetchPackageManifest (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/package-manger/npm-registry-utils.js:8:17) > at async installTypeSpecDependencies (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/install/install.js:110:26) > at async file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:75:33 > at async trackAction (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/logger/console-sink.js:133:24) > at async initTypeSpecProjectWorker (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:74:9) > at async initTypeSpecProject (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:18:9) > at async initAction (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/cli/actions/init.js:7:9) > at async file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/cli/utils.js:35:29 { > cause: Error: unable to get local issuer certificate > at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34) > at TLSSocket.emit (node:events:518:28) > at TLSSocket._finishInit (node:_tls_wrap:1085:8) > at ssl.onhandshakedone (node:_tls_wrap:871:12) > at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) { > code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY' > } > } > ``` > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > @timotheeguerin > Hhm yeah we might not be fetching the endpoint configured. > As a workaround use `npm install` or whatever other package manager you prefer directely. > > Just to make sure I understand your scenario you are not using the public npm registry but some alternate one but also that endpoint is not https(or it is but you don't have a valid certificate so you want to ignore that?) > >
- Fixes microsoft/typespec#9786 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> Co-authored-by: markcowl <1031227+markcowl@users.noreply.github.com> * fix ICE in serializeValueAsJson (#9804) - [x] Add test for known scalar constructors as ModelProperty default values in openapi3 - [x] Fix serializeValueAsJson to return undefined for unrecognized scalar constructors - [x] Remove inadvertent csharp emitter file changes (reverted to pre-PR state)
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [core] ICE in serializeValueAsJson > ### Describe the bug > > The core library throws an uncaught Error on a custom scalar initializer with no arguments in `serializeValueAsJson`. The Error is provoked by the OpenAPI3 emitter (as well as the JSON Schema emitter) and bubbles back up to the emitter entrypoint where it triggers an ICE. > > The logic attempts to use the first argument of the initializer, which isn't reliable. That logic works for "cast-like" scalar values (e.g. `uuid("...")`), but not for initializers (e.g. `uuid.random() // no first argument!`). > > ### Reproduction > > ```tsp > scalar S { > init i(); > } > > model M { p: S = S.i(); } > ``` > > https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=c2NhbGFyIFMgewogIGluaXQgaSgpOwp9Cgptb2RlbCBNIHsgcDogUyA9IFMuxBsgfQ%3D%3D&options=%7B%7D&vs=%7B%7D > > However, if you provide a first argument, this is enough to quell the ICE but the emit is still wrong: > > ```tsp > scalar S { > init i(s: string); > } > > // Default value renders as "foo", which is wrong. > model M { p: S = S.i("foo") } > ``` > > https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=c2NhbGFyIFMgewogIGluaXQgaShzOiBzdHJpbmcpOwp9Cgptb2RlbCBNIHsgcDogUyA9IFMuaSgiZm9vIik7IH0%3D&options=%7B%7D&vs=%7B%7D > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > Instead we should drop the result if we don't recognize the constructor > > ## Comments on the Issue (you are @copilot in this section) > > > @timotheeguerin > Drop the result like we do with `now()` if we can't resolve the scalar constructor > >
- Fixes microsoft/typespec#9781 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> Co-authored-by: Timothee Guerin * Add overview support and emitter display names to spec-dashboard (#9891) ## Add overview support and emitter display names to spec-dashboard ### Summary This PR adds two new configuration options to the `spec-dashboard` package to improve the coverage dashboard UX: - **`showOverview`** β€” Renders coverage overview cards at the top of the dashboard, showing per-emitter coverage percentages at a glance. - **`emitterDisplayNames`** β€” Allows consumers to provide friendly display names for emitter columns (e.g., `@azure-tools/typespec-python` β†’ `Python`) instead of relying on generator metadata or raw package names. ### Changes | File | Description | |------|-------------| | `apis.ts` | Added `showOverview` and `emitterDisplayNames` optional fields to `CoverageFromAzureStorageOptions` | | `coverage-overview.tsx` | **New** β€” `CoverageOverview` component that aggregates coverage across all summaries and renders a responsive grid of per-emitter cards with color-coded percentages | | `coverage-utils.ts` | **New** β€” Extracted `getCompletedRatio` utility for reuse across components | | `dashboard.tsx` | Plumbed new props through; renders `CoverageOverview` when `showOverview` is enabled | | `dashboard-az-storage.tsx` | Pass new options from storage config to `Dashboard` | | `dashboard-table.tsx` | Accept `emitterDisplayNames`; use `displayName ?? report?.generatorMetadata?.name ?? language` fallback chain for column headers; removed inlined `getCompletedRatio` in favor of the shared utility | ### Display Name Resolution Column headers now follow this priority: 1. Explicit `emitterDisplayNames[packageName]` (if provided) 2. `report.generatorMetadata.name` (from coverage data) 3. Raw package name (fallback) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Handle enum value order changes using LastContractView (#9906) - [x] Move `BuildEnumValuesForBackCompatibility` to `TypeProvider` as `protected internal virtual` - [x] Remove `IsIntValueType` check β€” applies to all fixed enum types - [x] Perform single `Update` call at end of `ProcessTypeForBackCompatibility` - [x] Revert string init value change in test data - [x] Remove explicit initialization values β€” let compiler auto-assign based on order - [x] Remove code comment from `BuildEnumValuesForBackCompatibility` - [ ] Run `eng/scripts/Generate.ps1`
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > LastContractView - handle eunm value order changes > Generator should be able to mitigate the breaking changes of enum order change to avoid custom code > such as https://github.com/Azure/azure-sdk-for-net/pull/53793/files#diff-2cb7c6853530fb07e8cf57678ea6093784b9d342b63785ad34a5b478e2962b4b > > You are a .NET expert. Apply the fix for this but it should only be scoped to int enums. WRite proper unit tests exercising the scenario and also rerun `./eng/scripts/Generate.ps1` once you confirm all tests pass. > > ## Comments on the Issue (you are @copilot in this section) > > > @jorgerangel-msft > @live1206 - just to get clarity, in the example you linked the generated enum was > > ```csharp > public enum KeyVaultCreateMode > { > /// recover. > /// Recover. > Recover, > /// default. > /// Default. > Default, > } > ``` > > ? > @live1206 > @jorgerangel-msft Yes, the order of enum value changed from previous GA version. > >
- Fixes microsoft/typespec#9438 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Remove cache for Azure devops (#9918) Cache@2 has been unreliable and barely brings a performance gain so just removing it. * fix: update @typespec/compiler npm package description (#9903) The `@typespec/compiler` package description on npm was stale β€” still reading "TypeSpec Compiler Preview" despite TypeSpec being GA. - **`packages/compiler/package.json`**: Updated `description` from `"TypeSpec Compiler Preview"` to `"TypeSpec compiler and standard library"`
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Typespec compiler package description says preview > Image > > update this short description to a more meaningful and up to date of typespec > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9875 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Timothee Guerin * Migrate all libraries except compiler to tester v2 (#9913) * Fix: generate JsonPatch for @dynamicModel with ...Record + backcompat support (#9874) Dynamic models with `...Record` (BinaryData additional properties) were silently skipping `JsonPatch` generation because `SupportsBinaryDataAdditionalProperties` short-circuited `BuildJsonPatchField()`. The model would fall back to a plain `AdditionalProperties` property instead of the dynamic patch mechanism. ## Changes - **`BuildJsonPatchField()`**: Remove `SupportsBinaryDataAdditionalProperties` guard β€” all `@dynamicModel` types get `JsonPatch` regardless of additional property type - **`BuildProperties()`**: When `JsonPatchProperty` is set and `SupportsBinaryDataAdditionalProperties` is true, filter out `AdditionalProperties` (JsonPatch subsumes it for `unknown` AP) β€” unless backcompat is needed - **`IsAdditionalBinaryDataParameter()` helper**: Extracted to detect parameters backed by `_additionalBinaryDataProperties` either via field or property backing field - **`BuildConstructors()`**: Extended body-statement filtering to strip `_additionalBinaryDataProperties` assignments from both the full constructor and the init constructor when `JsonPatch` is being used - **`NeedsBackCompatAdditionalProperties`**: New lazy property that checks if the previous contract (`LastContractView`) had an `AdditionalProperties` property. When true, both `JsonPatch` and `AdditionalProperties` are generated together to maintain backward compatibility - **`UpdateFullConstructorParameters()`**: Simplified β€” `patch` parameter addition is factored out of the inner backcompat condition and always appended after the AdditionalBinaryData parameter check. In backcompat mode the old `additionalProperties` parameter is kept; in all cases `patch` is added after it. ## Result A `@dynamicModel` with `...Record` now generates `JsonPatch` only (no `AdditionalProperties`): ```csharp [Experimental("SCME0001")] private JsonPatch _patch; public DynamicModel(string name) { Name = name; } internal DynamicModel(string name, in JsonPatch patch) { Name = name; _patch = patch; } [JsonIgnore, EditorBrowsable(EditorBrowsableState.Never), Experimental("SCME0001")] public ref JsonPatch Patch => ref _patch; ``` When the model was **previously shipped with `AdditionalProperties`** (backcompat), both are generated: ```csharp [Experimental("SCME0001")] private JsonPatch _patch; private protected readonly IDictionary _additionalBinaryDataProperties; public DynamicModel(string name) { Name = name; _additionalBinaryDataProperties = new ChangeTrackingDictionary<...>(); } internal DynamicModel(string name, IDictionary additionalProperties, in JsonPatch patch) { Name = name; _additionalBinaryDataProperties = additionalProperties; _patch = patch; } public ref JsonPatch Patch => ref _patch; public IDictionary AdditionalProperties => _additionalBinaryDataProperties; ``` The serialization code for the backcompat case correctly: - **Writes** both `AdditionalProperties` (iterated as BinaryData) and `Patch.WriteTo()` in `JsonModelWriteCore` - **Deserializes** by initializing both `IDictionary additionalProperties` and `JsonPatch patch`, then constructing `new DynamicModel(p1, additionalProperties, patch)` Typed additional properties (`...Record`, union types) are unaffected.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Need to handle models with both dynamicModel and AdditionalProperties > We currently don't generate the JsonPatch property for a dynamic model that also has additional unknown properties. e.g. > > ``` > @dynamicModel > model DynamicModel { > name: string; > optionalUnknown?: unknown; > optionalInt?: int32; > foo: AnotherDynamicModel; > listFoo: AnotherDynamicModel[]; > listOfListFoo: AnotherDynamicModel[][]; > dictionaryFoo: Record; > dictionaryOfDictionaryFoo: Record>; > dictionaryListFoo: Record; > listOfDictionaryFoo: Record[]; > ...Record; > } > ``` > > We can skip generating AdditionalProperties for such cases, but we will likely need backcompat support in case a model was already shipped with AdditionalProperties. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9526 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> * Fix http-server-csharp crash on interfaces with template operations (#9894) - [x] Understand root cause: `interfaceDeclarationOperations` in `service.ts` doesn't filter template operations, causing `TemplateParameter` types to be passed to `emitType` - [x] Add `isTemplateDeclaration(operation)` guard in `interfaceDeclarationOperations` loop - [x] Add `TemplateParameter` guard in `#resolveOperationResponse` as a safety net (with comment) - [x] Add regression test: verifies template operations are skipped and non-template operations work - [x] Add changeset entry (updated description per review feedback) - [x] Merged latest changes from main
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: Unable to emit @typespec/http-server-csharp using azure-rest-api-specs typespec > ### Describe the bug > > Considering the [PR](https://github.com/Azure/azure-rest-api-specs/pull/37169) and branch [containerregistry-conversion](https://github.com/kazrael2119/azure-rest-api-specs/tree/containerregistry-conversion), I run into issues when trying to compile typespec with emit option "@typespec/http-server-csharp". > > Log: > ```txt > > tsp compile specs/containerregistry/main.tsp > > TypeSpec compiler v1.4.0 > > βœ” Compiling > βœ” @azure-tools/typespec-autorest 819ms specs/containerregistry/ > Γ— Running @typespec/http-server-csharp... > Emitter "@typespec/http-server-csharp" crashed! This is a bug. > Please file an issue at https://github.com/microsoft/typespec/issues > > Error: Encountered type TemplateParameter which we don't know how to emit. > at compilerAssert (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/compiler/dist/src/core/diagnostics.js:150:11) > at typeEmitterKey (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:618:17) > at Object.emitType (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:238:25) > at #resolveOperationResponse (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/http-server-csharp/dist/src/lib/service.js:744:26) > at CSharpCodeEmitter.interfaceDeclarationOperations (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/http-server-csharp/dist/src/lib/service.js:586:77) > at file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:376:55 > at withTypeContext (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:519:9) > at invokeTypeEmitter (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:366:9) > at Object.emitInterfaceOperations (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/asset-emitter/dist/src/asset-emitter.js:327:20) > at CSharpCodeEmitter.interfaceDeclaration (file:///C:/work/acr/dev/src/ACR.RP/ACR.RP.Web.Spec/node_modules/@typespec/http-server-csharp/dist/src/lib/service.js:542:22) > > -------------------------------------------------- > Library Version 0.58.0-alpha.20 > TypeSpec Compiler Version 1.4.0 > -------------------------------------------------- > ``` > > My configuration looks as follows: > > ``` > emit: > - "@azure-tools/typespec-autorest" > - "@typespec/http-server-csharp" > options: > ... > "@typespec/http-server-csharp": > emitter-output-dir: "{project-root}/typespec/codegen" > output-type: "models" > collection-type: "enumerable" > ``` > > Surprised, considering that emitter "@azure-tools/typespec-autorest" works as expected, and also used the "@typespec/openapi3" to further verify, and it works as expected. But for some reason, the csharp generator runs into an issue. > > ### Reproduction > > The description is pretty straightforward. > I will go ahead and create a fork so you may clone and reproduce locally, and update the thread. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#8500 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Migrate compiler test to tester v2 (#9931) Use copilot to do the whole migration. Having this should improve copilot PRs in the future by removing old outdated pattern we shouldn't be using for new test * Migrate spec dashboard to css modules (#9916) To be consitent with all the UI code in this repo use css module instead of `@emotion/react` * fix(http-server-csharp): missing namespace imports in MergePatchUpdate-generated C# files (#9896) - [x] Investigate the bug: `#createEnumContext` doesn't set `file.meta["ResolvedNamespace"]`, causing `resolveReferenceFromScopes` to get `undefined` namespace for enums and fall back to unqualified name without adding the import - [x] Plan fix - [x] Add failing test case with enum property in `MergePatchUpdate` (verifies `using Microsoft.Contoso;` appears) - [x] Fix primary bug: Add `file.meta[this.#nsKey] = namespace` to `#createEnumContext` in `service.ts` - [x] Fix secondary bug: Remove `AddedScope` single-namespace limitation in `checkOrAddNamespaceToScope` in `interfaces.ts` - [x] Add comprehensive namespace import tests covering: - MergePatchUpdate with 2 enum properties from 2 different sub-namespaces (validates multi-import fix) - Regular model with enum from sub-namespace (validates fix for non-MergePatch case) - MergePatchUpdate with optional enum from different namespace - MergePatchUpdate with string-enum union property from different namespace - MergePatchUpdate with array of models from different namespace - [x] Add regression tests for AddedScope removal: - Model with base class in one sub-namespace AND property from another sub-namespace β†’ both `using` directives emitted - Model with two enum properties from the SAME namespace β†’ only one `using` emitted (deduplication) - [x] Merge latest from main branch (2 new commits: enum backward compat, spec-dashboard overview) - [x] All 98 tests pass - [x] Add changeset for `@typespec/http-server-csharp` - [x] Formatting and linting pass
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: Missing Namespace Imports in C# Code Generated from MergePatchUpdate through http-server-csharp > ### Describe the bug > > This problem seems to be happened when model T(in this case Product) consists only of enum and built-in types. > I'm not sure this happens in other cases. > > versions > @typespec/compiler version 1.3.0 > @typespec/http version 1.3.0 > @typespec/http-server-csharp version 0.58.0-alpha.19 > > main.tsp > ``` > import "@typespec/http"; > > using Http; > @service(#{ title: "Product Service" }) > namespace DemoService; > > model Product { > id: uint32; > name: string; > category: ProductCategory; > } > > enum ProductCategory { > Electronics, > Books, > Clothing, > Home > } > > @route("/products") > @tag("Products") > interface Products { > /** List products */ > @get list(): Product[]; > > /** Read products */ > @get read(@path id: string): Product; > > /** Create a product */ > @post create(@body body: Product): Product; > > /** Update a product */ > @patch update(@path id: string, @body body: MergePatchUpdate): Product; > > /** Delete a product */ > @delete delete(@path id: string): void; > } > ``` > > generated ProductMergePatchUpdate.cs > ``` > // Generated by @typespec/http-server-csharp > // > > using System; > using System.Text.Json; > using System.Text.Json.Serialization; > using TypeSpec.Helpers.JsonConverters; > using TypeSpec.Helpers; > > namespace TypeSpec.Http > { > > public partial class ProductMergePatchUpdate > { > public UInt32? Id { get; set; } > > public string Name { get; set; } > > [JsonConverter(typeof(JsonStringEnumConverter))] > public ProductCategory? Category { get; set; } // ProductCategory NOT BE RESOLVED WITHOUT A NAMESPACE IMPORT (using DemoService;) > > > } > } > > ``` > > ProductMergePatchUpdate.cs should be like this. > ``` > // Generated by @typespec/http-server-csharp > // > > using System; > using System.Text.Json; > using System.Text.Json.Serialization; > using TypeSpec.Helpers.JsonConverters; > using TypeSpec.Helpers; > using DemoService; // THIS SHOULD BE HERE AND THIS CODE WILL BE COMPILED SUCCESSFULY > > namespace TypeSpec.Http > { > > public partial class ProductMergePatchUpdate > { > public UInt32? Id { get; set; } > > public string Name { get; set; } > > [JsonConverter(typeof(JsonStringEnumConverter))] > public ProductCategory? Category { get; set; } > > > } > } > > ``` > > ### Reproduction > > main.tsp > ``` > import "@typespec/http"; > > using Http; > @service(#{ title: "Product Service" }) > namespace DemoService; > > model Product { > id: uint32; > name: string; > category: ProductCategory; > } > > enum ProductCategory { > Electronics, > Books, > Clothing, > Home > } > > @route("/products") > @tag("Products") > interface Products { > /** List products */ > @get list(): Product[]; > > /** Read products */ > @get read(@path id: string): Product; > > /** Create a product */ > @post create(@body body: Product): Product; > > /** Update a product */ > @patch update(@path id: string, @body body: MergePatchUpdate): Product; > > /** Delete a product */ > @delete delete(@path id: string): void; > } > > ``` > > generated ProductMergePatchUpdate.cs > ``` > // Generated by @typespec/http-server-csharp > // > > using System; > using System.Text.Json; > using System.Text.Json.Serialization; > using TypeSpec.Helpers.JsonConverters; > using TypeSpec.Helpers; > > namespace TypeSpec.Http > { > > public partial class ProductMergePatchUpdate > { > public UInt32? Id { get; set; } > > public string Name { get; set; } > > [JsonConverter(typeof(JsonStringEnumConverter))] > public ProductCategory? Category { get; set; } > > > } > } > > ``` > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#8374 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * fix(http-server-csharp): Emit correct ASP.NET Core result methods for non-200/204 status codes (#9895) - [x] Add `getControllerReturnStatement` helper function to `utils.ts` that maps HTTP status codes to appropriate ASP.NET Core result methods - [x] Update `interfaceOperationDeclaration` in `service.ts` to use the new helper instead of hardcoded `Ok`/`NoContent` - [x] Update `operationDeclaration` in `service.ts` to use the new helper instead of hardcoded `Ok`/`NoContent` - [x] Import new function in `service.ts` - [x] Add test cases for 202 Accepted (with/without body) and 201 Created status codes - [x] Run tests to verify changes (93 tests pass) - [x] Add changeset - [x] Merge latest from main and run `pnpm format`
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: C# emitter: non‑200/204 status codes (e.g., 202 Accepted) are ignored β€” controller always returns Ok(...) / NoContent() > ### Describe the bug > > When an operation in TypeSpec is annotated to return status codes other than 200 or 204 (e.g., 202 Accepted, 201 Created, 4xx/5xx), the generated ASP.NET Core controller method still returns Ok(result) (or NoContent() when the response type is void). This appears to be due to hardcoded logic in the emitter: > > // emitter snippet (as seen in generated code path) > const hasResponseValue = response.name !== "void"; > const resultString = `${status === 204 ? "NoContent" : "Ok"}`; > return this.emitter.result.declaration( > operation.name, > code` > ${doc ? `${formatComment(doc)}` : ""} > [${getOperationVerbDecorator(httpOperation)}] > [Route("${httpOperation.path}")] > ${this.emitter.emitOperationReturnType(operation)} > public virtual async Task ${operationName}(${declParams}) > { > ${ > hasResponseValue > ? `var result = await ${this.emitter.getContext().resourceName}Impl.${operationName}Async(${getBusinessLogicCallParameters(parameters)}); > return ${resultString}(result);` > : `await ${this.emitter.getContext().resourceName}Impl.${operationName}Async(${getBusinessLogicCallParameters(parameters)}); > return ${resultString}();` > } > }` > ); > Because resultString selects only Ok or NoContent, any other intended status code is effectively lost. > Impact > > 202 Accepted (typical for long‑running operations) becomes 200 OK. > 201 Created (resource creation) becomes 200 OK and no Location header is set. > Other outcome codes (e.g., 301/302, 400, 409, 500) are not represented correctly, undermining API semantics and client behavior. > > ### Reproduction > > https://github.com/microsoft/typespec/blob/main/packages/http-server-csharp/src/lib/service.ts > line 874 > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9187 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * Revert "Use apiview.org temporarily" (#9870) (#9921) Reverts the temporary URL change introduced in #9870, restoring the `$APIViewUri` default in `eng/emitters/scripts/Create-APIReview.ps1` back to `https://apiview.dev/autoreview`. After merging: https://github.com/Azure/azure-sdk-tools/pull/14341 - **`eng/emitters/scripts/Create-APIReview.ps1`**: Reverts `$APIViewUri` default from `https://apiview.org/autoreview` β†’ `https://apiview.dev/autoreview`
Original prompt > Create a pull request in `microsoft/typespec` that reverts the changes introduced by PR #9870 ("Use apiview.org temporarily"). > > Context: > - Target PR to revert: https://github.com/microsoft/typespec/pull/9870 > - Original author: JoshLove-msft > - PR state: merged > > Requirements: > 1. Identify the merge commit (or commits) that PR #9870 introduced to the default branch. > 2. Create a new branch for the revert. > 3. Revert the PR cleanly (use `git revert` of the merge commit where appropriate) so the repository returns to the state prior to PR #9870. > 4. Ensure all tests/CI checks that normally run for PRs pass. > 5. Open a PR titled like `Revert "Use apiview.org temporarily" (#9870)` with a clear description explaining why this is a revert and referencing PR #9870. > 6. If the revert causes conflicts, resolve them in a minimal, safe way and document what was done. > > Notes: > - Prefer reverting the merge commit that brought in PR #9870 to preserve history. > - Keep the revert focused strictly on undoing PR #9870 (avoid unrelated formatting or refactors).
*This pull request was created from Copilot chat.* > --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tjprescott <5723682+tjprescott@users.noreply.github.com> Co-authored-by: Travis Prescott * Fix `@overload` interface validation failing when the enclosing namespace is versioned (#9939) When `@overload` is used inside an interface within a `@versioned` namespace, the compiler incorrectly reports `overload-same-parent`. The versioning mutator clones the interface and its operations, then `finishType()` re-runs decorators on the clonesβ€”but decorator args still reference the original types. The cloned operation's `interface` points to the cloned interface while `overloadBase.interface` points to the original, so reference equality fails. ```tsp @versioned(Versions) @service(#{ title: "Widget Service" }) namespace DemoService; enum Versions { v1 } interface Widgets { op create(data: string | bytes, @header contentType: "text/plain" | "application/octet-stream"): void; @overload(Widgets.create) // ❌ overload-same-parent op createString(data: string, @header contentType: "text/plain"): void; } ``` ### Changes - **`packages/compiler/src/lib/decorators.ts`**: `areOperationsInSameContainer` now falls back to AST node identity comparison when reference equality fails. Cloned types preserve the same `node` from their source, so this correctly identifies two interface/namespace instances as originating from the same declaration. - **`packages/openapi3/test/overloads.test.ts`**: Added tests for overloads inside both interfaces and namespaces within versioned namespaces, with assertions on the emitted OpenAPI output. > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh pec/ tput-dir ../../w--llmstxt node ules/.bin/node import @typespecnode /home/REDACTED/wor/home/REDACTED/work/typespec/typespec/packages/http-specs/node_modules /.bin/node node tobu astro check --minimumFailingSeve--typekits node _modules/.bin/sh perimental gen-enode SE_fce680ab2cc46/home/REDACTED/work/typespec/typespec/packages/http-server-js/node_modules/.bin/..hint tobuf/reference node` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > `@overload` interface validation fails when the enclosing namespace is versioned > [Here is a sample](https://typespec.io/playground/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZcmVzdNUZdmVyc2lvbmluZyI7Cgp1c2luZyBWyRQ7CgpAxyJlZCjHGHMpCkBzZXJ2aWNlKCN7IHRpdGxlOiAiV2lkZ2V0IFPGGiIgfSkKbmFtZXNwYWNlIERlbW%2FHGjsKCmVudW3IZnMgewogIHYxLAp96ACASHR0cDvHDFJlc3Q7Cgptb2RlbCDHY8QxQGtleSBpZDogc3Ry5QCpICB3ZWlnaHQ6IGludDMyxBFjb2xvcjogInJlZCIgfCAiYmx1ZSLEGeQAmMo6fQoKQGVycm9yx2ZFxAzFZWNvZGXLUG1lc3NhZ846aW50ZXJm5ADj5gCd5wDlxT9Ac2hhcmVkUm91dGXED3B1dMRVcmVhdGXGLiguLi7GCik6x0HEaUBvdmVybG9hZCjNVS7MOynfYcYmMtVifQo%3D&e=%40typespec%2Fopenapi3&options=%7B%7D&vs=%7B%7D) > > Note that this appears to be the same issue resolved by this (only now versioning uses mutators): https://github.com/microsoft/typespec/pull/1760 > > Create a test validating the correct behavior in a versioned namespace, validate that it fails without a fix, then create a fix that makes the test pass. The referenced fix, which examines the source property of both operations (if it exists) is likely a good way to proceed. Verify that all tests pass, that there are no misspellings (pnpm cspell) and that no files are incorrectly formatted (pnpm format) > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9937 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> * [python] remove reserved word padding for enum values (#9898) Enum values are generated in UPPER_CASE, so reserved word padding is unnecessary. Removes `PadType.ENUM_VALUE` and its associated logic. - **`python_mappings.py`**: Remove `ENUM_VALUE` variant from `PadType` enum and its entry in `RESERVED_WORDS` - **`preprocess/__init__.py`**: Drop `update_enum_value` import; replace padding logic with direct `str.upper()` (retaining `ENUM_` prefix for digit-leading names) - **`test_name_converter.py`**: Remove `ENUM_VALUE` test cases that referenced the deleted variant (CI fix) --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * [http-client-python] Add XML deserialization tests for EnumerationResults payload (#9778) - [x] Add `test_enumeration_results` β€” original flat-list payload test - [x] Add `test_enumeration_results_nested_empty_list` β€” nested model with `itemsName`-wrapped empty list - [x] Add `test_enumeration_results_azure_sdk_pattern` β€” Azure SDK model pattern with two unwrapped list fields - [x] Add `test_enumeration_results_blobs_unwrapped` β€” documents `unwrapped=True` behavior on model-typed field - [x] Fix pylint `too-many-instance-attributes` on `_RestField` β€” move the disable annotation outside the `has_padded_model_property` conditional so it is always emitted (11 attributes now unconditionally) - [x] All 35 tests pass
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [http-client-python] model base deserialization > Can we add a new test for deserializing the following xml payload: > > > `/` > > to the http-client-python package > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9777 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com> Co-authored-by: Yuchao Yan Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * eng, http-client-java, update instruction (#9930) update agent instruction * mgmt, use separate entry points for premium samples (#9845) - emitter part for https://github.com/Azure/azure-sdk-for-java/issues/47621 - autorest PR: https://github.com/Azure/autorest.java/pull/3298 - sdk repo PR: https://github.com/Azure/azure-sdk-for-java/pull/48226 - sync SDK PR looks good: https://github.com/Azure/azure-sdk-for-java/pull/48179 ## Summary Replace `AzureResourceManager` with SDK-specific `XXManager` as the entry point in Fluent Premium samples. Previously, premium samples were generated with `AzureResourceManager` as the entry type and then moved to `sdk/resourcemanager/azure-resourcemanager/samples` by the downstream `generate.py` script. This change makes premium samples use the corresponding `XXManager` (e.g., `ComputeManager`, `StorageManager`) directly, so samples can stay in their own SDK location. ### Before vs After ```java // Before: premium sample used AzureResourceManager void sampleMethod(com.azure.resourcemanager.AzureResourceManager azure) { azure.storageAccounts().manager().serviceClient().getStorageAccounts().list(); } // After: premium sample uses SDK-specific manager void sampleMethod(com.azure.resourcemanager.storage.StorageManager manager) { manager.serviceClient().getStorageAccounts().list(); } ``` Will update `generate.py` when this got shipped. * Add Python mock API tests for authentication/noauth/union Spector case (#9943) Adds sync and async Python SDK tests for the `authentication/noauth/union` Spector scenario, which validates clients generated with `NoAuth | OAuth2Auth` union authentication. - **Sync tests** in `generic_mock_api_tests/test_authentication.py`: - `test_noauth_union_valid_no_auth` β€” unauthenticated request - `test_noauth_union_valid_token` β€” OAuth2 ****** request - **Async tests** in `generic_mock_api_tests/asynctests/test_authentication_async.py`: async counterparts of the above Tests are placed in `generic_mock_api_tests` since both azure and unbranded flavors share the same import path (`authentication.noauth.union.UnionClient`). --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * feat(http-client-java): support DurationKnownEncoding.milliseconds (#9926) - [x] TypeScript: Add `milliseconds-integer` and `milliseconds-number` to `DurationSchema` format type in `time.ts` - [x] TypeScript: Update `DURATION_KNOWN_ENCODING` and `getDurationFormat` in `type-utils.ts` to handle `milliseconds` encoding - [x] Java: Add `MILLISECONDS_INTEGER` and `MILLISECONDS_NUMBER` to `DurationSchema.Format` enum - [x] Java: Add `DURATION_MILLISECONDS_LONG` and `DURATION_MILLISECONDS_DOUBLE` to `ClassType` - [x] Java: Add `DURATION_MILLISECONDS_LONG` and `DURATION_MILLISECONDS_DOUBLE` to `PrimitiveType` - [x] Java: Update `PrimitiveMapper` to map new formats to new types - [x] Java: Update `WireTypeClientTypeConverter` with milliseconds conversion logic - [x] Java: Update `ClassType.getClientType()` and `PrimitiveType.getClientType()` for new types - [x] Java: Update `ModelTestCaseUtil` to handle new types - [x] Java: Update `ProxyMethodMapper` and `ClientCoreProxyMethodMapper` RETURN_VALUE_WIRE_TYPE_OPTIONS - [x] Regenerate test files using `Generate.ps1` - [x] Update test files `EncodeDurationTests.java` to cover milliseconds scenarios; only disable `floatMilliseconds`/`float64Milliseconds`/`floatMillisecondsLargerUnit` for query/header (they produce `35625.0` instead of `35625`) - [x] Build and unit tests passing - [x] Add changeset
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > http-client-java, support DurationKnownEncoding.milliseconds > ### Clear and concise description of the problem > > In packages/http-client-java > > Support `DurationKnownEncoding.milliseconds` > > Test scenario is at https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/encode/duration/main.tsp#L240-L251 > > Check existing Java code of DURATION_LONG and DURATION_DOUBLE. On Java, we can call it DURATION_MILLISECONDS_LONG and DURATION_MILLISECONDS_DOUBLE > > Typescript code would be around DURATION_KNOWN_ENCODING and related code. > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Read the [docs](https://typespec.io/docs/). > - [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9925 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: Weidong Xu * Add spector case for extensible enum with special word member names (#9785) - [x] Add extensible enum (union) with 33 special word member names to `special-words/main.tsp` - [x] Simplify to single `@put` operation per reviewer feedback - [x] Add `ExtensibleString` return type so mock API echoes back the sent value - [x] Simplify return type to `putExtensibleStringValue(@body body: ExtensibleString): ExtensibleString;` - [x] Add handler to dynamically extract request body and echo it back in response - [x] Remove explicit contentType headers (default application/json is sufficient) - [x] Remove redundant `@doc` decorators from union definition for consistency with rest of file - [x] Rename `union Enum` to `union ExtensibleString` to avoid blocking actual enum tests - [x] Rename interface `Enums` to `ExtensibleStrings`, route `/enums` to `/extensible-strings`, and operation `putEnumValue` to `putExtensibleStringValue` - [x] Regenerate spec-summary - [x] Add chronus changeset for @typespec/http-specs - [x] Build validated (61 scenarios pass) - [x] Format, code review, and security scan clean --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * [python] Add test cases for flatten-property read-only and unknown model scenarios (#9949) Adds Python SDK mock API tests for the Spector scenarios introduced/fixed in [Azure/typespec-azure#4006](https://github.com/Azure/typespec-azure/pull/4006), which corrected the `flattenReadOnlyModel` response shape so read-only properties are returned wrapped in a `properties` object rather than flattened to the parent level. ## Changes - **Dependency bump**: `@azure-tools/azure-http-specs` `0.1.0-alpha.38-dev.2` β†’ `0.1.0-alpha.38-dev.6` to pick up the new/updated Spector scenarios - **New sync + async tests** in `test_azure_client_generator_core_flatten[_async].py`: - `test_put_flatten_unknown_model` β€” verifies `properties` is **not** flattened for `unknown` (non-model) types - `test_put_flatten_read_only_model` β€” verifies the response returns read-only properties wrapped under `properties`: ```python def test_put_flatten_read_only_model(client: FlattenPropertyClient): result = client.put_flatten_read_only_model(Solution(name="foo")) assert result == Solution( name="foo", properties=SolutionProperties(solution_id="solution1", title="Solution Title", content="Solution Content"), ) ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [python] add test case for https://github.com/Azure/typespec-azure/pull/4006 > > follow skill https://github.com/microsoft/typespec/blob/main/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md to write test case for https://github.com/Azure/typespec-azure/pull/4006 > > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9948 --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan * fix: generate parameterized accessor for subclients with subclient-specific parameters (#9919) - [x] Fix `ClientProvider.cs`: `HasAccessorOnlyParameters()` detects subclient-specific params; `BuildFields()` skips caching field; `BuildMethods()` generates parameterized accessor - [x] Add unit tests for Parent-only subclients with accessor-only parameters - [x] Add `MetricsClientParams` to `SampleService/main.tsp`; regenerate `Sample-TypeSpec` - [x] Revert Spector azure test project changes - [x] Run prettier on `SampleService/main.tsp` - [x] Run `Generate.ps1` and check in regenerated files
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Subclient parameters need to be included in accessors > For subclients that can be created individually or from the parent, the subclient parameters are not included in the subclient accessors currently. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9775 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: make XmlWriteCore internal (#9942) * Fix route query string parsed as path segment in C# emitter (#9959) When a route contains a query string (e.g., `@route("?comp=copy")`), `AddUriSegments` treated the entire literal as a path segment, generating `uri.AppendPath("?comp=copy", false)` instead of `uri.AppendQuery("comp", "copy", true)`. This produces malformed URIs like `?comp=copy?copyid=...`. ### Changes - **`RestClientProvider.cs`**: Extract `AppendLiteralSegment` helper that splits literal segments at `?`, emitting `AppendPath` for the path portion and `AppendQuery` for each `key=value` pair in the query portion. Both call sites in `AddUriSegments` now use this helper. - **`RestClientProviderTests.cs`**: Add tests covering multiple scenarios: - `TestBuildCreateRequestMethodWithQueryInPath` β€” route with `?comp=copy` and an additional query parameter. - `TestBuildCreateRequestMethodWithSlashQueryInPath` β€” route starting with `/?comp=copy` (slash before query). - `TestBuildCreateRequestMethodWithMixedPathAndQueryInPath` β€” route with both path segments, path parameters, multiple inline query params, and an additional query parameter (`/items/{p1}?comp=copy&restype=container`). **Before:** ```csharp uri.AppendPath("?comp=copy", false); uri.AppendQuery("copyid", copyId, true); // β†’ ?comp=copy?copyid=... ``` **After:** ```csharp uri.AppendQuery("comp", "copy", true); uri.AppendQuery("copyid", copyId, true); // β†’ ?comp=copy©id=... ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > CreateRequest Method Should Call uri.AppendQuery if Path uri starts with "?" Query Separator > Consider this operation: > > ``` > @put > @sharedRoute > @route("?comp=copy") > abortCopyFromUrl is StorageOperationNoBody< > { > ...TimeoutParameter; > > /** The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. */ > @clientName("copyId") > @query > copyid: string; > > ...LeaseIdOptionalParameter; > > /** The copy action to be performed. */ > @header("x-ms-copy-action") > copyActionAbortConstant: "abort"; > }, > { > @statusCode statusCode: 204; > } > >; > > ``` > > The route contains a query string and the request body accepts a query. This results in the generated CreateRequest method for this operation to use > ```csharp > uri.AppendPath("?comp=copy", false); > uri.AppendQuery("copyid", copyId, true); > ``` > > instead of calling `AppendQuery` > > ```csharp > uri.AppendQuery("comp", "copy", true); > uri.AppendQuery("copyid", copyId, true); > ``` > > Which is leading to a possibly malformed uri `?comp=copy?copyid=6808d511-671f-47f0-b909-abe739c65139>`. > We should correctly parse the route and call the correct UriBuilder APIs for each component of the string. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9958 --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * Fix float comparison in duration encode mockapi for query and header params (#9945) Float-typed duration values transmitted as query/header params were compared as strings, causing valid representations like `"35625.0"` to fail against expected `"35625"` even though they're numerically equal. ## Changes - **New `createQueryFloatServerTests` helper**: Uses `parseFloat()` for numeric comparison instead of string equality for float query param scenarios - **New `createHeaderFloatServerTests` helper**: Same numeric comparison approach for float header scenarios - **Updated 8 scenarios** to use the new float helpers β€” the ones where whole-number float values create representation ambiguity: - `floatMilliseconds` / `float64Milliseconds` (35625) - `floatSecondsLargerUnit` (150) - `floatMillisecondsLargerUnit` (210000) Non-float scenarios (int32, iso8601) and non-ambiguous floats like `35.625` are unchanged β€” their string comparison remains appropriate.
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [Bug]: mockapi in e2e test, logic to compare float is not correct > ### Describe the bug > > mockapi in test https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/encode/duration/mockapi.ts > > On test of duration as float, in query param and header param, it compares with e.g. `35625`, which fails other same float value of `35625.0` etc. > > Please fix these mockapi, to make it compare the float number (not its string representation). > > ### Reproduction > > run test with e.g. `35625.0` as input > > ### Checklist > > - [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md) > - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. > - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions). > - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9944 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> * http-client-java, use lib to convert plural to singular (#9963) For https://github.com/Azure/azure-sdk-for-java/pull/48323#issuecomment-4020696428 The only service affected, in SDK, is sdk/neonpostgres https://github.com/Azure/azure-sdk-for-java/pull/48334 The change is from `branche` to `branch`, which is correct. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove includeRootSlash client option logic from http-client-python (#9964) The `@clientOption("includeRootSlash")` decorator was a workaround in the Python emitter to control stripping the leading slash from operation paths. This is a TypeSpec core concern and should not be solved via a custom decorator. - Removed `getClientOptions` import (only consumer) - Removed the client hierarchy walk that resolved the `includeRootSlash` option - Simplified URL to use `operation.path` directly instead of conditionally stripping the leading slash --- πŸ’‘ 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Co-authored-by: Chenjie Shi * fix: set git user and email in Submit-AzureSdkForNetPr.ps1 (#9960) Configure git user.name and user.email on the freshly initialized repo so commits succeed in CI environments without a global git identity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Do not join `?` and `:` with `/` (#9935) fix #9936 * Fix running multiple versioning mutators (#9932) fix #9927 * Add e2e tests for azure.resourcemanager.methodsubscriptionid.operations and nonresource.nonresourceoperations.create (#9977) Adds missing e2e test coverage for two ARM Spector scenarios in the http-client-java test suite. ## Changes - **`MethodSubscriptionIdTest.java`** β€” adds `testOperationsList()` to cover the `azure.resourcemanager.methodsubscriptionid.operations` scenario: calls `manager.operations().list()` and asserts the returned operation name, `isDataAction`, and display fields against the expected Spector mock response. - **`NonResourceTests.java`** β€” adds `testNonResourceCreate()` to cover the `azure.resourcemanager.nonresource.nonresourceoperations.create` scenario: uses the low-level fluent client (`manager.serviceClient().getNonResourceOperations().create(...)`) directly, since the high-level model mistakenly treats `NonResource` as an ARM resource (same reason the existing `testNonResourcePut()` is `@Disabled`). ```java // NonResource create β€” goes via low-level client to bypass incorrect resource treatment NonResourceInner body = new NonResourceInner().withId("id").withName("hello").withType("nonResource"); NonResourceInner result = manager.serviceClient().getNonResourceOperations().create("eastus", "hello", body); Assertions.assertEquals("id", result.id()); Assertions.assertEquals("hello", result.name()); Assertions.assertEquals("nonResource", result.type()); ``` --- πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> * Initialize non-nullable required unwrapped XML list properties to empty collections during deserialization (#9968) When a service returns an empty XML wrapper element (e.g., ``), unwrapped list properties deserialize to `null` because the list is only initialized inside the foreach loop upon matching a child element. For required, non-nullable properties this should yield an empty list. ### Changes - **`MrwSerializationTypeDefinition.cs`**: In `GetPropertyVariableDeclarations()`, added `IsXmlUnwrappedRequiredCollection` helper that initializes unwrapped, required, non-nullable collection properties with `new List()` at variable declaration time instead of `default` - **`MrwSerializationTypeDefinition.Xml.cs`**: In `CreateXmlDeserializeListAssignment()`, added `isPreInitialized` parameter to skip the redundant `if (list == null)` null-check when the list is already initialized at declaration time - **`XmlDeserializationTests.cs`**: Added `XmlDeserializationMethodHandlesOptionalUnwrappedListProperty` test using `FilteredMethodsTypeProvider` to verify optional properties retain the null-check and are not affected - **Test data / regenerated code**: Updated expected output and regenerated `XmlAdvancedModel.Serialization.cs` ### Generated output ```csharp // Variable initialized at declaration instead of default IList colors = new List(); IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); foreach (var child in element.Elements()) { string localName = child.Name.LocalName; if (localName == "colors") { // No null check needed β€” colors is already initialized colors.Add((string)child); continue; } } return new TestXmlModel(colors, additionalBinaryDataProperties); ```
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > Always Initialize Non-Optional Unwrapped Items in XML Deserialization > Consider this tsp: > > ``` > @Xml.name("EnumerationResults") > model ListBlobsResponse { > /** The service endpoint. */ > @Xml.attribute > @Xml.name("ServiceEndpoint") > serviceEndpoint: string; > > /** The container name. */ > @Xml.attribute > @Xml.name("ContainerName") > containerName: string; > > /** The prefix of the blobs. */ > @Xml.name("Prefix") prefix?: string; > > /** The marker of the blobs. */ > @Xml.name("Marker") marker?: string; > > /** The max results of the blobs. */ > @Xml.name("MaxResults") maxResults?: int32; > > /** The blob segment. */ > @Xml.name("Blobs") > segment: BlobFlatListSegment; > > /** The next marker of the blobs. */ > @continuationToken > @Xml.name("NextMarker") > nextMarker?: string; > } > > /** The blob flat list segment. */ > model BlobFlatListSegment { > /** The blob items. */ > @pageItems > @Xml.name("Blob") > @Xml.unwrapped > blobItems: BlobItem[]; > } > > ``` > > The service can returns `` and the current XML deserialization code will deserialize segment into `null` since there are no Blob elements in `Blobs`. Since blobItems is unwrapped and non-nullable, we should be initializing it to an empty list by default. > > We should update the xml deserialization to initialize collection properties to an empty collection when they are non-nullable, required, and unwrapped. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9967 --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> * [http-client-csharp] Render field attributes on enum members in TypeProviderWriter.WriteEnumContent (#9947) - [x] Add attribute rendering for enum fields in `TypeProviderWriter.WriteEnumContent()` - [x] Add test to validate enum field attributes are written correctly - [x] Add test data file for the new test - [x] Run tests to validate changes (all 4 TypeProviderWriter tests pass) - [x] Revert unrelated formatting/header changes from `dotnet format` - [x] Run code review and security scanning
Original prompt > > ---- > > *This section details on the original issue you should resolve* > > [http-client-csharp] TypeProviderWriter.WriteEnumContent does not render field attributes on enum members > ## Bug Description > > `TypeProviderWriter.WriteEnumContent()` iterates over `_provider.Fields` to write enum members, but it only writes `XmlDocs`, `Name`, and `InitializationValue`. It **never writes `field.Attributes`**, even though `FieldProvider` supports them and `WriteField()` (used for class/struct fields) does render attributes. > > This means any attributes added to enum fields via `BuildFields()` in a custom `EnumProvider` are silently dropped during code generation. > > ## Reproduction > > 1. Create a custom `EnumProvider` that overrides `BuildFields()` and adds attributes to enum field providers (e.g., `[DataMember(Name = "...")]`). > 2. Run code generation. > 3. The generated `.cs` file will **not** contain the attributes on enum members. > > ## Root Cause > > In [`TypeProviderWriter.cs` line 112-132](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/TypeProviderWriter.cs#L112-L132): > > ```csharp > private void WriteEnumContent(CodeWriter writer) > { > using (writer.Scope()) > { > for (int i = 0; i < _provider.Fields.Count; i++) > { > writer.WriteXmlDocsNoScope(_provider.Fields[i].XmlDocs); > // Missing: field.Attributes are never written here > writer.Append($"{_provider.Fields[i].Name}"); > ... > } > } > } > ``` > > Compare with [`WriteField()` in `CodeWriter.cs`](https://github.com/microsoft/typespec/blob/main/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Writers/CodeWriter.cs#L482-L492) which does render attributes: > > ```csharp > public CodeWriter WriteField(FieldProvider field) > { > WriteXmlDocsNoScope(field.XmlDocs); > if (field.Attributes.Count > 0) > { > foreach (var attr in field.Attributes) > { > attr.Write(this); > } > } > ... > } > ``` > > ## Suggested Fix > > Add attribute rendering in `WriteEnumContent` before writing the field name: > > ```csharp > writer.WriteXmlDocsNoScope(_provider.Fields[i].XmlDocs); > foreach (var attr in _provider.Fields[i].Attributes) > { > attr.Write(writer); > } > writer.Append($"{_provider.Fields[i].Name}"); > ``` > > ## Impact > > This blocks downstream generators (e.g., Azure Provisioning generator) from adding `[DataMember(Name = "...")]` or other custom attributes to enum members for serialization purposes. > > ## Comments on the Issue (you are @copilot in this section) > > > >
- Fixes microsoft/typespec#9946 --- πŸ”’ GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com> Co-authored-by: Dapeng Zhang * Bump version for 1.10 release (#9981) * Fix response type of putExtensibleStringValue in special-words spec (#9987) moved from https://github.com/microsoft/typespec/pull/9953 Follow-up to #9785: the `putExtensibleStringValue` operation was missing an explicit response content-type header, inconsistent with the pattern used by other extensible enum endpoints. - Updated return type in `packages/http-specs/specs/special-words/main.tsp`: ```typespec putExtensibleStringValue(@body body: ExtensibleString): { @header contentType: "application/json"; @body body: ExtensibleString; }; ``` > [!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: > > - `telemetry.astro.build` > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh s/.b ../../website/sr--llmstxt sh _modules/pnpm/dist/node-gyp-bin/node --no-emit git _modules/pnpm/digenerate-scenarios-summary node tobu build.json sh /.bin/sh ld.json && pnpm node pnpm tobuf/reference node` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent) (admins only) > >
--- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Initial * Add agentic workflow issue-triage * Format --------- Signed-off-by: dependabot[bot] Signed-off-by: Vincent Biret Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: JonathanCrd <17486462+JonathanCrd@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: jolov Co-authored-by: Fiona Huang (Thompson) Co-authored-by: Jorge Rangel <102122018+jorgerangel-msft@users.noreply.github.com> Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Co-authored-by: iscai-msft Co-authored-by: Radhika Gupta Co-authored-by: Yuchao Yan Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com> Co-authored-by: Vincent Biret Co-authored-by: Jonathan CΓ‘rdenas Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Weidong Xu Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Linh Phan Co-authored-by: Linh Phan Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> Co-authored-by: Dapeng Zhang Co-authored-by: Steffen Co-authored-by: Will Temple Co-authored-by: ArthurMa1978 <20514459+ArthurMa1978@users.noreply.github.com> Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com> Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com> Co-authored-by: live1206 <5196139+live1206@users.noreply.github.com> Co-authored-by: Wei Hu Co-authored-by: Jorge Rangel Co-authored-by: KarishmaGhiya Co-authored-by: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 Co-authored-by: Gabriel Castilho Mazzeu Co-authored-by: Sameeksha Vaity Co-authored-by: Rodge Fu Co-authored-by: Gerardo Lecaros <10088504+glecaros@users.noreply.github.com> Co-authored-by: markcowl <1031227+markcowl@users.noreply.github.com> Co-authored-by: Jose Manuel Heredia Hidalgo Co-authored-by: tjprescott <5723682+tjprescott@users.noreply.github.com> Co-authored-by: Travis Prescott Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com> Co-authored-by: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Co-authored-by: Chenjie Shi --- .gitattributes | 2 + .github/agents/agentic-workflows.agent.md | 167 +++ .github/workflows/copilot-setup-steps.yml | 26 + .github/workflows/issue-triage.lock.yml | 1145 +++++++++++++++++++++ .github/workflows/issue-triage.md | 87 ++ .prettierignore | 3 + .vscode/mcp.json | 9 + cspell.yaml | 1 + 8 files changed, 1440 insertions(+) create mode 100644 .github/agents/agentic-workflows.agent.md create mode 100644 .github/workflows/copilot-setup-steps.yml create mode 100644 .github/workflows/issue-triage.lock.yml create mode 100644 .github/workflows/issue-triage.md create mode 100644 .vscode/mcp.json diff --git a/.gitattributes b/.gitattributes index cbbda5dcb0f..5c08e2e9950 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,3 +17,5 @@ docs/spec.html merge=binary linguist-generated=true # Allow comments in JSON in GitHub rendering *.json linguist-language=JSON-with-Comments + +.github/workflows/*.lock.yml linguist-generated=true merge=ours \ No newline at end of file diff --git a/.github/agents/agentic-workflows.agent.md b/.github/agents/agentic-workflows.agent.md new file mode 100644 index 00000000000..155eaa2a312 --- /dev/null +++ b/.github/agents/agentic-workflows.agent.md @@ -0,0 +1,167 @@ +--- +description: GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing +disable-model-invocation: true +--- + +# GitHub Agentic Workflows Agent + +This agent helps you work with **GitHub Agentic Workflows (gh-aw)**, a CLI extension for creating AI-powered workflows in natural language using markdown files. + +## What This Agent Does + +This is a **dispatcher agent** that routes your request to the appropriate specialized prompt based on your task: + +- **Creating new workflows**: Routes to `create` prompt +- **Updating existing workflows**: Routes to `update` prompt +- **Debugging workflows**: Routes to `debug` prompt +- **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt +- **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt +- **Fixing Dependabot PRs**: Routes to `dependabot` prompt β€” use this when Dependabot opens PRs that modify generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`). Never merge those PRs directly; instead update the source `.md` files and rerun `gh aw compile --dependabot` to bundle all fixes + +Workflows may optionally include: + +- **Project tracking / monitoring** (GitHub Projects updates, status reporting) +- **Orchestration / coordination** (one workflow assigning agents or dispatching and coordinating other workflows) + +## Files This Applies To + +- Workflow files: `.github/workflows/*.md` and `.github/workflows/**/*.md` +- Workflow lock files: `.github/workflows/*.lock.yml` +- Shared components: `.github/workflows/shared/*.md` +- Configuration: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/github-agentic-workflows.md + +## Problems This Solves + +- **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions +- **Workflow Debugging**: Analyze logs, identify missing tools, investigate failures, and fix configuration issues +- **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes +- **Component Design**: Create reusable shared workflow components that wrap MCP servers + +## How to Use + +When you interact with this agent, it will: + +1. **Understand your intent** - Determine what kind of task you're trying to accomplish +2. **Route to the right prompt** - Load the specialized prompt file for your task +3. **Execute the task** - Follow the detailed instructions in the loaded prompt + +## Available Prompts + +### Create New Workflow + +**Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/create-agentic-workflow.md + +**Use cases**: + +- "Create a workflow that triages issues" +- "I need a workflow to label pull requests" +- "Design a weekly research automation" + +### Update Existing Workflow + +**Load when**: User wants to modify, improve, or refactor an existing workflow + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/update-agentic-workflow.md + +**Use cases**: + +- "Add web-fetch tool to the issue-classifier workflow" +- "Update the PR reviewer to use discussions instead of issues" +- "Improve the prompt for the weekly-research workflow" + +### Debug Workflow + +**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/debug-agentic-workflow.md + +**Use cases**: + +- "Why is this workflow failing?" +- "Analyze the logs for workflow X" +- "Investigate missing tool calls in run #12345" + +### Upgrade Agentic Workflows + +**Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/upgrade-agentic-workflows.md + +**Use cases**: + +- "Upgrade all workflows to the latest version" +- "Fix deprecated fields in workflows" +- "Apply breaking changes from the new release" + +### Create Shared Agentic Workflow + +**Load when**: User wants to create a reusable workflow component or wrap an MCP server + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/create-shared-agentic-workflow.md + +**Use cases**: + +- "Create a shared component for Notion integration" +- "Wrap the Slack MCP server as a reusable component" +- "Design a shared workflow for database queries" + +### Fix Dependabot PRs + +**Load when**: User needs to close or fix open Dependabot PRs that update dependencies in generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`) + +**Prompt file**: https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/dependabot.md + +**Use cases**: + +- "Fix the open Dependabot PRs for npm dependencies" +- "Bundle and close the Dependabot PRs for workflow dependencies" +- "Update @playwright/test to fix the Dependabot PR" + +## Instructions + +When a user interacts with you: + +1. **Identify the task type** from the user's request +2. **Load the appropriate prompt** from the GitHub repository URLs listed above +3. **Follow the loaded prompt's instructions** exactly +4. **If uncertain**, ask clarifying questions to determine the right prompt + +## Quick Reference + +```bash +# Initialize repository for agentic workflows +gh aw init + +# Generate the lock file for a workflow +gh aw compile [workflow-name] + +# Debug workflow runs +gh aw logs [workflow-name] +gh aw audit + +# Upgrade workflows +gh aw fix --write +gh aw compile --validate +``` + +## Key Features of gh-aw + +- **Natural Language Workflows**: Write workflows in markdown with YAML frontmatter +- **AI Engine Support**: Copilot, Claude, Codex, or custom engines +- **MCP Server Integration**: Connect to Model Context Protocol servers for tools +- **Safe Outputs**: Structured communication between AI and GitHub API +- **Strict Mode**: Security-first validation and sandboxing +- **Shared Components**: Reusable workflow building blocks +- **Repo Memory**: Persistent git-backed storage for agents +- **Sandboxed Execution**: All workflows run in the Agent Workflow Firewall (AWF) sandbox, enabling full `bash` and `edit` tools by default + +## Important Notes + +- Always reference the instructions file at https://github.com/github/gh-aw/blob/v0.50.1/.github/aw/github-agentic-workflows.md for complete documentation +- Use the MCP tool `agentic-workflows` when running in GitHub Copilot Cloud +- Workflows must be compiled to `.lock.yml` files before running in GitHub Actions +- **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF +- Follow security best practices: minimal permissions, explicit network access, no template injection +- **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself. diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 00000000000..2516ee22798 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,26 @@ +name: "Copilot Setup Steps" + +# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent + copilot-setup-steps: + runs-on: ubuntu-latest + + # Set minimal permissions for setup steps + # Copilot Agent receives its own token with appropriate permissions + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install gh-aw extension + uses: github/gh-aw/actions/setup-cli@v0.50.1 + with: + version: v0.50.1 diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml new file mode 100644 index 00000000000..7a11a7a1a9b --- /dev/null +++ b/.github/workflows/issue-triage.lock.yml @@ -0,0 +1,1145 @@ +# +# ___ _ _ +# / _ \ | | (_) +# | |_| | __ _ ___ _ __ | |_ _ ___ +# | _ |/ _` |/ _ \ '_ \| __| |/ __| +# | | | | (_| | __/ | | | |_| | (__ +# \_| |_/\__, |\___|_| |_|\__|_|\___| +# __/ | +# _ _ |___/ +# | | | | / _| | +# | | | | ___ _ __ _ __| |_| | _____ ____ +# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| +# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ +# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ +# +# This file was automatically generated by gh-aw (v0.50.1). DO NOT EDIT. +# +# To update this file, edit githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f and run: +# gh aw compile +# Not all edits will cause changes to this file. +# +# For more information: https://github.github.com/gh-aw/introduction/overview/ +# +# Intelligent issue triage assistant that processes new and reopened issues. +# Analyzes issue content, selects appropriate labels, detects spam, gathers context +# from similar issues, and provides analysis notes including debugging strategies, +# reproduction steps, and resource links. Helps maintainers quickly understand and +# prioritize incoming issues. +# +# Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f +# +# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"b75d431c77820732367af536321d1f67b43235012f9f4dee773da653dcab7428","compiler_version":"v0.50.1"} + +name: "Agentic Triage" +"on": + issues: + types: + - opened + - reopened + +permissions: {} + +concurrency: + group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number }}" + +run-name: "Agentic Triage" + +jobs: + activation: + needs: pre_activation + if: needs.pre_activation.outputs.activated == 'true' + runs-on: ubuntu-slim + permissions: + contents: read + discussions: write + issues: write + pull-requests: write + outputs: + body: ${{ steps.sanitized.outputs.body }} + comment_id: "" + comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} + steps: + - name: Setup Scripts + uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + with: + destination: /opt/gh-aw/actions + - name: Validate context variables + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/validate_context_variables.cjs'); + await main(); + - name: Checkout .github and .agents folders + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + sparse-checkout: | + .github + .agents + fetch-depth: 1 + persist-credentials: false + - name: Check workflow file timestamps + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_WORKFLOW_FILE: "issue-triage.lock.yml" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); + await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); + - name: Create prompt with built-in context + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + run: | + bash /opt/gh-aw/actions/create_prompt_first.sh + { + cat << 'GH_AW_PROMPT_EOF' + + GH_AW_PROMPT_EOF + cat "/opt/gh-aw/prompts/xpia.md" + cat "/opt/gh-aw/prompts/temp_folder_prompt.md" + cat "/opt/gh-aw/prompts/markdown.md" + cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" + cat << 'GH_AW_PROMPT_EOF' + + Tools: add_comment, add_labels, missing_tool, missing_data + + + The following GitHub context information is available for this workflow: + {{#if __GH_AW_GITHUB_ACTOR__ }} + - **actor**: __GH_AW_GITHUB_ACTOR__ + {{/if}} + {{#if __GH_AW_GITHUB_REPOSITORY__ }} + - **repository**: __GH_AW_GITHUB_REPOSITORY__ + {{/if}} + {{#if __GH_AW_GITHUB_WORKSPACE__ }} + - **workspace**: __GH_AW_GITHUB_WORKSPACE__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }} + - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }} + - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }} + - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }} + - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__ + {{/if}} + {{#if __GH_AW_GITHUB_RUN_ID__ }} + - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ + {{/if}} + + + GH_AW_PROMPT_EOF + cat << 'GH_AW_PROMPT_EOF' + + GH_AW_PROMPT_EOF + cat << 'GH_AW_PROMPT_EOF' + {{#runtime-import .github/workflows/issue-triage.md}} + GH_AW_PROMPT_EOF + } > "$GH_AW_PROMPT" + - name: Interpolate variables and render templates + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/interpolate_prompt.cjs'); + await main(); + - name: Substitute placeholders + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED: ${{ needs.pre_activation.outputs.activated }} + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + + const substitutePlaceholders = require('/opt/gh-aw/actions/substitute_placeholders.cjs'); + + // Call the substitution function + return await substitutePlaceholders({ + file: process.env.GH_AW_PROMPT, + substitutions: { + GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, + GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID, + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER, + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER, + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER, + GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, + GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, + GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED: process.env.GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED + } + }); + - name: Validate prompt placeholders + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + run: bash /opt/gh-aw/actions/validate_prompt_placeholders.sh + - name: Print prompt + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + run: bash /opt/gh-aw/actions/print_prompt_summary.sh + - name: Upload prompt artifact + if: success() + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: prompt + path: /tmp/gh-aw/aw-prompts/prompt.txt + retention-days: 1 + + agent: + needs: activation + runs-on: ubuntu-latest + permissions: read-all + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + GH_AW_ASSETS_ALLOWED_EXTS: "" + GH_AW_ASSETS_BRANCH: "" + GH_AW_ASSETS_MAX_SIZE_KB: 0 + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + GH_AW_SAFE_OUTPUTS: /opt/gh-aw/safeoutputs/outputs.jsonl + GH_AW_SAFE_OUTPUTS_CONFIG_PATH: /opt/gh-aw/safeoutputs/config.json + GH_AW_SAFE_OUTPUTS_TOOLS_PATH: /opt/gh-aw/safeoutputs/tools.json + GH_AW_WORKFLOW_ID_SANITIZED: issuetriage + outputs: + checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }} + detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} + detection_success: ${{ steps.detection_conclusion.outputs.success }} + has_patch: ${{ steps.collect_output.outputs.has_patch }} + model: ${{ steps.generate_aw_info.outputs.model }} + output: ${{ steps.collect_output.outputs.output }} + output_types: ${{ steps.collect_output.outputs.output_types }} + secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} + steps: + - name: Setup Scripts + uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + with: + destination: /opt/gh-aw/actions + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Create gh-aw temp directory + run: bash /opt/gh-aw/actions/create_gh_aw_tmp_dir.sh + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Checkout PR branch + id: checkout-pr + if: | + github.event.pull_request + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/checkout_pr_branch.cjs'); + await main(); + - name: Generate agentic run info + id: generate_aw_info + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const fs = require('fs'); + + const awInfo = { + engine_id: "copilot", + engine_name: "GitHub Copilot CLI", + model: process.env.GH_AW_MODEL_AGENT_COPILOT || "", + version: "", + agent_version: "0.0.415", + cli_version: "v0.50.1", + workflow_name: "Agentic Triage", + experimental: false, + supports_tools_allowlist: true, + run_id: context.runId, + run_number: context.runNumber, + run_attempt: process.env.GITHUB_RUN_ATTEMPT, + repository: context.repo.owner + '/' + context.repo.repo, + ref: context.ref, + sha: context.sha, + actor: context.actor, + event_name: context.eventName, + staged: false, + allowed_domains: ["defaults"], + firewall_enabled: true, + awf_version: "v0.20.2", + awmg_version: "v0.1.5", + steps: { + firewall: "squid" + }, + created_at: new Date().toISOString() + }; + + // Write to /tmp/gh-aw directory to avoid inclusion in PR + const tmpPath = '/tmp/gh-aw/aw_info.json'; + fs.writeFileSync(tmpPath, JSON.stringify(awInfo, null, 2)); + console.log('Generated aw_info.json at:', tmpPath); + console.log(JSON.stringify(awInfo, null, 2)); + + // Set model as output for reuse in other steps/jobs + core.setOutput('model', awInfo.model); + - name: Validate COPILOT_GITHUB_TOKEN secret + id: validate-secret + run: /opt/gh-aw/actions/validate_multi_secret.sh COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + - name: Install GitHub Copilot CLI + run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.415 + - name: Install awf binary + run: bash /opt/gh-aw/actions/install_awf_binary.sh v0.20.2 + - name: Download container images + run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.20.2 ghcr.io/github/gh-aw-firewall/api-proxy:0.20.2 ghcr.io/github/gh-aw-firewall/squid:0.20.2 ghcr.io/github/gh-aw-mcpg:v0.1.5 ghcr.io/github/github-mcp-server:v0.31.0 node:lts-alpine + - name: Write Safe Outputs Config + run: | + mkdir -p /opt/gh-aw/safeoutputs + mkdir -p /tmp/gh-aw/safeoutputs + mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs + cat > /opt/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' + {"add_comment":{"max":1},"add_labels":{"max":5},"missing_data":{},"missing_tool":{},"noop":{"max":1}} + GH_AW_SAFE_OUTPUTS_CONFIG_EOF + cat > /opt/gh-aw/safeoutputs/tools.json << 'GH_AW_SAFE_OUTPUTS_TOOLS_EOF' + [ + { + "description": "Add a comment to an existing GitHub issue, pull request, or discussion. Use this to provide feedback, answer questions, or add information to an existing conversation. For creating new items, use create_issue, create_discussion, or create_pull_request instead. IMPORTANT: Comments are subject to validation constraints enforced by the MCP server - maximum 65536 characters for the complete comment (including footer which is added automatically), 10 mentions (@username), and 50 links. Exceeding these limits will result in an immediate error with specific guidance. NOTE: By default, this tool requires discussions:write permission. If your GitHub App lacks Discussions permission, set 'discussions: false' in the workflow's safe-outputs.add-comment configuration to exclude this permission. CONSTRAINTS: Maximum 1 comment(s) can be added.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "body": { + "description": "The comment text in Markdown format. This is the 'body' field - do not use 'comment_body' or other variations. Provide helpful, relevant information that adds value to the conversation. CONSTRAINTS: The complete comment (your body text + automatically added footer) must not exceed 65536 characters total. Maximum 10 mentions (@username), maximum 50 links (http/https URLs). A footer (~200-500 characters) is automatically appended with workflow attribution, so leave adequate space. If these limits are exceeded, the tool call will fail with a detailed error message indicating which constraint was violated.", + "type": "string" + }, + "item_number": { + "description": "The issue, pull request, or discussion number to comment on. This is the numeric ID from the GitHub URL (e.g., 123 in github.com/owner/repo/issues/123). If omitted, the tool auto-targets the issue, PR, or discussion that triggered this workflow. Auto-targeting only works for issue, pull_request, discussion, and comment event triggers β€” it does NOT work for schedule, workflow_dispatch, push, or workflow_run triggers. For those trigger types, always provide item_number explicitly, or the comment will be silently discarded.", + "type": "number" + } + }, + "required": [ + "body" + ], + "type": "object" + }, + "name": "add_comment" + }, + { + "description": "Add labels to an existing GitHub issue or pull request for categorization and filtering. Labels must already exist in the repository. For creating new issues with labels, use create_issue with the labels property instead. CONSTRAINTS: Maximum 5 label(s) can be added.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "item_number": { + "description": "Issue or PR number to add labels to. This is the numeric ID from the GitHub URL (e.g., 456 in github.com/owner/repo/issues/456). If omitted, adds labels to the issue or PR that triggered this workflow. Only works for issue or pull_request event triggers. For schedule, workflow_dispatch, or other triggers, item_number is required β€” omitting it will silently skip the label operation.", + "type": "number" + }, + "labels": { + "description": "Label names to add (e.g., ['bug', 'priority-high']). Labels must exist in the repository.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "name": "add_labels" + }, + { + "description": "Report that a tool or capability needed to complete the task is not available, or share any information you deem important about missing functionality or limitations. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "alternatives": { + "description": "Any workarounds, manual steps, or alternative approaches the user could take (max 256 characters).", + "type": "string" + }, + "reason": { + "description": "Explanation of why this tool is needed or what information you want to share about the limitation (max 256 characters).", + "type": "string" + }, + "tool": { + "description": "Optional: Name or description of the missing tool or capability (max 128 characters). Be specific about what functionality is needed.", + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + }, + "name": "missing_tool" + }, + { + "description": "Log a transparency message when no significant actions are needed. Use this to confirm workflow completion and provide visibility when analysis is complete but no changes or outputs are required (e.g., 'No issues found', 'All checks passed'). This ensures the workflow produces human-visible output even when no other actions are taken.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "message": { + "description": "Status or completion message to log. Should explain what was analyzed and the outcome (e.g., 'Code review complete - no issues found', 'Analysis complete - all tests passing').", + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + }, + "name": "noop" + }, + { + "description": "Report that data or information needed to complete the task is not available. Use this when you cannot accomplish what was requested because required data, context, or information is missing.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "alternatives": { + "description": "Any workarounds, manual steps, or alternative approaches the user could take (max 256 characters).", + "type": "string" + }, + "context": { + "description": "Additional context about the missing data or where it should come from (max 256 characters).", + "type": "string" + }, + "data_type": { + "description": "Type or description of the missing data or information (max 128 characters). Be specific about what data is needed.", + "type": "string" + }, + "reason": { + "description": "Explanation of why this data is needed to complete the task (max 256 characters).", + "type": "string" + } + }, + "required": [], + "type": "object" + }, + "name": "missing_data" + } + ] + GH_AW_SAFE_OUTPUTS_TOOLS_EOF + cat > /opt/gh-aw/safeoutputs/validation.json << 'GH_AW_SAFE_OUTPUTS_VALIDATION_EOF' + { + "add_comment": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "item_number": { + "issueOrPRNumber": true + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, + "add_labels": { + "defaultMax": 5, + "fields": { + "item_number": { + "issueOrPRNumber": true + }, + "labels": { + "required": true, + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 128 + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, + "missing_data": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "context": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "data_type": { + "type": "string", + "sanitize": true, + "maxLength": 128 + }, + "reason": { + "type": "string", + "sanitize": true, + "maxLength": 256 + } + } + }, + "missing_tool": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 512 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "tool": { + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, + "noop": { + "defaultMax": 1, + "fields": { + "message": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + } + } + } + } + GH_AW_SAFE_OUTPUTS_VALIDATION_EOF + - name: Generate Safe Outputs MCP Server Config + id: safe-outputs-config + run: | + # Generate a secure random API key (360 bits of entropy, 40+ chars) + # Mask immediately to prevent timing vulnerabilities + API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${API_KEY}" + + PORT=3001 + + # Set outputs for next steps + { + echo "safe_outputs_api_key=${API_KEY}" + echo "safe_outputs_port=${PORT}" + } >> "$GITHUB_OUTPUT" + + echo "Safe Outputs MCP server will run on port ${PORT}" + + - name: Start Safe Outputs MCP HTTP Server + id: safe-outputs-start + env: + DEBUG: '*' + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }} + GH_AW_SAFE_OUTPUTS_TOOLS_PATH: /opt/gh-aw/safeoutputs/tools.json + GH_AW_SAFE_OUTPUTS_CONFIG_PATH: /opt/gh-aw/safeoutputs/config.json + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + run: | + # Environment variables are set above to prevent template injection + export DEBUG + export GH_AW_SAFE_OUTPUTS_PORT + export GH_AW_SAFE_OUTPUTS_API_KEY + export GH_AW_SAFE_OUTPUTS_TOOLS_PATH + export GH_AW_SAFE_OUTPUTS_CONFIG_PATH + export GH_AW_MCP_LOG_DIR + + bash /opt/gh-aw/actions/start_safe_outputs_server.sh + + - name: Start MCP Gateway + id: start-mcp-gateway + env: + GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + set -eo pipefail + mkdir -p /tmp/gh-aw/mcp-config + + # Export gateway environment variables for MCP config and gateway script + export MCP_GATEWAY_PORT="80" + export MCP_GATEWAY_DOMAIN="host.docker.internal" + MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${MCP_GATEWAY_API_KEY}" + export MCP_GATEWAY_API_KEY + export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" + mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" + export DEBUG="*" + + export GH_AW_ENGINE="copilot" + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_LOCKDOWN -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.1.5' + + mkdir -p /home/runner/.copilot + cat << GH_AW_MCP_CONFIG_EOF | bash /opt/gh-aw/actions/start_mcp_gateway.sh + { + "mcpServers": { + "github": { + "type": "stdio", + "container": "ghcr.io/github/github-mcp-server:v0.31.0", + "env": { + "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", + "GITHUB_READ_ONLY": "1", + "GITHUB_TOOLSETS": "issues" + } + }, + "safeoutputs": { + "type": "http", + "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", + "headers": { + "Authorization": "\${GH_AW_SAFE_OUTPUTS_API_KEY}" + } + } + }, + "gateway": { + "port": $MCP_GATEWAY_PORT, + "domain": "${MCP_GATEWAY_DOMAIN}", + "apiKey": "${MCP_GATEWAY_API_KEY}", + "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" + } + } + GH_AW_MCP_CONFIG_EOF + - name: Generate workflow overview + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { generateWorkflowOverview } = require('/opt/gh-aw/actions/generate_workflow_overview.cjs'); + await generateWorkflowOverview(core); + - name: Download prompt artifact + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + with: + name: prompt + path: /tmp/gh-aw/aw-prompts + - name: Clean git credentials + run: bash /opt/gh-aw/actions/clean_git_credentials.sh + - name: Execute GitHub Copilot CLI + id: agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 10 + run: | + set -o pipefail + sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.20.2 --skip-pull --enable-api-proxy \ + -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-all-tools --allow-all-paths --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_AGENT_COPILOT:+ --model "$GH_AW_MODEL_AGENT_COPILOT"}' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json + GH_AW_MODEL_AGENT_COPILOT: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }} + GITHUB_WORKSPACE: ${{ github.workspace }} + XDG_CONFIG_HOME: /home/runner + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Copy Copilot session state files to logs + if: always() + continue-on-error: true + run: | + # Copy Copilot session state files to logs folder for artifact collection + # This ensures they are in /tmp/gh-aw/ where secret redaction can scan them + SESSION_STATE_DIR="$HOME/.copilot/session-state" + LOGS_DIR="/tmp/gh-aw/sandbox/agent/logs" + + if [ -d "$SESSION_STATE_DIR" ]; then + echo "Copying Copilot session state files from $SESSION_STATE_DIR to $LOGS_DIR" + mkdir -p "$LOGS_DIR" + cp -v "$SESSION_STATE_DIR"/*.jsonl "$LOGS_DIR/" 2>/dev/null || true + echo "Session state files copied successfully" + else + echo "No session-state directory found at $SESSION_STATE_DIR" + fi + - name: Stop MCP Gateway + if: always() + continue-on-error: true + env: + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }} + run: | + bash /opt/gh-aw/actions/stop_mcp_gateway.sh "$GATEWAY_PID" + - name: Redact secrets in logs + if: always() + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/redact_secrets.cjs'); + await main(); + env: + GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' + SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Safe Outputs + if: always() + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: safe-output + path: ${{ env.GH_AW_SAFE_OUTPUTS }} + if-no-files-found: warn + - name: Ingest agent output + id: collect_output + if: always() + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/collect_ndjson_output.cjs'); + await main(); + - name: Upload sanitized agent output + if: always() && env.GH_AW_AGENT_OUTPUT + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: agent-output + path: ${{ env.GH_AW_AGENT_OUTPUT }} + if-no-files-found: warn + - name: Upload engine output files + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: agent_outputs + path: | + /tmp/gh-aw/sandbox/agent/logs/ + /tmp/gh-aw/redacted-urls.log + if-no-files-found: ignore + - name: Parse agent logs for step summary + if: always() + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/parse_copilot_log.cjs'); + await main(); + - name: Parse MCP Gateway logs for step summary + if: always() + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/parse_mcp_gateway_log.cjs'); + await main(); + - name: Print firewall logs + if: always() + continue-on-error: true + env: + AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs + run: | + # Fix permissions on firewall logs so they can be uploaded as artifacts + # AWF runs with sudo, creating files owned by root + sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall/logs 2>/dev/null || true + # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) + if command -v awf &> /dev/null; then + awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" + else + echo 'AWF binary not installed, skipping firewall log summary' + fi + - name: Upload agent artifacts + if: always() + continue-on-error: true + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: agent-artifacts + path: | + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/mcp-logs/ + /tmp/gh-aw/sandbox/firewall/logs/ + /tmp/gh-aw/agent-stdio.log + /tmp/gh-aw/agent/ + if-no-files-found: ignore + # --- Threat Detection (inline) --- + - name: Check if detection needed + id: detection_guard + if: always() + env: + OUTPUT_TYPES: ${{ steps.collect_output.outputs.output_types }} + HAS_PATCH: ${{ steps.collect_output.outputs.has_patch }} + run: | + if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then + echo "run_detection=true" >> "$GITHUB_OUTPUT" + echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH" + else + echo "run_detection=false" >> "$GITHUB_OUTPUT" + echo "Detection skipped: no agent outputs or patches to analyze" + fi + - name: Clear MCP configuration for detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + rm -f /tmp/gh-aw/mcp-config/mcp-servers.json + rm -f /home/runner/.copilot/mcp-config.json + rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" + - name: Prepare threat detection files + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection/aw-prompts + cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true + cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true + for f in /tmp/gh-aw/aw-*.patch; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + echo "Prepared threat detection files:" + ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true + - name: Setup threat detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + WORKFLOW_NAME: "Agentic Triage" + WORKFLOW_DESCRIPTION: "Intelligent issue triage assistant that processes new and reopened issues.\nAnalyzes issue content, selects appropriate labels, detects spam, gathers context\nfrom similar issues, and provides analysis notes including debugging strategies,\nreproduction steps, and resource links. Helps maintainers quickly understand and\nprioritize incoming issues." + HAS_PATCH: ${{ steps.collect_output.outputs.has_patch }} + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/setup_threat_detection.cjs'); + await main(); + - name: Ensure threat-detection directory and log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection + touch /tmp/gh-aw/threat-detection/detection.log + - name: Execute GitHub Copilot CLI + if: always() && steps.detection_guard.outputs.run_detection == 'true' + id: detection_agentic_execution + # Copilot CLI tool arguments (sorted): + # --allow-tool shell(cat) + # --allow-tool shell(grep) + # --allow-tool shell(head) + # --allow-tool shell(jq) + # --allow-tool shell(ls) + # --allow-tool shell(tail) + # --allow-tool shell(wc) + timeout-minutes: 20 + run: | + set -o pipefail + sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,raw.githubusercontent.com,registry.npmjs.org,telemetry.enterprise.githubcopilot.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.20.2 --skip-pull --enable-api-proxy \ + -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(wc)'\'' --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_DETECTION_COPILOT:+ --model "$GH_AW_MODEL_DETECTION_COPILOT"}' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + GH_AW_MODEL_DETECTION_COPILOT: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }} + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }} + GITHUB_WORKSPACE: ${{ github.workspace }} + XDG_CONFIG_HOME: /home/runner + - name: Parse threat detection results + id: parse_detection_results + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/parse_threat_detection_results.cjs'); + await main(); + - name: Upload threat detection log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: threat-detection.log + path: /tmp/gh-aw/threat-detection/detection.log + if-no-files-found: ignore + - name: Set detection conclusion + id: detection_conclusion + if: always() + env: + RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + DETECTION_SUCCESS: ${{ steps.parse_detection_results.outputs.success }} + run: | + if [[ "$RUN_DETECTION" != "true" ]]; then + echo "conclusion=skipped" >> "$GITHUB_OUTPUT" + echo "success=true" >> "$GITHUB_OUTPUT" + echo "Detection was not needed, marking as skipped" + elif [[ "$DETECTION_SUCCESS" == "true" ]]; then + echo "conclusion=success" >> "$GITHUB_OUTPUT" + echo "success=true" >> "$GITHUB_OUTPUT" + echo "Detection passed successfully" + else + echo "conclusion=failure" >> "$GITHUB_OUTPUT" + echo "success=false" >> "$GITHUB_OUTPUT" + echo "Detection found issues" + fi + + conclusion: + needs: + - activation + - agent + - safe_outputs + if: (always()) && (needs.agent.result != 'skipped') + runs-on: ubuntu-slim + permissions: + contents: read + discussions: write + issues: write + pull-requests: write + outputs: + noop_message: ${{ steps.noop.outputs.noop_message }} + tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} + total_count: ${{ steps.missing_tool.outputs.total_count }} + steps: + - name: Setup Scripts + uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + with: + destination: /opt/gh-aw/actions + - name: Download agent output artifact + continue-on-error: true + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + with: + name: agent-output + path: /tmp/gh-aw/safeoutputs/ + - name: Setup agent output environment variable + run: | + mkdir -p /tmp/gh-aw/safeoutputs/ + find "/tmp/gh-aw/safeoutputs/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/safeoutputs/agent_output.json" >> "$GITHUB_ENV" + - name: Process No-Op Messages + id: noop + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_NOOP_MAX: "1" + GH_AW_WORKFLOW_NAME: "Agentic Triage" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/tree/346204513ecfa08b81566450d7d599556807389f/workflows/issue-triage.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/noop.cjs'); + await main(); + - name: Record Missing Tool + id: missing_tool + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Agentic Triage" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/tree/346204513ecfa08b81566450d7d599556807389f/workflows/issue-triage.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/missing_tool.cjs'); + await main(); + - name: Handle Agent Failure + id: handle_agent_failure + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Agentic Triage" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/tree/346204513ecfa08b81566450d7d599556807389f/workflows/issue-triage.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_WORKFLOW_ID: "issue-triage" + GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.agent.outputs.secret_verification_result }} + GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} + GH_AW_GROUP_REPORTS: "false" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/handle_agent_failure.cjs'); + await main(); + - name: Handle No-Op Message + id: handle_noop_message + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Agentic Triage" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/tree/346204513ecfa08b81566450d7d599556807389f/workflows/issue-triage.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_NOOP_MESSAGE: ${{ steps.noop.outputs.noop_message }} + GH_AW_NOOP_REPORT_AS_ISSUE: "true" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/handle_noop_message.cjs'); + await main(); + + pre_activation: + runs-on: ubuntu-slim + permissions: + discussions: write + issues: write + pull-requests: write + outputs: + activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} + matched_command: '' + steps: + - name: Setup Scripts + uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + with: + destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_REACTION: "eyes" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); + - name: Check team membership for workflow + id: check_membership + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_REQUIRED_ROLES: admin,maintainer,write + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/check_membership.cjs'); + await main(); + + safe_outputs: + needs: agent + if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (needs.agent.outputs.detection_success == 'true') + runs-on: ubuntu-slim + permissions: + contents: read + discussions: write + issues: write + pull-requests: write + timeout-minutes: 15 + env: + GH_AW_ENGINE_ID: "copilot" + GH_AW_WORKFLOW_ID: "issue-triage" + GH_AW_WORKFLOW_NAME: "Agentic Triage" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/tree/346204513ecfa08b81566450d7d599556807389f/workflows/issue-triage.md" + outputs: + code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} + code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} + create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} + create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} + process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} + process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} + steps: + - name: Setup Scripts + uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + with: + destination: /opt/gh-aw/actions + - name: Download agent output artifact + continue-on-error: true + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + with: + name: agent-output + path: /tmp/gh-aw/safeoutputs/ + - name: Setup agent output environment variable + run: | + mkdir -p /tmp/gh-aw/safeoutputs/ + find "/tmp/gh-aw/safeoutputs/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/safeoutputs/agent_output.json" >> "$GITHUB_ENV" + - name: Process Safe Outputs + id: process_safe_outputs + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"add_labels\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{}}" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/safe_output_handler_manager.cjs'); + await main(); + - name: Upload safe output items manifest + if: always() + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: safe-output-items + path: /tmp/safe-output-items.jsonl + if-no-files-found: warn + diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md new file mode 100644 index 00000000000..d3fa164cfc5 --- /dev/null +++ b/.github/workflows/issue-triage.md @@ -0,0 +1,87 @@ +--- +description: | + Intelligent issue triage assistant that processes new and reopened issues. + Analyzes issue content, selects appropriate labels, detects spam, gathers context + from similar issues, and provides analysis notes including debugging strategies, + reproduction steps, and resource links. Helps maintainers quickly understand and + prioritize incoming issues. + +on: + issues: + types: [opened, reopened] + reaction: eyes + +permissions: read-all + +network: defaults + +safe-outputs: + add-labels: + max: 5 + add-comment: + +tools: + web-fetch: + github: + toolsets: [issues] + # If in a public repo, setting `lockdown: false` allows + # reading issues, pull requests and comments from 3rd-parties + # If in a private repo this has no particular effect. + lockdown: false + +timeout-minutes: 10 +source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f +engine: copilot +--- + +# Agentic Triage + + + +You're a triage assistant for GitHub issues. Your task is to analyze issue #${{ github.event.issue.number }} and perform some initial triage tasks related to that issue. + +1. Select appropriate labels for the issue from the provided list. + +2. Retrieve the issue content using the `get_issue` tool. If the issue is obviously spam, or generated by bot, or something else that is not an actual issue to be worked on, then add an issue comment to the issue with a one-sentence analysis and exit the workflow. + +3. Next, use the GitHub tools to gather additional context about the issue: + - Fetch the list of labels available in this repository. Use 'gh label list' bash command to fetch the labels. This will give you the labels you can use for triaging issues. + - Fetch any comments on the issue using the `get_issue_comments` tool + - Find similar issues if needed using the `search_issues` tool + - List the issues to see other open issues in the repository using the `list_issues` tool + +4. Analyze the issue content, considering: + - The issue title and description + - The type of issue (bug report, feature request, question, etc.) + - Technical areas mentioned + - Severity or priority indicators + - User impact + - Components affected + +5. Write notes, ideas, nudges, resource links, debugging strategies and/or reproduction steps for the team to consider relevant to the issue. + +6. Select appropriate labels from the available labels list provided above: + - Choose labels that accurately reflect the issue's nature + - Be specific but comprehensive + - Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority) + - Consider platform labels (android, ios) if applicable + - Search for similar issues, and if you find similar issues consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue. + - Only select labels from the provided list above + - It's okay to not add any labels if none are clearly applicable + +7. Apply the selected labels: + - Use the `update_issue` tool to apply the labels to the issue + - DO NOT communicate directly with users + - If no labels are clearly applicable, do not apply any labels + +8. Add an issue comment to the issue with your analysis: + - Start with "🎯 Agentic Issue Triage" + - Provide a brief summary of the issue + - Mention any relevant details that might help the team understand the issue better + - Include any debugging strategies or reproduction steps if applicable + - Suggest resources or links that might be helpful for resolving the issue or learning skills related to the issue or the particular area of the codebase affected by it + - Mention any nudges or ideas that could help the team in addressing the issue + - If you have possible reproduction steps, include them in the comment + - If you have any debugging strategies, include them in the comment + - If appropriate break the issue down to sub-tasks and write a checklist of things to do. + - Use collapsed-by-default sections in the GitHub markdown to keep the comment tidy. Collapse all sections except the short main summary at the top. diff --git a/.prettierignore b/.prettierignore index 9af7564d884..472b01a94f2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,6 +11,9 @@ # Pnpm lock file pnpm-lock.yaml +# Agentic workflow lock file +.lock.yml + # Emu spec file, formatting is wrong packages/spec/src/spec.emu.html diff --git a/.vscode/mcp.json b/.vscode/mcp.json new file mode 100644 index 00000000000..93747f42a08 --- /dev/null +++ b/.vscode/mcp.json @@ -0,0 +1,9 @@ +{ + "servers": { + "github-agentic-workflows": { + "command": "gh", + "args": ["aw", "mcp-server"], + "cwd": "${workspaceFolder}" + } + } +} diff --git a/cspell.yaml b/cspell.yaml index 6d4f45eceea..b65389923bb 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -337,6 +337,7 @@ ignorePaths: - packages/mutator-framework/**/*.test.ts - packages/typespec-vscode/test/scenarios/** - pnpm-lock.yaml + - .lock.yml - "**/*.mp4" - "**/*.plist" - .git/** From 82aa408b6e4b7ff79f173841a175cd4b326426da Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 09:43:23 -0400 Subject: [PATCH 02/18] Tweak workflow --- .github/aw/actions-lock.json | 9 +++++ .github/workflows/issue-triage.lock.yml | 2 +- .github/workflows/issue-triage.md | 54 ++++++++++++------------- 3 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 .github/aw/actions-lock.json diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json new file mode 100644 index 00000000000..763af938d46 --- /dev/null +++ b/.github/aw/actions-lock.json @@ -0,0 +1,9 @@ +{ + "entries": { + "github/gh-aw/actions/setup@v0.50.1": { + "repo": "github/gh-aw/actions/setup", + "version": "v0.50.1", + "sha": "fad43e3c91a4e1d43e458f68e96574127934e7d1" + } + } +} diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 7a11a7a1a9b..fa3dc3ba146 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"b75d431c77820732367af536321d1f67b43235012f9f4dee773da653dcab7428","compiler_version":"v0.50.1"} +# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"e6012f0e4160bd3a54ae620ce20c4da86beb1bdf7e33c058f276348910e5ee44","compiler_version":"v0.50.1"} name: "Agentic Triage" "on": diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index d3fa164cfc5..4b3c1ce8227 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -36,52 +36,48 @@ engine: copilot # Agentic Triage - +You're a triage assistant for the TypeSpec GitHub repository. Your task is to analyze issue #${{ github.event.issue.number }} and perform initial triage. -You're a triage assistant for GitHub issues. Your task is to analyze issue #${{ github.event.issue.number }} and perform some initial triage tasks related to that issue. +## Available Labels -1. Select appropriate labels for the issue from the provided list. +To find the available labels for this repository, read the file `eng/common/config/labels.ts` in the repository. This file contains all the label definitions organized by category: +- **Area labels** (`AreaLabels`): Used to categorize which area of the codebase the issue belongs to (e.g. `compiler:core`, `emitter:openapi3`, `ide`, etc.). Always try to assign the most specific area label that matches. +- **Issue kind labels** (`issue_kinds`): Used to classify the type of issue (`bug`, `feature`, `docs`). +- Other label categories are defined there as well. -2. Retrieve the issue content using the `get_issue` tool. If the issue is obviously spam, or generated by bot, or something else that is not an actual issue to be worked on, then add an issue comment to the issue with a one-sentence analysis and exit the workflow. +Only use labels defined in that file. -3. Next, use the GitHub tools to gather additional context about the issue: - - Fetch the list of labels available in this repository. Use 'gh label list' bash command to fetch the labels. This will give you the labels you can use for triaging issues. +## Instructions + +1. Retrieve the issue content using the `get_issue` tool. If the issue is obviously spam, generated by a bot, or not an actual issue to be worked on, then add an issue comment with a one-sentence analysis and exit the workflow. + +2. Gather additional context about the issue: - Fetch any comments on the issue using the `get_issue_comments` tool - Find similar issues if needed using the `search_issues` tool - List the issues to see other open issues in the repository using the `list_issues` tool -4. Analyze the issue content, considering: +3. Analyze the issue content, considering: - The issue title and description - The type of issue (bug report, feature request, question, etc.) - - Technical areas mentioned + - Technical areas mentioned (packages, emitters, libraries, tools) - Severity or priority indicators - User impact - Components affected -5. Write notes, ideas, nudges, resource links, debugging strategies and/or reproduction steps for the team to consider relevant to the issue. - -6. Select appropriate labels from the available labels list provided above: - - Choose labels that accurately reflect the issue's nature - - Be specific but comprehensive - - Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority) - - Consider platform labels (android, ios) if applicable - - Search for similar issues, and if you find similar issues consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue. - - Only select labels from the provided list above - - It's okay to not add any labels if none are clearly applicable +4. Select appropriate labels based on the labels defined in `eng/common/config/labels.ts`: + - Pick ONE area label that best matches the issue. If the issue spans multiple areas, pick the most relevant one. If no area label is clearly applicable, do not add one. + - Pick ONE issue kind label (`bug`, `feature`, or `docs`) if the type is clear. + - Search for similar issues, and if you find a closely matching OPEN issue, consider using a "duplicate" label. + - Only use labels that are defined in the labels configuration file. + - It's okay to not add any labels if none are clearly applicable. -7. Apply the selected labels: - - Use the `update_issue` tool to apply the labels to the issue - - DO NOT communicate directly with users - - If no labels are clearly applicable, do not apply any labels +5. Apply the selected labels using the `add_labels` tool. If no labels are clearly applicable, do not apply any. -8. Add an issue comment to the issue with your analysis: - - Start with "🎯 Agentic Issue Triage" +6. Add an issue comment with your analysis: + - Start with "🎯 Issue Triage" - Provide a brief summary of the issue - Mention any relevant details that might help the team understand the issue better - Include any debugging strategies or reproduction steps if applicable - - Suggest resources or links that might be helpful for resolving the issue or learning skills related to the issue or the particular area of the codebase affected by it - - Mention any nudges or ideas that could help the team in addressing the issue - - If you have possible reproduction steps, include them in the comment - - If you have any debugging strategies, include them in the comment - - If appropriate break the issue down to sub-tasks and write a checklist of things to do. + - If appropriate, break the issue down into sub-tasks and write a checklist - Use collapsed-by-default sections in the GitHub markdown to keep the comment tidy. Collapse all sections except the short main summary at the top. + - Do NOT include any text about agentic workflows, how to install them, or any self-promotional content about the tooling used to generate this comment. Do NOT mention that this triage was performed by an AI, bot, or agent. From a0dc6d82e604186ee949d565f6968ecad3c6cffb Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 09:45:30 -0400 Subject: [PATCH 03/18] setup workflow dispatch --- .github/workflows/issue-triage.lock.yml | 12 ++++++++++-- .github/workflows/issue-triage.md | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index fa3dc3ba146..6b4fe5cbef7 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"e6012f0e4160bd3a54ae620ce20c4da86beb1bdf7e33c058f276348910e5ee44","compiler_version":"v0.50.1"} +# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"6aad4ca5f51cde60da4507b5946c57ffef7e15b32c578a21ef06539cdda424e5","compiler_version":"v0.50.1"} name: "Agentic Triage" "on": @@ -37,6 +37,11 @@ name: "Agentic Triage" types: - opened - reopened + workflow_dispatch: + inputs: + issue-number: + description: Issue number to triage + required: true permissions: {} @@ -105,6 +110,7 @@ jobs: env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_EXPR_A77E2879: ${{ github.event.issue.number || inputs.issue-number }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} @@ -167,7 +173,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + GH_AW_EXPR_A77E2879: ${{ github.event.issue.number || inputs.issue-number }} with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); @@ -178,6 +184,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_EXPR_A77E2879: ${{ github.event.issue.number || inputs.issue-number }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} @@ -198,6 +205,7 @@ jobs: return await substitutePlaceholders({ file: process.env.GH_AW_PROMPT, substitutions: { + GH_AW_EXPR_A77E2879: process.env.GH_AW_EXPR_A77E2879, GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID, GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER, diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 4b3c1ce8227..ed491938d33 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -9,6 +9,11 @@ description: | on: issues: types: [opened, reopened] + workflow_dispatch: + inputs: + issue-number: + description: "Issue number to triage" + required: true reaction: eyes permissions: read-all @@ -36,7 +41,7 @@ engine: copilot # Agentic Triage -You're a triage assistant for the TypeSpec GitHub repository. Your task is to analyze issue #${{ github.event.issue.number }} and perform initial triage. +You're a triage assistant for the TypeSpec GitHub repository. Your task is to analyze issue #${{ github.event.issue.number || inputs.issue-number }} and perform initial triage. ## Available Labels From e4aeaa389c55c5d13c9d8c3da7f84e3952459b2e Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 10:13:24 -0400 Subject: [PATCH 04/18] update --- .github/aw/actions-lock.json | 6 +- .github/workflows/issue-triage.lock.yml | 309 ++++++++++++++---------- .github/workflows/issue-triage.md | 1 + 3 files changed, 189 insertions(+), 127 deletions(-) diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json index 763af938d46..4305552664e 100644 --- a/.github/aw/actions-lock.json +++ b/.github/aw/actions-lock.json @@ -1,9 +1,9 @@ { "entries": { - "github/gh-aw/actions/setup@v0.50.1": { + "github/gh-aw/actions/setup@v0.57.2": { "repo": "github/gh-aw/actions/setup", - "version": "v0.50.1", - "sha": "fad43e3c91a4e1d43e458f68e96574127934e7d1" + "version": "v0.57.2", + "sha": "32b3a711a9ee97d38e3989c90af0385aff0066a7" } } } diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 6b4fe5cbef7..db738c97129 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -13,7 +13,7 @@ # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ # -# This file was automatically generated by gh-aw (v0.50.1). DO NOT EDIT. +# This file was automatically generated by gh-aw (v0.57.2). DO NOT EDIT. # # To update this file, edit githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f and run: # gh aw compile @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"6aad4ca5f51cde60da4507b5946c57ffef7e15b32c578a21ef06539cdda424e5","compiler_version":"v0.50.1"} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"d59118088248d557e2b4a069b72c49a300beed7675827ceca209d42c91eeaa1f","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -46,7 +46,7 @@ name: "Agentic Triage" permissions: {} concurrency: - group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number }}" + group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}" run-name: "Agentic Triage" @@ -64,29 +64,66 @@ jobs: body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + model: ${{ steps.generate_aw_info.outputs.model }} + secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} text: ${{ steps.sanitized.outputs.text }} title: ${{ steps.sanitized.outputs.title }} steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + uses: github/gh-aw/actions/setup@32b3a711a9ee97d38e3989c90af0385aff0066a7 # v0.57.2 with: destination: /opt/gh-aw/actions - - name: Validate context variables + - name: Generate agentic run info + id: generate_aw_info + env: + GH_AW_INFO_ENGINE_ID: "copilot" + GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" + GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} + GH_AW_INFO_VERSION: "" + GH_AW_INFO_AGENT_VERSION: "latest" + GH_AW_INFO_CLI_VERSION: "v0.57.2" + GH_AW_INFO_WORKFLOW_NAME: "Agentic Triage" + GH_AW_INFO_EXPERIMENTAL: "false" + GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" + GH_AW_INFO_STAGED: "false" + GH_AW_INFO_ALLOWED_DOMAINS: '["defaults"]' + GH_AW_INFO_FIREWALL_ENABLED: "true" + GH_AW_INFO_AWF_VERSION: "v0.23.0" + GH_AW_INFO_AWMG_VERSION: "" + GH_AW_INFO_FIREWALL_TYPE: "squid" + GH_AW_COMPILED_STRICT: "true" uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 with: script: | - const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/validate_context_variables.cjs'); - await main(); + const { main } = require('/opt/gh-aw/actions/generate_aw_info.cjs'); + await main(core, context); + - name: Validate COPILOT_GITHUB_TOKEN secret + id: validate-secret + run: /opt/gh-aw/actions/validate_multi_secret.sh COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Checkout .github and .agents folders uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + persist-credentials: false sparse-checkout: | .github .agents + sparse-checkout-cone-mode: true fetch-depth: 1 - persist-credentials: false + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + GH_AW_REACTION: "eyes" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check workflow file timestamps uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: @@ -131,7 +168,7 @@ jobs: cat "/opt/gh-aw/prompts/safe_outputs_prompt.md" cat << 'GH_AW_PROMPT_EOF' - Tools: add_comment, add_labels, missing_tool, missing_data + Tools: add_comment, add_labels, missing_tool, missing_data, noop The following GitHub context information is available for this workflow: @@ -225,12 +262,14 @@ jobs: env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt run: bash /opt/gh-aw/actions/print_prompt_summary.sh - - name: Upload prompt artifact + - name: Upload activation artifact if: success() - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: - name: prompt - path: /tmp/gh-aw/aw-prompts/prompt.txt + name: activation + path: | + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/aw-prompts/prompt.txt retention-days: 1 agent: @@ -252,13 +291,13 @@ jobs: detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} detection_success: ${{ steps.detection_conclusion.outputs.success }} has_patch: ${{ steps.collect_output.outputs.has_patch }} - model: ${{ steps.generate_aw_info.outputs.model }} + inference_access_error: ${{ steps.detect-inference-error.outputs.inference_access_error || 'false' }} + model: ${{ needs.activation.outputs.model }} output: ${{ steps.collect_output.outputs.output }} output_types: ${{ steps.collect_output.outputs.output_types }} - secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + uses: github/gh-aw/actions/setup@32b3a711a9ee97d38e3989c90af0385aff0066a7 # v0.57.2 with: destination: /opt/gh-aw/actions - name: Checkout repository @@ -282,7 +321,7 @@ jobs: - name: Checkout PR branch id: checkout-pr if: | - github.event.pull_request + (github.event.pull_request) || (github.event.issue.pull_request) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} @@ -293,61 +332,12 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/checkout_pr_branch.cjs'); await main(); - - name: Generate agentic run info - id: generate_aw_info - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 - with: - script: | - const fs = require('fs'); - - const awInfo = { - engine_id: "copilot", - engine_name: "GitHub Copilot CLI", - model: process.env.GH_AW_MODEL_AGENT_COPILOT || "", - version: "", - agent_version: "0.0.415", - cli_version: "v0.50.1", - workflow_name: "Agentic Triage", - experimental: false, - supports_tools_allowlist: true, - run_id: context.runId, - run_number: context.runNumber, - run_attempt: process.env.GITHUB_RUN_ATTEMPT, - repository: context.repo.owner + '/' + context.repo.repo, - ref: context.ref, - sha: context.sha, - actor: context.actor, - event_name: context.eventName, - staged: false, - allowed_domains: ["defaults"], - firewall_enabled: true, - awf_version: "v0.20.2", - awmg_version: "v0.1.5", - steps: { - firewall: "squid" - }, - created_at: new Date().toISOString() - }; - - // Write to /tmp/gh-aw directory to avoid inclusion in PR - const tmpPath = '/tmp/gh-aw/aw_info.json'; - fs.writeFileSync(tmpPath, JSON.stringify(awInfo, null, 2)); - console.log('Generated aw_info.json at:', tmpPath); - console.log(JSON.stringify(awInfo, null, 2)); - - // Set model as output for reuse in other steps/jobs - core.setOutput('model', awInfo.model); - - name: Validate COPILOT_GITHUB_TOKEN secret - id: validate-secret - run: /opt/gh-aw/actions/validate_multi_secret.sh COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default - env: - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - name: Install GitHub Copilot CLI - run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.415 + run: /opt/gh-aw/actions/install_copilot_cli.sh latest - name: Install awf binary - run: bash /opt/gh-aw/actions/install_awf_binary.sh v0.20.2 + run: bash /opt/gh-aw/actions/install_awf_binary.sh v0.23.0 - name: Download container images - run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.20.2 ghcr.io/github/gh-aw-firewall/api-proxy:0.20.2 ghcr.io/github/gh-aw-firewall/squid:0.20.2 ghcr.io/github/gh-aw-mcpg:v0.1.5 ghcr.io/github/github-mcp-server:v0.31.0 node:lts-alpine + run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.23.0 ghcr.io/github/gh-aw-firewall/api-proxy:0.23.0 ghcr.io/github/gh-aw-firewall/squid:0.23.0 ghcr.io/github/gh-aw-mcpg:v0.1.8 ghcr.io/github/github-mcp-server:v0.32.0 node:lts-alpine - name: Write Safe Outputs Config run: | mkdir -p /opt/gh-aw/safeoutputs @@ -367,9 +357,25 @@ jobs: "description": "The comment text in Markdown format. This is the 'body' field - do not use 'comment_body' or other variations. Provide helpful, relevant information that adds value to the conversation. CONSTRAINTS: The complete comment (your body text + automatically added footer) must not exceed 65536 characters total. Maximum 10 mentions (@username), maximum 50 links (http/https URLs). A footer (~200-500 characters) is automatically appended with workflow attribution, so leave adequate space. If these limits are exceeded, the tool call will fail with a detailed error message indicating which constraint was violated.", "type": "string" }, + "integrity": { + "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\").", + "type": "string" + }, "item_number": { - "description": "The issue, pull request, or discussion number to comment on. This is the numeric ID from the GitHub URL (e.g., 123 in github.com/owner/repo/issues/123). If omitted, the tool auto-targets the issue, PR, or discussion that triggered this workflow. Auto-targeting only works for issue, pull_request, discussion, and comment event triggers β€” it does NOT work for schedule, workflow_dispatch, push, or workflow_run triggers. For those trigger types, always provide item_number explicitly, or the comment will be silently discarded.", - "type": "number" + "description": "The issue, pull request, or discussion number to comment on. This is the numeric ID from the GitHub URL (e.g., 123 in github.com/owner/repo/issues/123). Can also be a temporary_id (e.g., 'aw_abc123') from a previously created issue in the same workflow run. If omitted, the tool auto-targets the issue, PR, or discussion that triggered this workflow. Auto-targeting only works for issue, pull_request, discussion, and comment event triggers β€” it does NOT work for schedule, workflow_dispatch, push, or workflow_run triggers. For those trigger types, always provide item_number explicitly, or the tool call will fail with an error.", + "type": [ + "number", + "string" + ] + }, + "secrecy": { + "description": "Confidentiality level of the message content (e.g., \"public\", \"internal\", \"private\").", + "type": "string" + }, + "temporary_id": { + "description": "Unique temporary identifier for this comment. Format: 'aw_' followed by 3 to 12 alphanumeric characters (e.g., 'aw_abc1', 'aw_Test123'). Auto-generated if not provided. The temporary ID is returned in the tool response so you can reference this comment later.", + "pattern": "^aw_[A-Za-z0-9]{3,12}$", + "type": "string" } }, "required": [ @@ -384,6 +390,10 @@ jobs: "inputSchema": { "additionalProperties": false, "properties": { + "integrity": { + "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\").", + "type": "string" + }, "item_number": { "description": "Issue or PR number to add labels to. This is the numeric ID from the GitHub URL (e.g., 456 in github.com/owner/repo/issues/456). If omitted, adds labels to the issue or PR that triggered this workflow. Only works for issue or pull_request event triggers. For schedule, workflow_dispatch, or other triggers, item_number is required β€” omitting it will silently skip the label operation.", "type": "number" @@ -394,6 +404,10 @@ jobs: "type": "string" }, "type": "array" + }, + "secrecy": { + "description": "Confidentiality level of the message content (e.g., \"public\", \"internal\", \"private\").", + "type": "string" } }, "type": "object" @@ -409,10 +423,18 @@ jobs: "description": "Any workarounds, manual steps, or alternative approaches the user could take (max 256 characters).", "type": "string" }, + "integrity": { + "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\").", + "type": "string" + }, "reason": { "description": "Explanation of why this tool is needed or what information you want to share about the limitation (max 256 characters).", "type": "string" }, + "secrecy": { + "description": "Confidentiality level of the message content (e.g., \"public\", \"internal\", \"private\").", + "type": "string" + }, "tool": { "description": "Optional: Name or description of the missing tool or capability (max 128 characters). Be specific about what functionality is needed.", "type": "string" @@ -430,9 +452,17 @@ jobs: "inputSchema": { "additionalProperties": false, "properties": { + "integrity": { + "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\").", + "type": "string" + }, "message": { "description": "Status or completion message to log. Should explain what was analyzed and the outcome (e.g., 'Code review complete - no issues found', 'Analysis complete - all tests passing').", "type": "string" + }, + "secrecy": { + "description": "Confidentiality level of the message content (e.g., \"public\", \"internal\", \"private\").", + "type": "string" } }, "required": [ @@ -459,9 +489,17 @@ jobs: "description": "Type or description of the missing data or information (max 128 characters). Be specific about what data is needed.", "type": "string" }, + "integrity": { + "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\").", + "type": "string" + }, "reason": { "description": "Explanation of why this data is needed to complete the task (max 256 characters).", "type": "string" + }, + "secrecy": { + "description": "Confidentiality level of the message content (e.g., \"public\", \"internal\", \"private\").", + "type": "string" } }, "required": [], @@ -626,10 +664,11 @@ jobs: export MCP_GATEWAY_API_KEY export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" + export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288" export DEBUG="*" export GH_AW_ENGINE="copilot" - export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_LOCKDOWN -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.1.5' + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_LOCKDOWN -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.1.8' mkdir -p /home/runner/.copilot cat << GH_AW_MCP_CONFIG_EOF | bash /opt/gh-aw/actions/start_mcp_gateway.sh @@ -637,7 +676,7 @@ jobs: "mcpServers": { "github": { "type": "stdio", - "container": "ghcr.io/github/github-mcp-server:v0.31.0", + "container": "ghcr.io/github/github-mcp-server:v0.32.0", "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", "GITHUB_READ_ONLY": "1", @@ -660,17 +699,11 @@ jobs: } } GH_AW_MCP_CONFIG_EOF - - name: Generate workflow overview - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 - with: - script: | - const { generateWorkflowOverview } = require('/opt/gh-aw/actions/generate_workflow_overview.cjs'); - await generateWorkflowOverview(core); - - name: Download prompt artifact - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + - name: Download activation artifact + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8 with: - name: prompt - path: /tmp/gh-aw/aw-prompts + name: activation + path: /tmp/gh-aw - name: Clean git credentials run: bash /opt/gh-aw/actions/clean_git_credentials.sh - name: Execute GitHub Copilot CLI @@ -679,21 +712,37 @@ jobs: timeout-minutes: 10 run: | set -o pipefail - sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.20.2 --skip-pull --enable-api-proxy \ - -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-all-tools --allow-all-paths --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_AGENT_COPILOT:+ --model "$GH_AW_MODEL_AGENT_COPILOT"}' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + touch /tmp/gh-aw/agent-step-summary.md + # shellcheck disable=SC1003 + sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.23.0 --skip-pull --enable-api-proxy \ + -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-all-tools --allow-all-paths --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json - GH_AW_MODEL_AGENT_COPILOT: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} + GH_AW_PHASE: agent GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_VERSION: v0.57.2 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] XDG_CONFIG_HOME: /home/runner + - name: Detect inference access error + id: detect-inference-error + if: always() + continue-on-error: true + run: bash /opt/gh-aw/actions/detect_inference_access_error.sh - name: Configure Git credentials env: REPO_NAME: ${{ github.repository }} @@ -747,9 +796,12 @@ jobs: SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Append agent step summary + if: always() + run: bash /opt/gh-aw/actions/append_agent_step_summary.sh - name: Upload Safe Outputs if: always() - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: safe-output path: ${{ env.GH_AW_SAFE_OUTPUTS }} @@ -771,13 +823,13 @@ jobs: await main(); - name: Upload sanitized agent output if: always() && env.GH_AW_AGENT_OUTPUT - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: agent-output path: ${{ env.GH_AW_AGENT_OUTPUT }} if-no-files-found: warn - name: Upload engine output files - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: agent_outputs path: | @@ -822,12 +874,11 @@ jobs: - name: Upload agent artifacts if: always() continue-on-error: true - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: agent-artifacts path: | /tmp/gh-aw/aw-prompts/prompt.txt - /tmp/gh-aw/aw_info.json /tmp/gh-aw/mcp-logs/ /tmp/gh-aw/sandbox/firewall/logs/ /tmp/gh-aw/agent-stdio.log @@ -897,17 +948,28 @@ jobs: timeout-minutes: 20 run: | set -o pipefail - sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,raw.githubusercontent.com,registry.npmjs.org,telemetry.enterprise.githubcopilot.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.20.2 --skip-pull --enable-api-proxy \ - -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(wc)'\'' --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_DETECTION_COPILOT:+ --model "$GH_AW_MODEL_DETECTION_COPILOT"}' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + touch /tmp/gh-aw/agent-step-summary.md + # shellcheck disable=SC1003 + sudo -E awf --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,raw.githubusercontent.com,registry.npmjs.org,telemetry.enterprise.githubcopilot.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.23.0 --skip-pull --enable-api-proxy \ + -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(wc)'\'' --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - GH_AW_MODEL_DETECTION_COPILOT: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }} + GH_AW_PHASE: detection GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_VERSION: v0.57.2 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] XDG_CONFIG_HOME: /home/runner - name: Parse threat detection results id: parse_detection_results @@ -921,7 +983,7 @@ jobs: await main(); - name: Upload threat detection log if: always() && steps.detection_guard.outputs.run_detection == 'true' - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: threat-detection.log path: /tmp/gh-aw/threat-detection/detection.log @@ -959,22 +1021,27 @@ jobs: discussions: write issues: write pull-requests: write + concurrency: + group: "gh-aw-conclusion-issue-triage" + cancel-in-progress: false outputs: noop_message: ${{ steps.noop.outputs.noop_message }} tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} total_count: ${{ steps.missing_tool.outputs.total_count }} steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + uses: github/gh-aw/actions/setup@32b3a711a9ee97d38e3989c90af0385aff0066a7 # v0.57.2 with: destination: /opt/gh-aw/actions - name: Download agent output artifact + id: download-agent-output continue-on-error: true - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8 with: name: agent-output path: /tmp/gh-aw/safeoutputs/ - name: Setup agent output environment variable + if: steps.download-agent-output.outcome == 'success' run: | mkdir -p /tmp/gh-aw/safeoutputs/ find "/tmp/gh-aw/safeoutputs/" -type f -print @@ -1021,9 +1088,12 @@ jobs: GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} GH_AW_WORKFLOW_ID: "issue-triage" - GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.agent.outputs.secret_verification_result }} + GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} + GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} GH_AW_GROUP_REPORTS: "false" + GH_AW_FAILURE_REPORT_AS_ISSUE: "true" + GH_AW_TIMEOUT_MINUTES: "10" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -1053,31 +1123,14 @@ jobs: pre_activation: runs-on: ubuntu-slim - permissions: - discussions: write - issues: write - pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} matched_command: '' steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + uses: github/gh-aw/actions/setup@32b3a711a9ee97d38e3989c90af0385aff0066a7 # v0.57.2 with: destination: /opt/gh-aw/actions - - name: Add eyes reaction for immediate feedback - id: react - if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 - env: - GH_AW_REACTION: "eyes" - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); - await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 @@ -1102,6 +1155,7 @@ jobs: pull-requests: write timeout-minutes: 15 env: + GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage" GH_AW_ENGINE_ID: "copilot" GH_AW_WORKFLOW_ID: "issue-triage" GH_AW_WORKFLOW_NAME: "Agentic Triage" @@ -1110,22 +1164,26 @@ jobs: outputs: code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} + comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }} + comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }} create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@fad43e3c91a4e1d43e458f68e96574127934e7d1 # v0.50.1 + uses: github/gh-aw/actions/setup@32b3a711a9ee97d38e3989c90af0385aff0066a7 # v0.57.2 with: destination: /opt/gh-aw/actions - name: Download agent output artifact + id: download-agent-output continue-on-error: true - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8 with: name: agent-output path: /tmp/gh-aw/safeoutputs/ - name: Setup agent output environment variable + if: steps.download-agent-output.outcome == 'success' run: | mkdir -p /tmp/gh-aw/safeoutputs/ find "/tmp/gh-aw/safeoutputs/" -type f -print @@ -1135,7 +1193,10 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"add_labels\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{}}" + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"footer\":false,\"max\":1},\"add_labels\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -1145,7 +1206,7 @@ jobs: await main(); - name: Upload safe output items manifest if: always() - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: safe-output-items path: /tmp/safe-output-items.jsonl diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index ed491938d33..906b5ac8506 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -24,6 +24,7 @@ safe-outputs: add-labels: max: 5 add-comment: + footer: false tools: web-fetch: From 645562ed07473b81e846ebd65f9b1c8926a87758 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 10:27:59 -0400 Subject: [PATCH 05/18] improve repro? --- .github/workflows/issue-triage.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 906b5ac8506..ba922d0c59f 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -21,10 +21,11 @@ permissions: read-all network: defaults safe-outputs: + messages: + footer: "> Generated by [{workflow_name}]({run_url})" add-labels: max: 5 add-comment: - footer: false tools: web-fetch: @@ -47,6 +48,7 @@ You're a triage assistant for the TypeSpec GitHub repository. Your task is to an ## Available Labels To find the available labels for this repository, read the file `eng/common/config/labels.ts` in the repository. This file contains all the label definitions organized by category: + - **Area labels** (`AreaLabels`): Used to categorize which area of the codebase the issue belongs to (e.g. `compiler:core`, `emitter:openapi3`, `ide`, etc.). Always try to assign the most specific area label that matches. - **Issue kind labels** (`issue_kinds`): Used to classify the type of issue (`bug`, `feature`, `docs`). - Other label categories are defined there as well. @@ -79,11 +81,28 @@ Only use labels defined in that file. 5. Apply the selected labels using the `add_labels` tool. If no labels are clearly applicable, do not apply any. -6. Add an issue comment with your analysis: +6. For bug reports, extract reproduction information from the issue body and comments: + + **Playground links**: Search for URLs matching `https://typespec.io/playground?...`. These may appear as: + - Markdown links: `[text](https://typespec.io/playground?...)` + - HTML anchor tags: `...` + - Plain URLs in the text + + **TypeSpec code blocks**: Look for fenced code blocks with language tags `typespec` or `tsp`. Also check unlabeled/unmarked code blocks that contain TypeSpec keywords such as `import`, `model`, `op`, `namespace`, `using`, `interface`, `enum`, `union`, `scalar`, or decorators starting with `@`. + + **Ignore non-TypeSpec code blocks**: Skip blocks tagged as `yaml`, `json`, `python`, `js`, `ts`, `typescript`, `csharp`, `bash`, `shell`, `xml`, `html`, etc. β€” unless they are clearly the reproduction input for a converter bug (e.g., OpenAPI JSON for an `openapi3:converter` issue). + + Skip this step entirely for feature requests and documentation issues. + +7. Add an issue comment with your analysis: - Start with "🎯 Issue Triage" - Provide a brief summary of the issue + - For bug reports, include a **Reproduction** section: + - If a playground link was found, include it as a clickable link: `[Playground Link](url)` + - If TypeSpec code blocks were found, note that reproduction code is present in the issue + - If neither was found, flag it: "⚠️ No reproduction provided β€” a minimal repro would help diagnose this issue" - Mention any relevant details that might help the team understand the issue better - - Include any debugging strategies or reproduction steps if applicable + - Include any debugging strategies if applicable - If appropriate, break the issue down into sub-tasks and write a checklist - Use collapsed-by-default sections in the GitHub markdown to keep the comment tidy. Collapse all sections except the short main summary at the top. - Do NOT include any text about agentic workflows, how to install them, or any self-promotional content about the tooling used to generate this comment. Do NOT mention that this triage was performed by an AI, bot, or agent. From 8caabae5e2be0b7fcc9d7b3ce9ac15e3ee73e265 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 10:41:23 -0400 Subject: [PATCH 06/18] regen --- .github/workflows/issue-triage.lock.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index db738c97129..0a76d9fb43c 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"d59118088248d557e2b4a069b72c49a300beed7675827ceca209d42c91eeaa1f","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"8c3c163bd230b3025f1e730c361343d1a4bf77f2c2fc6c014cddbf69f220572d","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -1091,6 +1091,7 @@ jobs: GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\"}" GH_AW_GROUP_REPORTS: "false" GH_AW_FAILURE_REPORT_AS_ISSUE: "true" GH_AW_TIMEOUT_MINUTES: "10" @@ -1157,6 +1158,7 @@ jobs: env: GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage" GH_AW_ENGINE_ID: "copilot" + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\"}" GH_AW_WORKFLOW_ID: "issue-triage" GH_AW_WORKFLOW_NAME: "Agentic Triage" GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" @@ -1196,7 +1198,7 @@ jobs: GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"footer\":false,\"max\":1},\"add_labels\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"add_labels\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | From d0a589e4aa1b8d4b16e49275a7caef8e2b61a47e Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 10:58:35 -0400 Subject: [PATCH 07/18] Better display? --- .github/workflows/issue-triage.md | 57 ++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index ba922d0c59f..a159fb66811 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -94,15 +94,48 @@ Only use labels defined in that file. Skip this step entirely for feature requests and documentation issues. -7. Add an issue comment with your analysis: - - Start with "🎯 Issue Triage" - - Provide a brief summary of the issue - - For bug reports, include a **Reproduction** section: - - If a playground link was found, include it as a clickable link: `[Playground Link](url)` - - If TypeSpec code blocks were found, note that reproduction code is present in the issue - - If neither was found, flag it: "⚠️ No reproduction provided β€” a minimal repro would help diagnose this issue" - - Mention any relevant details that might help the team understand the issue better - - Include any debugging strategies if applicable - - If appropriate, break the issue down into sub-tasks and write a checklist - - Use collapsed-by-default sections in the GitHub markdown to keep the comment tidy. Collapse all sections except the short main summary at the top. - - Do NOT include any text about agentic workflows, how to install them, or any self-promotional content about the tooling used to generate this comment. Do NOT mention that this triage was performed by an AI, bot, or agent. +7. Add an issue comment with your analysis using this structure: + + ``` + 🎯 **Issue Triage** + + + + **Category**: Bug / Feature Request / Docs / Question + **Area**: `` (or "Unable to determine") + + + + πŸ”— [Playground Reproduction](url) + + βœ… Reproduction code provided in the issue. + + ⚠️ No reproduction provided. A minimal repro would help diagnose this issue. + +
+ πŸ” Analysis + + - relevant technical details + - affected components + - potential root cause if apparent + - related issues if found (link to them) + +
+ + +
+ πŸ“ Suggested next steps + + - [ ] step 1 + - [ ] step 2 + +
+ ``` + + Rules for the comment: + - Keep the top-level summary OUTSIDE any collapsed section so it's always visible + - Collapse everything else inside `
` sections + - Be concise β€” avoid filler phrases and unnecessary verbosity + - Skip the "Reproduction" section entirely for feature requests and docs issues + - Skip "Suggested next steps" if there's nothing actionable to suggest + - Do NOT include any text about agentic workflows, how to install them, or any self-promotional content. Do NOT mention AI, bots, or agents. From 1fbdcdce02c857141c6576bfaf1046873764565c Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 11:18:06 -0400 Subject: [PATCH 08/18] fix? --- .github/workflows/issue-triage.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index a159fb66811..72fd73a8f30 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -92,11 +92,18 @@ Only use labels defined in that file. **Ignore non-TypeSpec code blocks**: Skip blocks tagged as `yaml`, `json`, `python`, `js`, `ts`, `typescript`, `csharp`, `bash`, `shell`, `xml`, `html`, etc. β€” unless they are clearly the reproduction input for a converter bug (e.g., OpenAPI JSON for an `openapi3:converter` issue). + **Clean up the reproduction code**: If you found repro code, prepare a cleaned-up version: + - Ensure it is properly formatted in a ` ```typespec ` fenced code block + - Remove unnecessary comments, extra whitespace, or unrelated code + - Add missing `import` or `using` statements if they are clearly needed + - Keep it minimal β€” only the code needed to demonstrate the issue + - Do NOT change the semantics of the reproduction + Skip this step entirely for feature requests and documentation issues. 7. Add an issue comment with your analysis using this structure: - ``` + ```` 🎯 **Issue Triage** @@ -107,14 +114,22 @@ Only use labels defined in that file. πŸ”— [Playground Reproduction](url) - - βœ… Reproduction code provided in the issue. ⚠️ No reproduction provided. A minimal repro would help diagnose this issue. + +
- πŸ” Analysis + πŸ“‹ Reproduction code + ```typespec + // cleaned-up reproduction code here + ```` + +
+ +
+ πŸ” Analysis - relevant technical details - affected components - potential root cause if apparent @@ -125,7 +140,6 @@ Only use labels defined in that file.
πŸ“ Suggested next steps - - [ ] step 1 - [ ] step 2 From 6247a4af410913309e2b6843701b5e8f4dbd22ad Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 11:20:30 -0400 Subject: [PATCH 09/18] tweaks --- .github/workflows/issue-triage.lock.yml | 6 +++--- .github/workflows/issue-triage.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 0a76d9fb43c..9cd0cf4d6a1 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"8c3c163bd230b3025f1e730c361343d1a4bf77f2c2fc6c014cddbf69f220572d","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"8762d9903d1079ff9990a02718b73858827db8568433eb7bb232c5446d0d4c13","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -1091,7 +1091,7 @@ jobs: GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} - GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\"}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{}" GH_AW_GROUP_REPORTS: "false" GH_AW_FAILURE_REPORT_AS_ISSUE: "true" GH_AW_TIMEOUT_MINUTES: "10" @@ -1158,7 +1158,7 @@ jobs: env: GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage" GH_AW_ENGINE_ID: "copilot" - GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\"}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{}" GH_AW_WORKFLOW_ID: "issue-triage" GH_AW_WORKFLOW_NAME: "Agentic Triage" GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 72fd73a8f30..685730546b9 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -22,7 +22,7 @@ network: defaults safe-outputs: messages: - footer: "> Generated by [{workflow_name}]({run_url})" + footer-install: "" add-labels: max: 5 add-comment: From e8f4b8803eeafcb2304668919de51bc890d5c26f Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 11:31:11 -0400 Subject: [PATCH 10/18] compile --- .github/workflows/issue-triage.lock.yml | 6 +++--- .github/workflows/issue-triage.md | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 9cd0cf4d6a1..b561b719267 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"8762d9903d1079ff9990a02718b73858827db8568433eb7bb232c5446d0d4c13","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"37675d05a546c8a580c64b5e5135a769f16e486ed55dc6348ba3ce0f9facb7c3","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -1091,7 +1091,7 @@ jobs: GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} - GH_AW_SAFE_OUTPUT_MESSAGES: "{}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\".\"}" GH_AW_GROUP_REPORTS: "false" GH_AW_FAILURE_REPORT_AS_ISSUE: "true" GH_AW_TIMEOUT_MINUTES: "10" @@ -1158,7 +1158,7 @@ jobs: env: GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage" GH_AW_ENGINE_ID: "copilot" - GH_AW_SAFE_OUTPUT_MESSAGES: "{}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\".\"}" GH_AW_WORKFLOW_ID: "issue-triage" GH_AW_WORKFLOW_NAME: "Agentic Triage" GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 685730546b9..b6e43843708 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -22,7 +22,8 @@ network: defaults safe-outputs: messages: - footer-install: "" + footer: "> Generated by [{workflow_name}]({run_url})" + footer-install: "." add-labels: max: 5 add-comment: From 9763c3c7e5a55dace3145f9ac2a1dac9a9890198 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 11:47:18 -0400 Subject: [PATCH 11/18] try again --- .github/workflows/issue-triage.lock.yml | 6 +-- .github/workflows/issue-triage.md | 66 +++++++++---------------- 2 files changed, 27 insertions(+), 45 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index b561b719267..2b57bed9719 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"37675d05a546c8a580c64b5e5135a769f16e486ed55dc6348ba3ce0f9facb7c3","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"e8f92fca0ba8c7c26ae4d31cb42d38344432f98c9b498307d4c1dae4c35c091b","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -1091,7 +1091,7 @@ jobs: GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} - GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\".\"}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\"\\u003c!-- --\\u003e\"}" GH_AW_GROUP_REPORTS: "false" GH_AW_FAILURE_REPORT_AS_ISSUE: "true" GH_AW_TIMEOUT_MINUTES: "10" @@ -1158,7 +1158,7 @@ jobs: env: GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage" GH_AW_ENGINE_ID: "copilot" - GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\".\"}" + GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e Generated by [{workflow_name}]({run_url})\",\"footerInstall\":\"\\u003c!-- --\\u003e\"}" GH_AW_WORKFLOW_ID: "issue-triage" GH_AW_WORKFLOW_NAME: "Agentic Triage" GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f" diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index b6e43843708..fff5f90bdc5 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -23,7 +23,7 @@ network: defaults safe-outputs: messages: footer: "> Generated by [{workflow_name}]({run_url})" - footer-install: "." + footer-install: "" # Need this as empty string will still include it add-labels: max: 5 add-comment: @@ -94,63 +94,45 @@ Only use labels defined in that file. **Ignore non-TypeSpec code blocks**: Skip blocks tagged as `yaml`, `json`, `python`, `js`, `ts`, `typescript`, `csharp`, `bash`, `shell`, `xml`, `html`, etc. β€” unless they are clearly the reproduction input for a converter bug (e.g., OpenAPI JSON for an `openapi3:converter` issue). **Clean up the reproduction code**: If you found repro code, prepare a cleaned-up version: - - Ensure it is properly formatted in a ` ```typespec ` fenced code block - Remove unnecessary comments, extra whitespace, or unrelated code - Add missing `import` or `using` statements if they are clearly needed - Keep it minimal β€” only the code needed to demonstrate the issue - Do NOT change the semantics of the reproduction + - Do NOT add backtick characters or any markdown formatting inside the code itself β€” the code must be valid TypeSpec - Skip this step entirely for feature requests and documentation issues. - -7. Add an issue comment with your analysis using this structure: - - ```` - 🎯 **Issue Triage** + **Construct a playground link**: If the issue has reproduction TypeSpec code (either found or cleaned up) but no playground link, construct one using this URL format: + `https://typespec.io/playground?c={encoded}` where `{encoded}` is the repro code URL-encoded (percent-encoded). Use `web-fetch` to verify the playground link works by fetching it. - - - **Category**: Bug / Feature Request / Docs / Question - **Area**: `` (or "Unable to determine") + Skip this step entirely for feature requests and documentation issues. - - - πŸ”— [Playground Reproduction](url) - - ⚠️ No reproduction provided. A minimal repro would help diagnose this issue. +7. Add an issue comment with your analysis. The comment MUST follow this exact structure: - - -
- πŸ“‹ Reproduction code + **Line 1**: `🎯 **Issue Triage**` - ```typespec - // cleaned-up reproduction code here - ```` + **Lines 2-3**: One or two sentence summary of the issue. -
+ **Line 4**: `**Category**: Bug` (or Feature Request / Docs / Question) -
- πŸ” Analysis - - relevant technical details - - affected components - - potential root cause if apparent - - related issues if found (link to them) + **Line 5**: `**Area**: \`\`` (or "Unable to determine") -
+ **Reproduction block** (bugs only, skip for feature requests and docs): + - If a playground link was found or constructed, show it: `πŸ”— [Playground Reproduction](url)` + - If repro code exists but no playground link could be made: `βœ… Reproduction code provided in the issue.` + - If no repro code was found at all: `⚠️ No reproduction provided. A minimal repro would help diagnose this issue.` + - If repro code was found, ALWAYS include it in a collapsed section using a `
` tag with summary `πŸ“‹ Reproduction code`. Inside, put the cleaned-up code in a fenced code block with the `typespec` language tag. The code inside the block must be plain TypeSpec β€” do NOT add backtick characters, markdown formatting, or any escaping inside the code itself. - -
- πŸ“ Suggested next steps - - [ ] step 1 - - [ ] step 2 + **Analysis section**: A collapsed `
` tag with summary `πŸ” Analysis` containing: + - Relevant technical details + - Affected components + - Potential root cause if apparent + - Related issues if found (link to them) -
- ``` + **Next steps section** (optional β€” only if there are actionable items): A collapsed `
` tag with summary `πŸ“ Suggested next steps` containing a checklist. Rules for the comment: - - Keep the top-level summary OUTSIDE any collapsed section so it's always visible - - Collapse everything else inside `
` sections + - Keep the summary, category, area, and reproduction link OUTSIDE any collapsed section so they're always visible + - Collapse analysis and next steps inside `
` sections - Be concise β€” avoid filler phrases and unnecessary verbosity - - Skip the "Reproduction" section entirely for feature requests and docs issues + - Skip the reproduction block entirely for feature requests and docs issues - Skip "Suggested next steps" if there's nothing actionable to suggest - Do NOT include any text about agentic workflows, how to install them, or any self-promotional content. Do NOT mention AI, bots, or agents. From 9121c4584b3307b3abbf9e2b3f8dac3197d129dd Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 12:38:16 -0400 Subject: [PATCH 12/18] try more exact repro --- .github/workflows/issue-triage.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index fff5f90bdc5..571c5ed2779 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -89,18 +89,13 @@ Only use labels defined in that file. - HTML anchor tags: `...` - Plain URLs in the text - **TypeSpec code blocks**: Look for fenced code blocks with language tags `typespec` or `tsp`. Also check unlabeled/unmarked code blocks that contain TypeSpec keywords such as `import`, `model`, `op`, `namespace`, `using`, `interface`, `enum`, `union`, `scalar`, or decorators starting with `@`. + **TypeSpec code**: Look for TypeSpec reproduction code anywhere in the issue β€” it may be inside fenced code blocks (tagged as `typespec`, `tsp`, or unlabeled) OR it may be plain text in the issue body (not wrapped in any code block at all). Recognize TypeSpec code by keywords like `import`, `model`, `op`, `namespace`, `using`, `interface`, `enum`, `union`, `scalar`, or decorators starting with `@`. **Ignore non-TypeSpec code blocks**: Skip blocks tagged as `yaml`, `json`, `python`, `js`, `ts`, `typescript`, `csharp`, `bash`, `shell`, `xml`, `html`, etc. β€” unless they are clearly the reproduction input for a converter bug (e.g., OpenAPI JSON for an `openapi3:converter` issue). - **Clean up the reproduction code**: If you found repro code, prepare a cleaned-up version: - - Remove unnecessary comments, extra whitespace, or unrelated code - - Add missing `import` or `using` statements if they are clearly needed - - Keep it minimal β€” only the code needed to demonstrate the issue - - Do NOT change the semantics of the reproduction - - Do NOT add backtick characters or any markdown formatting inside the code itself β€” the code must be valid TypeSpec + **Extract the reproduction code verbatim**: Copy the TypeSpec code exactly as the user wrote it. Do not modify the code. Do not add or remove any characters. Do not add backticks, markdown formatting, or escaping to the code content. The only change you should make is minor cleanup: removing trailing whitespace or blank lines at the start/end. - **Construct a playground link**: If the issue has reproduction TypeSpec code (either found or cleaned up) but no playground link, construct one using this URL format: + **Construct a playground link**: If the issue has reproduction TypeSpec code but no playground link, construct one using this URL format: `https://typespec.io/playground?c={encoded}` where `{encoded}` is the repro code URL-encoded (percent-encoded). Use `web-fetch` to verify the playground link works by fetching it. Skip this step entirely for feature requests and documentation issues. @@ -117,9 +112,8 @@ Only use labels defined in that file. **Reproduction block** (bugs only, skip for feature requests and docs): - If a playground link was found or constructed, show it: `πŸ”— [Playground Reproduction](url)` - - If repro code exists but no playground link could be made: `βœ… Reproduction code provided in the issue.` - If no repro code was found at all: `⚠️ No reproduction provided. A minimal repro would help diagnose this issue.` - - If repro code was found, ALWAYS include it in a collapsed section using a `
` tag with summary `πŸ“‹ Reproduction code`. Inside, put the cleaned-up code in a fenced code block with the `typespec` language tag. The code inside the block must be plain TypeSpec β€” do NOT add backtick characters, markdown formatting, or any escaping inside the code itself. + - If repro code was found, include it in a collapsed section using a `
` tag with summary `πŸ“‹ Reproduction code`. Inside, put the code in a fenced code block with the `typespec` language tag. The code inside MUST be the verbatim TypeSpec code from the issue β€” do NOT add backtick characters, markdown syntax, or any escaping inside the code content itself. Only the surrounding fenced code block markers should use backticks. **Analysis section**: A collapsed `
` tag with summary `πŸ” Analysis` containing: - Relevant technical details From e9091fe40de796fef713c00249ae6b5d2e24b84d Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 13:13:30 -0400 Subject: [PATCH 13/18] tweaks --- .github/workflows/issue-triage.lock.yml | 4 ++-- .github/workflows/issue-triage.md | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 2b57bed9719..9117ad2f5d0 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"e8f92fca0ba8c7c26ae4d31cb42d38344432f98c9b498307d4c1dae4c35c091b","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"937c3f847d9037c9be40e3851882b69b2d9d5da6af0fe8edd36a5b9923463695","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -344,7 +344,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' - {"add_comment":{"max":1},"add_labels":{"max":5},"missing_data":{},"missing_tool":{},"noop":{"max":1}} + {"add_comment":{"max":1},"add_labels":{"max":5},"mentions":{"enabled":true},"missing_data":{},"missing_tool":{},"noop":{"max":1}} GH_AW_SAFE_OUTPUTS_CONFIG_EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'GH_AW_SAFE_OUTPUTS_TOOLS_EOF' [ diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 571c5ed2779..c05452deead 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -21,6 +21,7 @@ permissions: read-all network: defaults safe-outputs: + mentions: true messages: footer: "> Generated by [{workflow_name}]({run_url})" footer-install: "" # Need this as empty string will still include it @@ -93,7 +94,11 @@ Only use labels defined in that file. **Ignore non-TypeSpec code blocks**: Skip blocks tagged as `yaml`, `json`, `python`, `js`, `ts`, `typescript`, `csharp`, `bash`, `shell`, `xml`, `html`, etc. β€” unless they are clearly the reproduction input for a converter bug (e.g., OpenAPI JSON for an `openapi3:converter` issue). - **Extract the reproduction code verbatim**: Copy the TypeSpec code exactly as the user wrote it. Do not modify the code. Do not add or remove any characters. Do not add backticks, markdown formatting, or escaping to the code content. The only change you should make is minor cleanup: removing trailing whitespace or blank lines at the start/end. + **Clean up the reproduction code**: If you found repro code, prepare a cleaned-up version: + - Remove unnecessary comments, extra whitespace, or unrelated code + - Add missing `import` or `using` statements if they are clearly needed + - Keep it minimal β€” only the code needed to demonstrate the issue + - Do NOT change the semantics of the reproduction **Construct a playground link**: If the issue has reproduction TypeSpec code but no playground link, construct one using this URL format: `https://typespec.io/playground?c={encoded}` where `{encoded}` is the repro code URL-encoded (percent-encoded). Use `web-fetch` to verify the playground link works by fetching it. From 8541511f8d277804f763b0d902946e46ca41af98 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 15:25:06 -0400 Subject: [PATCH 14/18] revert --- .github/workflows/issue-triage.lock.yml | 4 ++-- .github/workflows/issue-triage.md | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 9117ad2f5d0..2b57bed9719 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -29,7 +29,7 @@ # # Source: githubnext/agentics/workflows/issue-triage.md@346204513ecfa08b81566450d7d599556807389f # -# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"937c3f847d9037c9be40e3851882b69b2d9d5da6af0fe8edd36a5b9923463695","compiler_version":"v0.57.2","strict":true} +# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"e8f92fca0ba8c7c26ae4d31cb42d38344432f98c9b498307d4c1dae4c35c091b","compiler_version":"v0.57.2","strict":true} name: "Agentic Triage" "on": @@ -344,7 +344,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' - {"add_comment":{"max":1},"add_labels":{"max":5},"mentions":{"enabled":true},"missing_data":{},"missing_tool":{},"noop":{"max":1}} + {"add_comment":{"max":1},"add_labels":{"max":5},"missing_data":{},"missing_tool":{},"noop":{"max":1}} GH_AW_SAFE_OUTPUTS_CONFIG_EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'GH_AW_SAFE_OUTPUTS_TOOLS_EOF' [ diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index c05452deead..7285c59ab10 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -21,7 +21,6 @@ permissions: read-all network: defaults safe-outputs: - mentions: true messages: footer: "> Generated by [{workflow_name}]({run_url})" footer-install: "" # Need this as empty string will still include it From 068a051ffbd7f73bd3c9d3c84a99b486ec487739 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 16:41:38 -0400 Subject: [PATCH 15/18] duplicate test --- .github/workflows/issue-triage.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 7285c59ab10..a2e5ef7aee4 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -62,10 +62,15 @@ Only use labels defined in that file. 2. Gather additional context about the issue: - Fetch any comments on the issue using the `get_issue_comments` tool - - Find similar issues if needed using the `search_issues` tool - - List the issues to see other open issues in the repository using the `list_issues` tool -3. Analyze the issue content, considering: +3. **Duplicate detection**: Search for existing issues that may cover the same problem. + - Extract 2-3 distinct keyword queries from the issue title and body (e.g., key error messages, feature names, affected components). + - Use `search_issues` with each query, scoped to this repo. Include both open and closed issues. + - For each candidate match, compare the core problem described β€” not just surface keywords. Two issues are duplicates only if they describe the **same root cause or request**, not merely the same topic area. + - If you find a likely duplicate (open or recently closed), note its number and title. Prefer open issues as the canonical duplicate. + - If no strong match is found, move on β€” do not force a duplicate match. + +4. Analyze the issue content, considering: - The issue title and description - The type of issue (bug report, feature request, question, etc.) - Technical areas mentioned (packages, emitters, libraries, tools) @@ -73,16 +78,15 @@ Only use labels defined in that file. - User impact - Components affected -4. Select appropriate labels based on the labels defined in `eng/common/config/labels.ts`: +5. Select appropriate labels based on the labels defined in `eng/common/config/labels.ts`: - Pick ONE area label that best matches the issue. If the issue spans multiple areas, pick the most relevant one. If no area label is clearly applicable, do not add one. - Pick ONE issue kind label (`bug`, `feature`, or `docs`) if the type is clear. - - Search for similar issues, and if you find a closely matching OPEN issue, consider using a "duplicate" label. - Only use labels that are defined in the labels configuration file. - It's okay to not add any labels if none are clearly applicable. -5. Apply the selected labels using the `add_labels` tool. If no labels are clearly applicable, do not apply any. +6. Apply the selected labels using the `add_labels` tool. If no labels are clearly applicable, do not apply any. -6. For bug reports, extract reproduction information from the issue body and comments: +7. For bug reports, extract reproduction information from the issue body and comments: **Playground links**: Search for URLs matching `https://typespec.io/playground?...`. These may appear as: - Markdown links: `[text](https://typespec.io/playground?...)` @@ -104,7 +108,7 @@ Only use labels defined in that file. Skip this step entirely for feature requests and documentation issues. -7. Add an issue comment with your analysis. The comment MUST follow this exact structure: +8. Add an issue comment with your analysis. The comment MUST follow this exact structure: **Line 1**: `🎯 **Issue Triage**` @@ -114,6 +118,11 @@ Only use labels defined in that file. **Line 5**: `**Area**: \`\`` (or "Unable to determine") + **Duplicate block** (only if a likely duplicate was found in step 3): + - `πŸ” **Possible duplicate of #** β€” ` + - If the duplicate is closed/resolved, add: `(closed)` + - If multiple strong candidates exist, list up to 3. + **Reproduction block** (bugs only, skip for feature requests and docs): - If a playground link was found or constructed, show it: `πŸ”— [Playground Reproduction](url)` - If no repro code was found at all: `⚠️ No reproduction provided. A minimal repro would help diagnose this issue.` From 38ac99a3784ce36104894d8cf54be5198a709ee1 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 17:27:45 -0400 Subject: [PATCH 16/18] fix format --- .prettierignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index 472b01a94f2..21817985a66 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,7 +12,7 @@ pnpm-lock.yaml # Agentic workflow lock file -.lock.yml +**/*.lock.yml # Emu spec file, formatting is wrong packages/spec/src/spec.emu.html From e503cf7bc4dc906bf7790a1127a479b685c6f446 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 17:29:42 -0400 Subject: [PATCH 17/18] fix --- cspell.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspell.yaml b/cspell.yaml index b65389923bb..c51a79c9867 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -337,7 +337,7 @@ ignorePaths: - packages/mutator-framework/**/*.test.ts - packages/typespec-vscode/test/scenarios/** - pnpm-lock.yaml - - .lock.yml + - "**/*.lock.yml" - "**/*.mp4" - "**/*.plist" - .git/** From d68d207142b005d7a094004e622e3987f39c8f67 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 11 Mar 2026 17:30:01 -0400 Subject: [PATCH 18/18] fix --- cspell.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cspell.yaml b/cspell.yaml index c51a79c9867..af97c349f93 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -5,15 +5,16 @@ dictionaries: - node - typescript words: + - Ablack - Adoptium - agentic + - agentics - aiohttp - alzimmer - amqp - AQID - Arize - arizeaiobservabilityeval - - Ablack - arraya - astimezone - astro @@ -36,11 +37,11 @@ words: - cadl - cadleditor - cadleng - - Cblack - - Cbrown - cadlplayground - canidae - canonicalizer + - Cblack + - Cbrown - clsx - cobertura - codehaus @@ -158,9 +159,9 @@ words: - mspaint - MSRC - msrest - - muscidae - multis - munge + - muscidae - mylib - myname - mypy @@ -195,8 +196,8 @@ words: - openapiv - Packument - Perfolizer - - pkgs - picocolors + - pkgs - pnpx - posargs - primitivea @@ -360,7 +361,7 @@ patterns: pattern: "/Authorization: Basic\\s+\\S+/g" - name: Todo description: Ignore TODO comments with usernames - pattern: "/TODO[\\/\\s\\(][a-zA-Z0-9_-]+/g" + pattern: /TODO[\/\s\(][a-zA-Z0-9_-]+/g ignoreRegExpList: - cursortest - Authorization_Basic