Preserve app-server thread working directories across platforms (#62375)

## Why

A remote app server can report a working directory in a different path
convention from the client. Decoding a Windows drive path as a client-native
absolute path can make a Unix client reject the thread response.

## What changed

Keep thread `cwd` values as server-native strings in summaries, settings,
and start, resume, and fork responses. Preserve the JSON and generated SDK
types. In the TUI, store the session directory as a `PathUri` using the
server's path convention when available. Use that directory to match diff
and skill results and to display the project name in the terminal title.

## Testing

Add regression coverage for foreign-path response round trips, diff results
matched against a remote session directory, and terminal titles derived
from a Windows path. Verify that the server rejects a working directory
that cannot be encoded as UTF-8.

GitOrigin-RevId: 600f0b531939db4cd4ec884de166224082995e00
This commit is contained in:
Eric Traut
2026-11-18 22:13:26 +00:00
committed by copyberry
parent fecf5cc672
commit b82943092c
111 changed files with 720 additions and 479 deletions
@@ -196,7 +196,9 @@ pub struct ThreadStartResponse {
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
#[serde(default)]
pub disabled_plugin_ids: Vec<String>,
pub cwd: AbsolutePathBuf,
#[schemars(with = "AbsolutePathBuf")]
#[ts(as = "AbsolutePathBuf")]
pub cwd: LegacyAppPathString,
/// Thread-scoped runtime workspace roots used to materialize
/// `:workspace_roots`.
#[experimental("thread/start.runtimeWorkspaceRoots")]
@@ -314,7 +316,9 @@ pub struct ThreadSettings {
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
#[serde(default)]
pub disabled_plugin_ids: Vec<String>,
pub cwd: AbsolutePathBuf,
#[schemars(with = "AbsolutePathBuf")]
#[ts(as = "AbsolutePathBuf")]
pub cwd: LegacyAppPathString,
/// Environments configured for future turns, in priority order, primary first.
/// `null` means the server does not expose the selection; [] means none are selected.
#[experimental("thread/settings.environments")]
@@ -455,7 +459,9 @@ pub struct ThreadResumeResponse {
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
#[serde(default)]
pub disabled_plugin_ids: Vec<String>,
pub cwd: AbsolutePathBuf,
#[schemars(with = "AbsolutePathBuf")]
#[ts(as = "AbsolutePathBuf")]
pub cwd: LegacyAppPathString,
/// Thread-scoped runtime workspace roots used to materialize
/// `:workspace_roots`.
#[experimental("thread/resume.runtimeWorkspaceRoots")]
@@ -672,7 +678,9 @@ pub struct ThreadForkResponse {
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
#[serde(default)]
pub disabled_plugin_ids: Vec<String>,
pub cwd: AbsolutePathBuf,
#[schemars(with = "AbsolutePathBuf")]
#[ts(as = "AbsolutePathBuf")]
pub cwd: LegacyAppPathString,
/// Thread-scoped runtime workspace roots used to materialize
/// `:workspace_roots`.
#[experimental("thread/fork.runtimeWorkspaceRoots")]