Improve experience when shell output exceeds runtime streaming limits in agent host sessions
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Follow-up from https://github.com/microsoft/vscode/issues/328299 — streaming was fixed by #328351 and layout by #328592; this covers what the user is left with when a command's output exceeds what the runtime streams.
**Behavior per output size (current):**
| Output size | While streaming | On finish |
|---|---|---|
| < ~10KiB | full output appends live ✅ | full output ✅ |
| ~10–20KiB | first ~10KiB + one truncation marker, no flicker ✅ (bytes past 10KiB aren't streamed by the runtime) | final preview applied; completeness in this band depends on model-facing caps |
| > ~20KiB (runtime spill) | head + marker + stitched rolling tails accumulate ✅ | ❌ replaced by a 500-char stub — this issue |
**Repro:** in a Copilot agent host session (non-pty built-in shell) with the output preview expanded, run something producing >20KiB, e.g. `gh run watch --repo microsoft/vscode --exit-status` for ~2 minutes, or `for i in $(seq 1 3000); do echo "line $i padding padding padding"; sleep 0.005; done`
**Today's experience at completion:**
1. The card replaces everything that streamed with the runtime's completion text — strictly less content than was on screen a second earlier, and the same after window reload.
2. That text does say the output was too large, but it's written for the model, not the user: tool guidance like "Consider using grep, head/tail, view_range…" and a saved-file path as inert text you'd have to select and copy by hand.
**Why it happens:** `shell_exit` is currently omitted from external completion events, so `outputTruncated` arrives unknowable and `NonPtyShellTerminalStreams.completeToolCall` treats the completion preview as authoritative and rewrites the channel; independently, the retained static result the card renders post-completion and post-reload only ever carries that preview. This is also why model-facing prose appears in the card at all — the structured `shell_exit` carries a clean raw-output preview plus an explicit truncated flag, while the fallback can only harvest the text written for the model.
**Looking ahead:** once the `shell_exit` API is restored to external sessions, the completion preview becomes a clean 500-char head of raw output — meaning the "Output too large…" text disappears from the card entirely, and with it the only hint that anything is missing. At that point a deliberate truncation experience (clear indicator, access to the full saved output) stops being polish and becomes required, or truncation turns fully silent.
Contributor guide
Assessment
This issue has not been assessed yet.