Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Fix streaming output corruption with copilot #1261

Merged
merged 3 commits into from
Mar 14, 2025
Merged

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Mar 10, 2025

  • Shortcut other steps if one holds the output - We had a bug in the output pipeline where if one step returned [] meaning that the output chunk should be held off, all the current chunks would continue to run and potentially modify the context.
  • Shortcut buffered PII sooner, as soon as the buffer can't be a UUID - Our PII refaction format is #UUID#. Our code was finding an opening #, then checking for a closing matching # or end of the output. For copilot, however, this meant that we were buffering the whole file, because the filename comes in this format:
# filepath: /Users/jakub/devel/demo-repo-python/app.py

This means we would keep searching for the closing hash which never
came. Instead, buffer only as long as the context between the hashes can
reasonably be a UUID.

Fixes: #1250

@jhrozek
Copy link
Contributor Author

jhrozek commented Mar 10, 2025

@blkt I can rebase this atop replace-litellm if you prefer

JAORMX
JAORMX previously approved these changes Mar 11, 2025
jhrozek added 2 commits March 12, 2025 22:31
We had a bug in the output pipeline where if one step returned []
meaning that the output chunk should be held off, all the current chunks
would continue to run and potentially modify the context.
Our PII refaction format is `#UUID#`. Our code was finding an opening #,
then checking for a closing matching # or end of the output. For
copilot, however, this meant that we were buffering the whole file,
because the filename comes in this format:

```
```

This means we would keep searching for the closing hash which never
came. Instead, buffer only as long as the context between the hashes can
reasonably be a UUID.

Fixes: #1250
@jhrozek
Copy link
Contributor Author

jhrozek commented Mar 12, 2025

just rebased atop Rado's test fix

@jhrozek jhrozek merged commit de09cad into main Mar 14, 2025
11 checks passed
@jhrozek jhrozek deleted the copilot_secrets_out_bug branch March 14, 2025 08:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

codegate garbles output on main
2 participants