Report workspace kind on TUI composer turns (#63545)

## Why

A TUI composer prompt does not supply `workspace_kind`. The app server
can derive it from the thread's current project assignment.

## What changed

Use the staged assignment until the thread is saved, then read the
persisted assignment on each new composer turn. Use `project` or
`projectless` as a fallback for model request metadata and turn analytics.
Explicit client metadata takes precedence, and the inferred value stays
with the originating turn.

## Testing

Cover the model request header and analytics event on the first turn,
on a follow-up, and after removing the project assignment. Unit tests
cover explicit metadata precedence and verify that MCP requests,
extensions, and child agents do not inherit the inferred value.

GitOrigin-RevId: 62b88484dd4028a6b72584999e0fa9b84e6e3b03
This commit is contained in:
marksteinbrick-oai
2026-11-24 05:33:38 +00:00
committed by copyberry
parent a90526e8a7
commit baf9b39b16
7 changed files with 182 additions and 0 deletions
+2
View File
@@ -291,6 +291,8 @@ pub enum PromptCacheTtl {
/// child input, Core also compares root lineage to detect ambiguity.
#[derive(Clone, Debug, Default)]
pub struct TurnStartOptions {
/// Fallback workspace kind for the new turn's model requests and analytics.
pub inferred_workspace_kind: Option<String>,
/// Source classification for this request. Recorded on new turns and captured
/// as input provenance when steering, without changing the active turn's trigger.
pub turn_trigger: Option<String>,