Add cwd-relative turn diff paths (#39625)

## What changed

- Add the opt-in `cwd_relative_turn_diffs` feature.
- When enabled, render turn diff paths relative to each selected environment's
  working directory instead of the detected Git root.
- Preserve repository-root-relative paths when the feature is disabled.

## Testing

- Cover enabled and disabled behavior for nested working directories across
  supported originators.

GitOrigin-RevId: 8b4908706a82b01f33ccd035b0945f9a29fce26f
This commit is contained in:
philn-oai
2026-08-20 06:52:01 +00:00
committed by copyberry
parent 52e387daca
commit e396ef3fc1
5 changed files with 154 additions and 1 deletions
+21 -1
View File
@@ -223,7 +223,27 @@ pub(crate) async fn run_turn(
// Keep the exact model-visible state used by this turn and its inline compactions.
let (world_state, display_roots) = tokio::join!(
sess.record_context_updates_and_set_reference_context_item(first_step_context.as_ref()),
turn_diff_display_roots(first_step_context.as_ref()),
async {
if first_step_context
.turn
.config
.features
.enabled(Feature::CwdRelativeTurnDiffs)
{
first_step_context
.environments
.turn_environments()
.map(|environment| {
(
environment.selection().environment_id,
environment.cwd().clone(),
)
})
.collect()
} else {
turn_diff_display_roots(first_step_context.as_ref()).await
}
},
);
let mut world_state = world_state?;