Summary
Interruptions sometimes fail unrecoverably with a 400 error stating "System message must be at the beginning." This prevents the agent from continuing after an interruption is triggered.
Environment
- OS: Linux 7.0.2-7-pve
- Node.js: v25.8.1
- madz version: 1.11.0
- LLM provider: Unknown — user to confirm
Reproduction
Steps to reproduce the behavior:
- Trigger an interruption during agent execution
- Observe the connection attempt to resume
- Error occurs and process becomes unrecoverable
Expected Behavior
The interruption should be handled gracefully, allowing the connection to be re-established and execution to continue or fail cleanly with a recoverable error.
Actual Behavior
The connection attempt fails with an unrecoverable error: "I couldn't connect right now - 400 System message must be at the beginning.. Try sending your message again?"
Additional Context
The error message indicates a malformed request payload where the system message is not positioned correctly at the start of the message array. This suggests a bug in how interruption context is reconstructed before sending the next request.
Summary
Interruptions sometimes fail unrecoverably with a 400 error stating "System message must be at the beginning." This prevents the agent from continuing after an interruption is triggered.
Environment
Reproduction
Steps to reproduce the behavior:
Expected Behavior
The interruption should be handled gracefully, allowing the connection to be re-established and execution to continue or fail cleanly with a recoverable error.
Actual Behavior
The connection attempt fails with an unrecoverable error: "I couldn't connect right now - 400 System message must be at the beginning.. Try sending your message again?"
Additional Context
The error message indicates a malformed request payload where the system message is not positioned correctly at the start of the message array. This suggests a bug in how interruption context is reconstructed before sending the next request.