Skip to content

Fix get_task_output empty results for background tasks while preserving single-run reused terminal behavior#304124

Merged
meganrogge merged 2 commits intomerogge/task-output-fixfrom
copilot/sub-pr-304097
Mar 23, 2026
Merged

Fix get_task_output empty results for background tasks while preserving single-run reused terminal behavior#304124
meganrogge merged 2 commits intomerogge/task-output-fixfrom
copilot/sub-pr-304097

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

get_task_output returned empty output for background/watch tasks because output collection started from a fresh end-of-buffer marker rather than the existing terminal content.

Changes:

  • Type safety: Changed startMarkersByTerminalInstanceId map type from typeof terminals[number]['registerMarker'] (brittle, breaks if terminals includes undefined) to Map<number, IXtermMarker | undefined>, matching the stable type used in taskHelpers.ts
  • Leak fix: Wrapped collectTerminalResults and its post-processing in try/finally so store.dispose() always runs even when collectTerminalResults throws — aligning with runTaskTool.ts and createAndRunTaskTool.ts
  • Core fix: For background tasks, passes a startMarkersByTerminalInstanceId map with per-terminal entries set to undefined, causing collectTerminalResults to read from the full current buffer instead of a newly created end-of-buffer marker; single-run tasks retain existing marker behavior to avoid pulling in unrelated prior output from reused terminals

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Fix get task output empty results for background tasks Fix get_task_output empty results for background tasks while preserving single-run reused terminal behavior Mar 23, 2026
Copilot AI requested a review from meganrogge March 23, 2026 15:56
@meganrogge meganrogge marked this pull request as ready for review March 23, 2026 16:20
@meganrogge meganrogge merged commit 4c4a419 into merogge/task-output-fix Mar 23, 2026
4 of 5 checks passed
@meganrogge meganrogge deleted the copilot/sub-pr-304097 branch March 23, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants