Task Diff
Return the diff for a task's working branch against the base ref.
Strategy: 1. Resolve the working branch from the task's assigned_agent -- agent/<session-id>. If no agent is assigned (or the branch does not exist yet), fall back to git diff HEAD so the user still sees uncommitted scratch work. 2. Run git diff <base>...<branch> (three-dot, symmetric difference relative to the merge base) and parse the output into a structured per-file representation. 3. Cap the unified diff at _DIFF_MAX_BYTES to keep payloads sane.
The sync _run_git helper is reused (it is also called from other sync helpers in this module). To keep the event loop responsive under load (issue #1723) every blocking _run_git invocation is offloaded to the default executor via asyncio.to_thread. The helper itself stays sync so non-route callers keep working.
Path parameters
Response
Successful Response