Skip to content

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

Merged
meganrogge merged 2 commits intomainfrom
merogge/task-output-fix
Mar 23, 2026
Merged

Fix get_task_output empty results for background tasks while preserving single-run reused terminal behavior#304097
meganrogge merged 2 commits intomainfrom
merogge/task-output-fix

Conversation

@meganrogge
Copy link
Copy Markdown
Collaborator

Fixes #304057.

get_task_output could return empty output even when the task terminal had content because output collection could start from a fresh marker created at read time, which for completed/background tasks can point to the end of the buffer.

Now, in getTaskOutputTool, pass a start-marker map only for background tasks. For those background/watch tasks, set each terminal entry to undefined so collection reads the current terminal buffer instead of from a newly created marker.

Keep existing behavior for single-run tasks, so reused-terminal protection remains and old buffer content is not pulled in.

Copilot AI review requested due to automatic review settings March 23, 2026 14:45
@meganrogge meganrogge self-assigned this Mar 23, 2026
@meganrogge meganrogge added the candidate Issue identified as probable candidate for fixing in the next release label Mar 23, 2026
@meganrogge meganrogge added this to the 1.113.0 milestone Mar 23, 2026
@meganrogge meganrogge removed the candidate Issue identified as probable candidate for fixing in the next release label Mar 23, 2026
@meganrogge meganrogge enabled auto-merge (squash) March 23, 2026 14:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes get_task_output returning empty output for background/watch tasks by controlling the start marker behavior used when collecting terminal buffer contents.

Changes:

  • For background tasks, passes a startMarkersByTerminalInstanceId map to collectTerminalResults with per-terminal entries set to undefined so output reads from the current terminal buffer (instead of from a newly created end-of-buffer marker).
  • Preserves existing marker behavior for non-background (single-run) tasks to avoid pulling in unrelated old buffer content when terminals are reused.

@meganrogge
Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

@meganrogge I've opened a new pull request, #304124, to work on those changes. Once the pull request is ready, I'll request review from you.

@meganrogge meganrogge merged commit c685394 into main Mar 23, 2026
19 checks passed
@meganrogge meganrogge deleted the merogge/task-output-fix branch March 23, 2026 16:35
@meganrogge meganrogge modified the milestones: 1.113.0, 1.114.0 Mar 23, 2026
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.

Copilot Task output tool always comes back empty

4 participants