Skip to content

copilot-driver: restart fresh instead of --continue when 400 null-type tool_call poisons history #29312

@tore-unumed

Description

@tore-unumed

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.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions