Skip to content

Retire completed non-PTY shell output resources#327233

Merged
anthonykim1 merged 1 commit into
mainfrom
anthonykim1/retireCompletedNonPtyShellOutput
Jul 24, 2026
Merged

Retire completed non-PTY shell output resources#327233
anthonykim1 merged 1 commit into
mainfrom
anthonykim1/retireCompletedNonPtyShellOutput

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Resolves: #327178
Follow-up to: #327067

  • Add idempotent retirement for completed non-PTY shell output resources, removing both the host resource and its tracked stream.
  • Publish the final ChatToolCallComplete result before retiring the live output resource so completed rendering has an authoritative static result.
  • Retire only when both an exit code and preview are available; an empty preview still counts as authoritative.
  • Keep background and no-preview output streams session-owned until normal session disposal.
  • Prevent completed static non-PTY results from attaching to an already-retired URI, while preserving normal turn-owned cleanup for attachments created during streaming.
  • Add coverage for distinct shell-call URIs, empty previews, background output, session cleanup, completed history, and PTY compatibility.

Inspirations from:

@anthonykim1 anthonykim1 added this to the 1.131.0 milestone Jul 24, 2026
@anthonykim1 anthonykim1 self-assigned this Jul 24, 2026
Copilot AI review requested due to automatic review settings July 24, 2026 02:24
@anthonykim1
anthonykim1 marked this pull request as ready for review July 24, 2026 02:25
@anthonykim1 anthonykim1 changed the title Retire completed non PTY shell output resources Retire completed non-PTY shell output resources Jul 24, 2026
@anthonykim1
anthonykim1 enabled auto-merge (squash) July 24, 2026 02:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Retires completed non-PTY shell output resources once authoritative static results are available, preventing per-session resource growth.

Changes:

  • Adds idempotent host-side retirement after publishing completion.
  • Avoids attaching completed static results to retired resources.
  • Expands lifecycle and compatibility coverage.
Show a summary per file
File Description
agentHostChatContribution.test.ts Tests static rendering and attachment cleanup.
agentHostSessionHandler.ts Skips live attachment for authoritative static results.
copilotAgentSession.test.ts Covers retirement and retained-stream scenarios.
copilotNonPtyShellTerminals.ts Implements retirement and tracking cleanup.
copilotAgentSession.ts Retires resources after publishing completion.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Medium

@anthonykim1
anthonykim1 merged commit 29215ba into main Jul 24, 2026
30 checks passed
@anthonykim1
anthonykim1 deleted the anthonykim1/retireCompletedNonPtyShellOutput branch July 24, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Dispose non-PTY shell output resources after command completion

3 participants