Skip to content

fix(copilot): strip replayed thinking blocks#92830

Merged
steipete merged 1 commit into
mainfrom
fix/github-copilot-replay-thinking
Jun 14, 2026
Merged

fix(copilot): strip replayed thinking blocks#92830
steipete merged 1 commit into
mainfrom
fix/github-copilot-replay-thinking

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • strip thinking and redacted_thinking blocks from every GitHub Copilot Claude replay turn through the provider-owned sanitizer
  • apply the same cleanup to the final Copilot Anthropic request payload, including tool continuations
  • preserve thinking-only assistant turns as [assistant reasoning omitted]
  • leave shared replay helpers and official OpenAI/Anthropic provider behavior unchanged

This is a smaller current-main replacement for #87060 and #81534, based on Gio Della-Libera's provider-owned fix direction.

Fixes #81520

Real behavior proof

Behavior addressed: GitHub Copilot Claude rejects follow-up requests when prior assistant thinking blocks are replayed.

Real environment tested: macOS checkout on commit 19bd9a205d; authenticated GitHub Copilot Anthropic Messages request against api.individual.githubcopilot.com; official OpenAI and Anthropic gateway agent/tool probes.

Exact steps or command run after this patch: focused GitHub Copilot tests; production/test typing; touched-file format/lint; live Copilot replay harness with an intentionally invalid prior thinking signature; gateway live model suite narrowed to openai/gpt-5.5 and anthropic/claude-sonnet-4-6.

Evidence after fix: Copilot claude-haiku-4.5 sent a three-message follow-up payload with payloadContainsThinking: false and returned exactly COPILOT_REPLAY_OK. The GitHub Copilot suite passed 10 files / 106 tests. Official Anthropic passed prompt, read, exec+read, image, and refusal/tool-continuation probes. Official OpenAI passed prompt, read, exec+read, and image probes.

Observed result after fix: Copilot receives no replayed thinking content, while visible assistant text, tool calls/results, and turn structure remain intact.

What was not tested: other account-gated Copilot Claude models were not available. The existing OpenAI tool-call-only edge probe timed out and was skipped after the normal OpenAI tool probes passed; that current-main behavior is separate from this Copilot-only diff and will be investigated independently.

Verification

  • pnpm test extensions/github-copilot -> 10 files, 106 tests passed
  • pnpm tsgo
  • pnpm check:test-types
  • touched-file oxfmt and type-aware oxlint
  • git diff --check
  • live Copilot Claude second-turn replay -> pass
  • live official OpenAI/Anthropic gateway tool probes -> pass as detailed above
  • autoreview -> no actionable findings

Co-authored-by: Gio Della-Libera [email protected]

@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(copilot): strip replayed thinking blocks This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for SHA 19bd9a205dd9756e9576b463938ad16d84af6ba1:

  • GitHub Copilot plugin suite: pnpm test extensions/github-copilot -> 10 files, 106 tests passed.
  • Production/test typing: pnpm tsgo and pnpm check:test-types passed.
  • Touched-file formatting, type-aware lint, and git diff --check passed.
  • Live GitHub Copilot Claude replay: claude-haiku-4.5 against api.individual.githubcopilot.com; three-message follow-up payload had payloadContainsThinking: false and returned exactly COPILOT_REPLAY_OK.
  • Live official Anthropic gateway proof: claude-sonnet-4-6 passed prompt, read, exec+read, image, and refusal/tool-continuation probes.
  • Live official OpenAI gateway proof: gpt-5.5 passed prompt, read, exec+read, and image probes. The separate pre-existing tool-call-only edge probe timed out and was skipped by the harness; this Copilot-only diff does not touch OpenAI code.
  • Blacksmith Testbox-through-Crabbox changed gate: tbx_01kv1y891esg8hpdzsvjy6dxxp, Actions run 27485567834, exit 0, Testbox stopped.
  • Autoreview: no accepted/actionable findings; patch correct at 0.9 confidence.
  • Final GitHub CI: CI run 27485506614, 128 successful checks overall, zero pending/failures, merge state clean.

Known proof gaps: no live account access to other Copilot Claude model ids; no native cross-OS app flow. The exact affected Copilot Anthropic transport and both official provider tool paths were exercised live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Reasoning model thinking blocks (<thinking> tags) in conversation history cause HTTP 400 on GitHub Copilot provider

1 participant