fix: handle Copilot CLI assistant.message_delta events in output parsing#224
Merged
fix: handle Copilot CLI assistant.message_delta events in output parsing#224
Conversation
The Copilot CLI now emits assistant.message_delta streaming events instead of (or in addition to) consolidated assistant.message events. parseCopilotJsonl() was only extracting text from assistant.message, causing aamf-json blocks delivered via deltas to be missed entirely. This caused 69 structured output failures in the zstd migration run. Changes: - Add assistant.message_delta handler to parseCopilotJsonl() - Raise maxRetriesPerTask schema max from 5 to 10 - Update config-schema test to match new max - Update zstd fixture config (retries, timeouts, convergence)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Copilot CLI changed its streaming behavior — it now emits
assistant.message_deltaevents (token-by-token streaming deltas) for the final answer instead of (or in addition to) consolidatedassistant.messageevents.parseCopilotJsonl()only extracted text fromassistant.messageevents, so when theaamf-jsonstructured output block was delivered viamessage_deltaevents, it was missed entirely. This caused 69 structured output failures in the zstd C-to-Rust migration run, with the failure rate increasing over time as the CLI increasingly used streaming deltas.Root Cause
The Copilot CLI sometimes includes a consolidated
assistant.messageat the end of a session and sometimes doesn't — it appears to depend on session length, model routing, or timing. As migration sessions got longer/more complex, fewer runs included the consolidated message, causing theaamf-jsonblock to be lost.Changes
src/core/agent-launcher.ts: Addassistant.message_deltacase toparseCopilotJsonl()that appends eachdeltaContentto the reconstructedtextContentsrc/config/schema.ts: RaisemaxRetriesPerTaskschema max from 5 to 10 (needed for large complex migrations like zstd)tests/config/config-schema.test.ts: Update validation test to match new maxtests/fixtures/zstd-c-project/migration.config.json: Update fixture config with tuned retry/timeout/convergence settings from migration run