Live streaming for Task API cloud agent sessions (#319077)
* Live streaming for Task API cloud agent sessions Adds TaskTurnStreamer to incrementally push v2 Task API events into vscode.ChatResponseStream for both initial open (mode: 'current') and follow-up sends (mode: 'next'), mirroring the v1 JobsApiBackend SSE flow. Key design (modelled after github-ui/agent-sessions): - Eager tool rendering from assistant.message.toolRequests, since tool.execution_complete does not fire for many agent-host-synthesised setup ops (run_setup, run_custom_setup_step). - Per-messageId content dedup: Task API sends progressive snapshots, not deltas; only the suffix is fed to the renderer. - Intermediate assistant.message.content (content + toolRequests in the same event) is suppressed; only pure-text assistant messages (the final reply of the turn) are rendered as markdown. - Default 'Working...' progress label until the first assistant.intent arrives. - Bounded poll loop: exits on terminal state, cancellation, or MAX_CONSECUTIVE_FETCH_FAILURES. - Follow-up (mode: 'next') only advances when task.sessions.length grows, to avoid premature exit when trailing prior-turn events arrive between the snapshot and sendFollowUpToTask resolving. ChatSessionContentBuilder updates: - buildTaskHistory: single-pass turn split + bootstrap event suppression. - buildTaskResponseTurn: mirrors the live rules (eager tool rendering, intermediate-narration suppression, dedup with live cards) so the refresh() after streaming is idempotent. - parseToolCallDetails: friendly cards for run_setup, run_custom_setup_step, report_intent. - toFileLabel: handles v1 (/home/runner/work/...) and v2 (/tmp/workspace/..., /workspace/...) layouts. * Address PR review: parallelize fetches, fix stale comment, add Task API history tests - Parallelize fetchTask/fetchEvents with Promise.all in both the main poll loop and _waitForTurnStart so each poll only pays the slower of the two requests. - Update StreamBaseline JSDoc to reflect that phase 1 (mode: 'next') unblocks only on turnCount > priorTurnCount, not 'any unseen event'. - Add unit tests covering the new Task API history rules: bootstrap suppression, turn-boundary split, eager tool rendering with execution_complete dedup, intermediate-narration suppression, and the synthesised-turn fallback when no user.message has arrived. * Readme update
O
Osvaldo Ortega committed
ab9265248ff8f2f10a3664a8cce948483a03d8f6
Parent: 3425c04
Committed by GitHub <noreply@github.com>
on 5/30/2026, 2:16:51 AM