github / github/copilot-sdk

When hit max_output_tokens, some events are not emitted and logged

Offen
#2,546 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
10.5k
Forks
1.5k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
127

Beschreibung

When the AI's output is truncated because it exceeds `max_output_tokens` and a subsequent request is made, both the current response and the next "continue" request are lost.

This happens in BYOK usage. I use the custom provider and it provides `65536` `max_output_tokens`. So it easily triggered this bug.

See this `events.jsonl` below (input and output is ommited for privacy):

```jsonl
{"type":"session.start","data":{"sessionId":"summary-qq-group-957302634-1788584545","version":1,"producer":"copilot-agent","copilotVersion":"0.0.0","startTime":"2026-09-05T05:02:26.005Z","selectedModel":"deepseek-v4-flash","reasoningEffort":"high","contextTier":null,"context":{"cwd":"/home/cola/Softwares/kanade-bot"},"remoteSteerable":false,"alreadyInUse":false},"id":"3e23bf11-4b01-4b8a-bc43-ad9b7d007c69","timestamp":"2026-09-05T05:02:26.024Z","parentId":null}
{"type":"user.message","data":{"content":"...","transformedContent":"...","messageId":"33fe414d-6631-449a-a351-3a34b2c2b68d","supportedNativeDocumentMimeTypes":[],"delivery":"idle","interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec","turnId":"0","parentAgentTaskId":"65b27352-d09e-4c72-956b-b69594366d8c"},"id":"f56f57fc-8c67-4bd2-a372-cfb61f2c4109","timestamp":"2026-09-05T05:02:29.423Z","parentId":"3e23bf11-4b01-4b8a-bc43-ad9b7d007c69"}
{"type":"system.message","data":{"role":"system","content":"...","interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec"},"id":"a33407ed-4a7b-4feb-ad75-83d6b0eac50b","timestamp":"2026-09-05T05:02:29.445Z","parentId":"f56f57fc-8c67-4bd2-a372-cfb61f2c4109"}
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec"},"id":"5583fe72-b633-44ea-a183-7ac781d075d2","timestamp":"2026-09-05T05:02:29.458Z","parentId":"a33407ed-4a7b-4feb-ad75-83d6b0eac50b"}
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"5df48ed1-fe69-4ffe-8645-f0fa2545ef14","timestamp":"2026-09-05T05:03:40.349Z","parentId":"5583fe72-b633-44ea-a183-7ac781d075d2"}
{"type":"assistant.turn_start","data":{"turnId":"1","interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec"},"id":"53c4e5ae-2365-4391-86b3-c39735958279","timestamp":"2026-09-05T05:03:40.349Z","parentId":"5df48ed1-fe69-4ffe-8645-f0fa2545ef14"}
{"type":"assistant.turn_end","data":{"turnId":"1"},"id":"d48f14f2-263b-4990-8d66-f5e858a49b10","timestamp":"2026-09-05T05:04:51.913Z","parentId":"53c4e5ae-2365-4391-86b3-c39735958279"}
{"type":"assistant.turn_start","data":{"turnId":"2","interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec"},"id":"e77c5372-08d4-47ba-b886-5a75ae6a5a6d","timestamp":"2026-09-05T05:04:51.914Z","parentId":"d48f14f2-263b-4990-8d66-f5e858a49b10"}
{"type":"assistant.message","data":{"messageId":"51f06be7-30d8-4d28-b8ae-e8dc1fcc9937","model":"deepseek-v4-flash","content":"(继续)...","toolRequests":[],"interactionId":"9596a41f-2bfc-4191-998c-740b2e30caec","turnId":"2","reasoningText":"Let me continue writing the topic summary. I was in the middle of topic 12. Let me continue from there, then complete the personal image section.","rte":false,"apiCallId":"6197b23f-7420-44dd-8bc4-a032e5784de2"},"id":"7fd35caa-4f74-4365-84d5-c39f7556561a","timestamp":"2026-09-05T05:05:41.237Z","parentId":"e77c5372-08d4-47ba-b886-5a75ae6a5a6d"}
{"type":"assistant.turn_end","data":{"turnId":"2"},"id":"1d7b9c22-2a37-4a73-b54e-f7f398c00f40","timestamp":"2026-09-05T05:05:41.244Z","parentId":"7fd35caa-4f74-4365-84d5-c39f7556561a"}
{"type":"session.shutdown","data":{"shutdownType":"routine","totalPremiumRequests":0,"totalNanoAiu":0,"totalApiDurationMs":190704,"sessionStartTime":1788584546005,"eventsFileSizeBytes":368878,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]},"modelMetrics":{"deepseek-v4-flash":{"requests":{"count":3,"cost":0},"usage":{"inputTokens":234114,"outputTokens":21467,"cacheReadTokens":147456,"cacheWriteTokens":0,"reasoningTokens":14945},"totalNanoAiu":0}},"agentMetrics":{"main":{"totalApiDurationMs":190704,"totalNanoAiu":0.0,"modelMetrics":{"deepseek-v4-flash":{"requests":{"count":3,"cost":0.0},"usage":{"inputTokens":234114,"outputTokens":21467,"cacheReadTokens":147456,"cacheWriteTokens":0,"reasoningTokens":14945},"totalNanoAiu":0.0}}}},"currentModel":"deepseek-v4-flash","currentTokens":81090,"systemTokens":816,"conversationTokens":68907,"toolDefinitionsTokens":11364},"id":"391655ed-981c-4225-b84c-8948504c7bae","timestamp":"2026-09-05T05:05:41.537Z","parentId":"1d7b9c22-2a37-4a73-b54e-f7f398c00f40"}
```

OS: Linux Mint 22.3
Copilot SDK Version: v1.0.13
Copilot CLI Version: v1.0.83 (pinned version)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

No files, tests, or entry points are identified. Start by reproducing a BYOK request that reaches max_output_tokens, then trace event emission and logging across the truncated response and subsequent continue request. Done means both responses are present in events.jsonl and are logged consistently.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
observability
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.