Add a feature flag for code-mode host output truncation (#58159)

## What changed

Add the disabled-by-default `code_mode_host_output_truncation` feature flag. When enabled, Core requests server-side output truncation for its built-in code-mode session providers over both stdio and gRPC. Injected providers retain control of their session settings, and explicit session options pass through unchanged.

## Testing

Add coverage for both transports verifying that the host's output-limit notice survives a zero-token observation budget. Extend the shared-provider test to exercise an injected provider with the new flag enabled.

GitOrigin-RevId: edbb65e930bf544e3d2f8384767037a6fb82d451
This commit is contained in:
Sean Huang
2026-10-29 19:29:05 +00:00
committed by copyberry
parent 7f1c09979c
commit fa4ebe87af
6 changed files with 119 additions and 6 deletions
+8
View File
@@ -150,6 +150,8 @@ pub enum Feature {
CodeModeHost,
/// Use gRPC over stdio for the process-owned code-mode host.
CodeModeHostGrpc,
/// Truncate output in the process-owned code-mode host before sending it to Core.
CodeModeHostOutputTruncation,
/// Establish the code-mode host connection during session startup.
CodeModePrewarm,
/// Terminate active code mode cells when their turn is interrupted.
@@ -1281,6 +1283,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CodeModeHostOutputTruncation,
key: "code_mode_host_output_truncation",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CodeModePrewarm,
key: "code_mode_prewarm",