Add runtime_instructions system message section to all SDKs#1377
Conversation
Add support for the new runtime_instructions section added by the latest copilot-agent-runtime. This section targets runtime-provided context and instructions assembled from sources such as systemMessage.content, system notifications, memories, workspace context, mode-specific instructions, and content-exclusion policy. Changes across SDKs (excluding Java): - Node.js: Add to SystemMessageSection type union and SYSTEM_MESSAGE_SECTIONS - Python: Add to SystemMessageSection Literal type and SYSTEM_MESSAGE_SECTIONS - Go: Add SectionRuntimeInstructions constant with doc comments on all constants - .NET: Add SystemMessageSection.RuntimeInstructions using string-backed struct pattern (replaces former static class with string constants) - Rust: Comment-only update (uses raw strings, no predefined constants) Also renames SystemPromptSection/SYSTEM_PROMPT_SECTIONS to SystemMessageSection/SYSTEM_MESSAGE_SECTIONS across all SDKs for consistency, since these are sections of SystemMessageConfig. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Adds support for the new runtime_instructions system message section across the SDKs (excluding Java) so consumers can override/transform runtime-assembled context, and standardizes terminology from “system prompt sections” to “system message sections”.
Changes:
- Adds the
runtime_instructionssection identifier to the known section ID sets/unions in Node.js, Python, Go, and .NET. - Renames
SystemPromptSection/SYSTEM_PROMPT_SECTIONStoSystemMessageSection/SYSTEM_MESSAGE_SECTIONS(and equivalent) for consistency. - Refactors .NET section IDs to a string-backed
SystemMessageSectionstruct and updates usages/tests/docs accordingly.
Show a summary per file
| File | Description |
|---|---|
| rust/src/types.rs | Updates doc comment to “system message section” terminology. |
| python/copilot/session.py | Renames section type/constant and adds runtime_instructions to the known section list/metadata. |
| nodejs/src/types.ts | Renames section union/constant and adds runtime_instructions section metadata. |
| nodejs/src/index.ts | Updates public exports to the renamed section symbols. |
| nodejs/README.md | Updates customize-mode docs to new names and includes runtime_instructions in the listed IDs. |
| go/types.go | Adds SectionRuntimeInstructions and documents all section constants; updates terminology. |
| go/README.md | Updates customize-mode documentation to include SectionRuntimeInstructions. |
| dotnet/test/E2E/SystemMessageTransformE2ETests.cs | Updates tests to use SystemMessageSection as dictionary keys. |
| dotnet/test/E2E/SessionE2ETests.cs | Updates session customize test to use SystemMessageSection keys. |
| dotnet/src/Types.cs | Introduces SystemMessageSection string-backed struct, adds RuntimeInstructions, and updates SystemMessageConfig.Sections key type. |
| dotnet/src/Client.cs | Updates transform-callback extraction wiring to the new section key type. |
| dotnet/README.md | Updates customize-mode docs for the new key type and section list. |
| docs/getting-started.md | Updates the section ID list to include runtime_instructions. |
Copilot's findings
- Files reviewed: 13/13 changed files
- Comments generated: 1
|
@SteveSandersonMS FYI on the renames here. I started just by adding the new runtime_instructions section, but then noticed a) that in the C# it'd be better off with the more strongly-typed string-based enum pattern, and b) that in all the SDKs these settings are in "system message config" but the types were called "system prompt sections", so I renamed for consistency. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
The test's TryCreateGenericCollection only handled dictionaries with string keys. With SystemMessageSection now being a struct used as a dictionary key, the test fell through to the IEnumerable path which created a List<KeyValuePair<...>> incompatible with IDictionary<...>. Generalized the dictionary handling to support any key type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅ (with one known gap)The changes in this PR are well-coordinated across Node.js, Python, Go, .NET, and Rust. The rename from Java gap (noted as intentional in PR description)The Java SDK was explicitly excluded from this PR, leaving two inconsistencies relative to the other SDKs:
These are known deferred items. A follow-up issue/PR to bring Java into alignment would be worth tracking to avoid long-lived divergence.
|
Motivation
The latest copilot-agent-runtime introduced a new
runtime_instructionssystem message section that targets runtime-provided context assembled from multiple sources (systemMessage.content, system notifications, memories, workspace context, mode-specific instructions, and content-exclusion policy). The SDKs need to expose this new section so consumers can customize or transform it.Approach
Added the
runtime_instructionssection identifier to all SDKs (except Java, which was excluded from this work):SystemMessageSectiontype union andSYSTEM_MESSAGE_SECTIONSconstant with a descriptive commentSystemMessageSectionLiteral type andSYSTEM_MESSAGE_SECTIONSdictionarySectionRuntimeInstructionsconstant; also added doc comments to all existing section constants (previously undocumented)SystemMessageSection.RuntimeInstructions; refactored the type from a static class with string constants to a string-backed struct pattern (matchingToolBinaryResultType,CopilotLogLevel, etc.) for better type safety when used as dictionary keys inSystemMessageConfig.SectionsAdditional cleanup
Renamed
SystemPromptSection/SYSTEM_PROMPT_SECTIONStoSystemMessageSection/SYSTEM_MESSAGE_SECTIONSacross all SDKs for consistency -- these are sections ofSystemMessageConfig, not "prompt" sections.All SDK builds verified passing (Go, .NET, Node.js TypeScript check).