Pair thread environment settings (#26687)

## Why

Thread cwd and environment selections are a single logical setting in
core: updating one without the other can silently desynchronize the
next-turn execution context. This change makes that relationship
explicit in the internal thread settings flow while preserving the
existing app-server public API shape.

## What changed

- Moved the cwd/environment pair through internal
`ThreadSettingsOverrides.environment_settings` instead of a top-level
internal `cwd` field.
- Kept `thread/settings/update` public params unchanged, with app-server
translating top-level `cwd` into the paired internal settings shape.
- Moved `Op::UserInput` environment overrides into thread settings so
user turns and settings updates use the same core path.
- Updated core, app-server, MCP, memories, sample, and test callsites to
construct the paired settings shape.

## Verification

- `git diff --check`
- Local test run starting after PR creation.
This commit is contained in:
pakrym-oai authored and GitHub committed 2026-06-08 13:55:15 -07:00
1 parent f9a680b907
commit f3c1283411
90 files changed
+521 -820

No files matched your search

@@ -767,7 +767,7 @@ pub(crate) async fn apply_bespoke_event_handling(
let requested_permissions = request.permissions.clone();
let request_cwd = match request.cwd.clone() {
Some(cwd) => cwd,
None => conversation.config_snapshot().await.cwd,
None => conversation.config_snapshot().await.cwd().clone(),
};
let params = PermissionsRequestApprovalParams {
thread_id: conversation_id.to_string(),
@@ -1161,7 +1161,7 @@ pub(crate) async fn apply_bespoke_event_handling(
return;
}
};
let fallback_cwd = conversation.config_snapshot().await.cwd;
let fallback_cwd = conversation.config_snapshot().await.cwd().clone();
let stored_thread = match conversation
.read_thread(
/*include_archived*/ true, /*include_history*/ true,