Summary
When gpt-5.6-luna (or any GPT model routed through Copilot's Responses API, spec: "responses") is selected, requests fail mid-stream with:
Error: Cannot read properties of undefined (reading 'summaryParts')
Root cause
OpenAI's Responses API now emits response.reasoning_summary_part.added events (encrypted reasoning). The AI SDK parser (@ai-sdk/openai) tracks these via activeReasoning[item_id], keyed on each reasoning item's item_id.
GitHub Copilot has a known quirk of rotating item IDs across events for the same logical part. The provider's createCopilotStreamFixer() normalizes this id-rotation for text-* and reasoning-* events only — it does not handle reasoning_summary_part.added.
As a result, when a summary part arrives with an item_id the parser never saw a preceding reasoning output_item.added for, activeReasoning[value.item_id] is undefined, and the parser dereferences .summaryParts on it, throwing.
Where
- Package:
@byokkit/cmd-provider-copilot v0.1.1 (latest)
- File:
dist/chunk-KNVRT45Z.js → createCopilotStreamFixer()
- Crash origin:
@ai-sdk/openai/src/responses/openai-responses-language-model.ts:2117
activeReasoningPart.summaryParts[value.summary_index] = 'active';
Expected Behavior
The stream fixer should also normalize/forward reasoning_summary_part events (or drop them) so the activeReasoning map stays consistent despite Copilot's item-id rotation.
Actual Behavior
Selecting gpt-5.6-luna under the GitHub Copilot provider section in /model and sending a request results in the stream crashing mid-response with Error: Cannot read properties of undefined (reading 'summaryParts'). The error occurs after the model begins emitting reasoning content, and no completion is returned.
Steps to reproduce the issue
- Connect GitHub Copilot:
cmd login copilot and complete the device sign-in.
- Open
/model and navigate to the GitHub Copilot provider section.
- Select a GPT model routed through the Responses API (e.g.
gpt-5.6-luna).
- Send a prompt that triggers reasoning output (a multi-step coding or reasoning request).
- Observe the request fail mid-stream with
Error: Cannot read properties of undefined (reading 'summaryParts').
Command Code Version
1.32.1
Operating System
Linux
Terminal/IDE
Unknown
Shell
bash
Session file (optional)
{"type":"session","version":3,"id":"ee5b89bb-41b9-4af3-9fca-3bf8c053e049","timestamp":"2026-08-24T02:20:41.576Z","cwd":"/home/pbtrudel"}
{"type":"model_change","id":"e167ed7c","parentId":null,"timestamp":"2026-08-24T02:20:56.174Z","model":"gpt-5.6-luna"}
{"type":"message","id":"6d4fffc4","parentId":"e167ed7c","timestamp":"2026-08-24T02:21:14.501Z","message":{"role":"user","content":[{"type":"text","text":"test using the tools in this harness"}],"meta":{"source":"user","createdAt":1787538070623,"messageId":"7f845134-0ba2-4510-8493-92791e8207c3"}}}
{"type":"message","id":"13184e10","parentId":"6d4fffc4","timestamp":"2026-08-24T02:21:14.503Z","message":{"role":"user","content":[{"type":"text","text":"Error: Cannot read properties of undefined (reading 'summaryParts')\n\nType "continue" to try again. If the issue persists, contact support: https://commandcode.ai/discord\nTrace ID: 7557d41091117d424fe2669a7a3f3289"}],"meta":{"messageId":"9378126f-c2aa-4858-8f59-06c9f6923ac0"}}}
Fix prompt (optional)
You're fixing a crash in @byokkit/cmd-provider-copilot v0.1.1. When using a GPT model routed through Copilot's Responses API, requests fail mid-stream with Error: Cannot read properties of undefined (reading 'summaryParts'), originating in @ai-sdk/openai/src/responses/openai-responses-language-model.ts:2117.
Root cause: GitHub Copilot rotates item_id values across events for the same logical part. createCopilotStreamFixer() in dist/chunk-KNVRT45Z.js already normalizes this id rotation for text-* and reasoning-* events, but it does not cover the OpenAI Responses API's response.reasoning_summary_part.added events. When the AI SDK parser receives a reasoning_summary_part.added whose item_id it never saw, activeReasoning[value.item_id] is undefined, and dereferencing .summaryParts on it throws.
Task:
- Locate
createCopilotStreamFixer() in the package source and identify exactly which event types it currently remaps (confirm which ones are handled vs. skipped, and how the id remapping/normalization is implemented for the covered events).
- Extend the fixer to normalize
item_id for the reasoning_summary_part.* family — at minimum reasoning_summary_part.added and reasoning_summary_part.done, plus reasoning_summary_text if present — using the same id-rotation mapping strategy used for the existing reasoning-* events.
- Ensure the mapping persists keyed by the stable logical identity (not the rotating raw
item_id) so the parser's activeReasoning[...] entry exists by the time summaryParts is dereferenced.
- Build and verify the fix resolves the mid-stream crash; include a note if the Dist build (e.g.
dist/chunk-KNVRT45Z.js) needs regenerating or if the patch should target the source *.js/.ts that produces it.
Constraints: Minimal, surgical change only — do not refactor unrelated logic. Preserve existing event-ordering and stream-delivery semantics.
Additional context
-
Cover the full event family, not just .added. The parser path around line 2117 handles the whole reasoning-summary cluster:
response.reasoning_summary_part.added / response.reasoning_summary_part.done
response.reasoning_summary_text.delta / response.reasoning_summary_text.done
response.output_item.added / response.output_item.done (a reasoning item carries its summary array here)
response.reasoning.done (the encrypted reasoning item)
Any of these that carry a rotating item_id must be normalized together, or the crash just moves to the next event in the family.
-
Restore the exact invariant, not just the symptom. activeReasoning is keyed by item.id from response.output_item.added (type reasoning), then response.reasoning_summary_part.added pushes into activeReasoning[id].summaryParts. The fix must make those two events resolve to the same canonical id. Treating .added in isolation without reconciling output_item.added and .done will still leave ordering/state broken.
-
Repro data (ideal). Capture the raw SSE chunk sequence with the rotating item_id values from a failing request and paste the sequence in. Even a redacted two-event snippet — e.g. output_item.added {id: A} followed by reasoning_summary_part.added {item_id: B} — pins the bug and lets the agent write a deterministic unit test rather than validating only against live Copilot calls.
-
Copilot-only gating. createCopilotStreamFixer() is a provider-specific shim. Normalization must only apply to Copilot streams — not plain OpenAI Responses streams — or it risks corrupting ids for providers that do not rotate them.
-
Source/upstream lookup. The package belongs to the byokkit project. Check npm/GitHub for the actual source and open a PR. Confirm whether dist/ is the only shipped artifact (no src/ or sourcemaps), since that determines whether the patch is a clean source diff or an inline dist/ edit.
-
Immediate mitigation (stopgap). While the fix lands, pin @ai-sdk/openai to the last version released before encrypted reasoning summaries, or pin the provider package back, to unblock users immediately.
Summary
When
gpt-5.6-luna(or any GPT model routed through Copilot's Responses API,spec: "responses") is selected, requests fail mid-stream with:Root cause
OpenAI's Responses API now emits
response.reasoning_summary_part.addedevents (encrypted reasoning). The AI SDK parser (@ai-sdk/openai) tracks these viaactiveReasoning[item_id], keyed on each reasoning item'sitem_id.GitHub Copilot has a known quirk of rotating item IDs across events for the same logical part. The provider's
createCopilotStreamFixer()normalizes this id-rotation fortext-*andreasoning-*events only — it does not handlereasoning_summary_part.added.As a result, when a summary part arrives with an
item_idthe parser never saw a precedingreasoningoutput_item.addedfor,activeReasoning[value.item_id]isundefined, and the parser dereferences.summaryPartson it, throwing.Where
@byokkit/cmd-provider-copilotv0.1.1 (latest)dist/chunk-KNVRT45Z.js→createCopilotStreamFixer()@ai-sdk/openai/src/responses/openai-responses-language-model.ts:2117Expected Behavior
The stream fixer should also normalize/forward
reasoning_summary_partevents (or drop them) so theactiveReasoningmap stays consistent despite Copilot's item-id rotation.Actual Behavior
Selecting
gpt-5.6-lunaunder the GitHub Copilot provider section in/modeland sending a request results in the stream crashing mid-response withError: Cannot read properties of undefined (reading 'summaryParts'). The error occurs after the model begins emitting reasoning content, and no completion is returned.Steps to reproduce the issue
cmd login copilotand complete the device sign-in./modeland navigate to the GitHub Copilot provider section.gpt-5.6-luna).Error: Cannot read properties of undefined (reading 'summaryParts').Command Code Version
1.32.1
Operating System
Linux
Terminal/IDE
Unknown
Shell
bash
Session file (optional)
{"type":"session","version":3,"id":"ee5b89bb-41b9-4af3-9fca-3bf8c053e049","timestamp":"2026-08-24T02:20:41.576Z","cwd":"/home/pbtrudel"}
{"type":"model_change","id":"e167ed7c","parentId":null,"timestamp":"2026-08-24T02:20:56.174Z","model":"gpt-5.6-luna"}
{"type":"message","id":"6d4fffc4","parentId":"e167ed7c","timestamp":"2026-08-24T02:21:14.501Z","message":{"role":"user","content":[{"type":"text","text":"test using the tools in this harness"}],"meta":{"source":"user","createdAt":1787538070623,"messageId":"7f845134-0ba2-4510-8493-92791e8207c3"}}}
{"type":"message","id":"13184e10","parentId":"6d4fffc4","timestamp":"2026-08-24T02:21:14.503Z","message":{"role":"user","content":[{"type":"text","text":"Error: Cannot read properties of undefined (reading 'summaryParts')\n\nType "continue" to try again. If the issue persists, contact support: https://commandcode.ai/discord\nTrace ID: 7557d41091117d424fe2669a7a3f3289"}],"meta":{"messageId":"9378126f-c2aa-4858-8f59-06c9f6923ac0"}}}
Fix prompt (optional)
You're fixing a crash in
@byokkit/cmd-provider-copilotv0.1.1. When using a GPT model routed through Copilot's Responses API, requests fail mid-stream withError: Cannot read properties of undefined (reading 'summaryParts'), originating in@ai-sdk/openai/src/responses/openai-responses-language-model.ts:2117.Root cause: GitHub Copilot rotates
item_idvalues across events for the same logical part.createCopilotStreamFixer()indist/chunk-KNVRT45Z.jsalready normalizes this id rotation fortext-*andreasoning-*events, but it does not cover the OpenAI Responses API'sresponse.reasoning_summary_part.addedevents. When the AI SDK parser receives areasoning_summary_part.addedwhoseitem_idit never saw,activeReasoning[value.item_id]isundefined, and dereferencing.summaryPartson it throws.Task:
createCopilotStreamFixer()in the package source and identify exactly which event types it currently remaps (confirm which ones are handled vs. skipped, and how the id remapping/normalization is implemented for the covered events).item_idfor thereasoning_summary_part.*family — at minimumreasoning_summary_part.addedandreasoning_summary_part.done, plusreasoning_summary_textif present — using the same id-rotation mapping strategy used for the existingreasoning-*events.item_id) so the parser'sactiveReasoning[...]entry exists by the timesummaryPartsis dereferenced.dist/chunk-KNVRT45Z.js) needs regenerating or if the patch should target the source*.js/.tsthat produces it.Constraints: Minimal, surgical change only — do not refactor unrelated logic. Preserve existing event-ordering and stream-delivery semantics.
Additional context
Cover the full event family, not just
.added. The parser path around line 2117 handles the whole reasoning-summary cluster:response.reasoning_summary_part.added/response.reasoning_summary_part.doneresponse.reasoning_summary_text.delta/response.reasoning_summary_text.doneresponse.output_item.added/response.output_item.done(areasoningitem carries itssummaryarray here)response.reasoning.done(the encrypted reasoning item)Any of these that carry a rotating
item_idmust be normalized together, or the crash just moves to the next event in the family.Restore the exact invariant, not just the symptom.
activeReasoningis keyed byitem.idfromresponse.output_item.added(typereasoning), thenresponse.reasoning_summary_part.addedpushes intoactiveReasoning[id].summaryParts. The fix must make those two events resolve to the same canonical id. Treating.addedin isolation without reconcilingoutput_item.addedand.donewill still leave ordering/state broken.Repro data (ideal). Capture the raw SSE chunk sequence with the rotating
item_idvalues from a failing request and paste the sequence in. Even a redacted two-event snippet — e.g.output_item.added {id: A}followed byreasoning_summary_part.added {item_id: B}— pins the bug and lets the agent write a deterministic unit test rather than validating only against live Copilot calls.Copilot-only gating.
createCopilotStreamFixer()is a provider-specific shim. Normalization must only apply to Copilot streams — not plain OpenAI Responses streams — or it risks corrupting ids for providers that do not rotate them.Source/upstream lookup. The package belongs to the
byokkitproject. Check npm/GitHub for the actual source and open a PR. Confirm whetherdist/is the only shipped artifact (nosrc/or sourcemaps), since that determines whether the patch is a clean source diff or an inlinedist/edit.Immediate mitigation (stopgap). While the fix lands, pin
@ai-sdk/openaito the last version released before encrypted reasoning summaries, or pin the provider package back, to unblock users immediately.