Expose loaded thread environments in app-server responses (#42386)

## What changed

- Add the experimental `Thread.environments` field with each selected environment's ID, working directory, and runtime workspace roots.
- Populate the field from live thread state in start, resume, read, list, and unarchive responses. Use `null` for unloaded threads and an empty list when a loaded thread has no environment selection.
- Document that the field reports selection rather than connection status and does not affect executor selection or resume behavior.

## Testing

- Cover selection updates, unloaded and resumed threads, loaded pathless unarchives, and clients that subscribe after environment connection notifications.

GitOrigin-RevId: a6daa06aff7089d7c5a1e4c7d03109b41f12fa3c
This commit is contained in:
Anton Panasenko authored and copyberry committed 2026-09-02 23:41:14 +00:00
1 parent cff76fa96f
commit 2b554fd3f9
42 files changed
+681 -11

No files matched your search

+3
View File
@@ -4039,6 +4039,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
agent_thread_id,
ServerNotification::ThreadStarted(ThreadStartedNotification {
thread: Thread {
environments: None,
id: agent_thread_id.to_string(),
extra: None,
session_id: agent_thread_id.to_string(),
@@ -4140,6 +4141,7 @@ async fn inactive_thread_started_notification_preserves_primary_model_when_path_
agent_thread_id,
ServerNotification::ThreadStarted(ThreadStartedNotification {
thread: Thread {
environments: None,
id: agent_thread_id.to_string(),
extra: None,
session_id: agent_thread_id.to_string(),
@@ -4208,6 +4210,7 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {
app.primary_session_configured = Some(primary_session);
let thread = Thread {
environments: None,
id: read_thread_id.to_string(),
extra: None,
session_id: read_thread_id.to_string(),