# How to use GitHub Copilot to fix async overflow

Stephen Toub gave Copilot a BufferedStream arithmetic bug and a synchronous fix pattern; the agent patched the async path and added large-buffer coverage.

Agent: GitHub Copilot (via Copilot coding agent)
Tools: GitHub Copilot, BufferedStream, C#, GitHub
Category: Software & DevOps
Date: 2026-01-06

Outcome: Stephen Toub gave Copilot a BufferedStream arithmetic bug and a synchronous fix pattern; the agent patched the async path and added large-buffer coverage; the pull request merged into dotnet/runtime main.

## Steps

1. Used author-specified signed-arithmetic root cause.
2. Matched unsigned cast already used by synchronous write path.
3. Added large-buffer async regression coverage.

Human oversight: Human supplied concrete arithmetic fix, reviewed and merged.

Source: [Copilot (on behalf of stephentoub) on GitHub](https://github.com/dotnet/runtime/pull/122944)

Canonical URL: https://agentsinuse.com/use-cases/github-copilot-to-fix-async-overflow/
