What happened
A Copilot agent run failed repeatedly with the following error:
400 Invalid type for 'messages[N].tool_calls[M].type':
expected one of 'function', 'all...ols', or 'custom', but got null instead.
The model emitted a malformed tool call with type: null. The copilot-driver retried 3 more times with --continue, but each retry re-injects the same broken history, causing the same 400 on every attempt — all 4 attempts failed identically.
Root cause
The --continue retry strategy is the wrong recovery for this error class. A corrupt message in the conversation history cannot be fixed by resuming from the same state.
Proposed fix
In copilot-driver, detect this error pattern (tool_calls[N].type: null) and restart fresh (without --continue) instead of retrying with the same broken history. A fresh restart loses partial progress but at least gives the run a chance to complete — which is strictly better than 3 guaranteed re-failures.
What happened
A Copilot agent run failed repeatedly with the following error:
The model emitted a malformed tool call with
type: null. The copilot-driver retried 3 more times with--continue, but each retry re-injects the same broken history, causing the same 400 on every attempt — all 4 attempts failed identically.Root cause
The
--continueretry strategy is the wrong recovery for this error class. A corrupt message in the conversation history cannot be fixed by resuming from the same state.Proposed fix
In copilot-driver, detect this error pattern (
tool_calls[N].type: null) and restart fresh (without--continue) instead of retrying with the same broken history. A fresh restart loses partial progress but at least gives the run a chance to complete — which is strictly better than 3 guaranteed re-failures.