Skip to content

fix: handle Copilot CLI assistant.message_delta events in output parsing#224

Merged
jafreck merged 1 commit intomainfrom
fix/copilot-message-delta-parsing
Mar 27, 2026
Merged

fix: handle Copilot CLI assistant.message_delta events in output parsing#224
jafreck merged 1 commit intomainfrom
fix/copilot-message-delta-parsing

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Mar 27, 2026

Problem

The Copilot CLI changed its streaming behavior — it now emits assistant.message_delta events (token-by-token streaming deltas) for the final answer instead of (or in addition to) consolidated assistant.message events.

parseCopilotJsonl() only extracted text from assistant.message events, so when the aamf-json structured output block was delivered via message_delta events, 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.message at 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 the aamf-json block to be lost.

Changes

  • src/core/agent-launcher.ts: Add assistant.message_delta case to parseCopilotJsonl() that appends each deltaContent to the reconstructed textContent
  • src/config/schema.ts: Raise maxRetriesPerTask schema max from 5 to 10 (needed for large complex migrations like zstd)
  • tests/config/config-schema.test.ts: Update validation test to match new max
  • tests/fixtures/zstd-c-project/migration.config.json: Update fixture config with tuned retry/timeout/convergence settings from migration run

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)
@jafreck jafreck merged commit 6730a60 into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant