Skip to content

Add runtime_instructions system message section to all SDKs#1377

Merged
stephentoub merged 3 commits into
mainfrom
stephentoub/add-runtime-instructions-support
May 22, 2026
Merged

Add runtime_instructions system message section to all SDKs#1377
stephentoub merged 3 commits into
mainfrom
stephentoub/add-runtime-instructions-support

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Motivation

The latest copilot-agent-runtime introduced a new runtime_instructions system 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_instructions section identifier to all SDKs (except Java, which was excluded from this work):

  • Node.js: Added to the SystemMessageSection type union and SYSTEM_MESSAGE_SECTIONS constant with a descriptive comment
  • Python: Added to the SystemMessageSection Literal type and SYSTEM_MESSAGE_SECTIONS dictionary
  • Go: Added SectionRuntimeInstructions constant; also added doc comments to all existing section constants (previously undocumented)
  • .NET: Added SystemMessageSection.RuntimeInstructions; refactored the type from a static class with string constants to a string-backed struct pattern (matching ToolBinaryResultType, CopilotLogLevel, etc.) for better type safety when used as dictionary keys in SystemMessageConfig.Sections
  • Rust: Comment-only update (Rust SDK uses raw strings for section IDs with no predefined constants)

Additional cleanup

Renamed SystemPromptSection/SYSTEM_PROMPT_SECTIONS to SystemMessageSection/SYSTEM_MESSAGE_SECTIONS across all SDKs for consistency -- these are sections of SystemMessageConfig, not "prompt" sections.

All SDK builds verified passing (Go, .NET, Node.js TypeScript check).

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>
@stephentoub stephentoub requested a review from a team as a code owner May 22, 2026 13:35
Copilot AI review requested due to automatic review settings May 22, 2026 13:35
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_instructions section identifier to the known section ID sets/unions in Node.js, Python, Go, and .NET.
  • Renames SystemPromptSection/SYSTEM_PROMPT_SECTIONS to SystemMessageSection/SYSTEM_MESSAGE_SECTIONS (and equivalent) for consistency.
  • Refactors .NET section IDs to a string-backed SystemMessageSection struct 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

Comment thread dotnet/README.md Outdated
@stephentoub
Copy link
Copy Markdown
Collaborator Author

@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>
@github-actions

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>
@github-actions
Copy link
Copy Markdown
Contributor

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 SystemPromptSection(s)SystemMessageSection(s) and the addition of runtime_instructions are applied consistently in all five SDKs.

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:

  1. Missing runtime_instructions constantSystemPromptSections in Java (java/src/main/java/com/github/copilot/sdk/json/SystemPromptSections.java) does not have a RUNTIME_INSTRUCTIONS = "runtime_instructions" constant.

  2. Stale naming — The Java class is still called SystemPromptSections (and its Javadoc refers to "system prompt sections"), while every other SDK has been updated to SystemMessageSection(s).

These are known deferred items. A follow-up issue/PR to bring Java into alignment would be worth tracking to avoid long-lived divergence.

Generated by SDK Consistency Review Agent for issue #1377 · ● 7.3M ·

@stephentoub stephentoub merged commit 85d91ca into main May 22, 2026
47 of 48 checks passed
@stephentoub stephentoub deleted the stephentoub/add-runtime-instructions-support branch May 22, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants