Preserve thread context when retrying or editing turns (#33211)

## What changed

- Add experimental `beforeTurnId` support to `thread/fork` for copying history strictly before a turn, including an in-progress turn.
- Use before-turn forks for TUI backtracking and safety retries so the replacement prompt retains thread context instead of recreating the branch from the preceding turn or a new thread.
- Add experimental `deferGoalContinuation` support so safety-retry forks can inherit an active goal while waiting for the replacement turn before automatic continuation resumes.
- Hide duplicated nested-review prompts when replaying history or selecting a prompt to edit.

## Testing

- Cover before-turn truncation, fork validation, active-goal inheritance, TUI safety retries, backtracking, and nested-review replay.

GitOrigin-RevId: 4915d85ae1929a0b8c40f3ed7dca29c7a5bdcdf3
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-07-15 02:35:49 +00:00
1 parent e4711f2a3b
commit d88db19144
25 files changed
+1343 -96

No files matched your search

@@ -0,0 +1,7 @@
---
source: tui/src/app/tests/safety_buffering.rs
expression: rendered_retry
---
› Handle the safety-buffered request
Keep the accepted steer
• done