agent_ui: Keep pending subagent edits when regenerating a prompt (#59060)

Fixes the agent panel silently reverting all pending subagent file
changes when an earlier message is edited and regenerated.

`ThreadView::regenerate` decides whether to auto-keep pending edits from
earlier prompts (behavior introduced in #43347) by scanning the parent
thread's entries for diffs. Subagent edits never appear there — they are
only forwarded to the parent's action log via the linked-log mechanism —
so the auto-keep step was skipped and `rewind`'s unscoped
`reject_all_edits` reverted all of them on disk, without confirmation.

The fix treats any earlier subagent tool call as potentially having
edits, so they get auto-kept just like direct edits from earlier
prompts. Keeping all edits is a no-op when the subagent made none. Edits
produced by the prompt being regenerated are still auto-rejected,
consistent with existing behavior.

Also adds a regression test
(`test_regenerate_keeps_pending_subagent_edits`) that reproduces the
full flow — subagent edit forwarded through a linked action log,
follow-up prompt, regenerate — and fails with the exact reported data
loss without the fix.

Closes AI-386

Closes https://github.com/zed-industries/zed/issues/58932

Release Notes:

- Fixed pending subagent file changes being discarded when editing an
earlier message in the agent panel.
c78bd36fd8MartinYe1234 committed on 6/10/2026, 10:54:28 PM· committed by GitHubparent501ab50
2 files changedLine totals unavailable