-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Summary
POST /agents/dm/:id/messages returns 400 Bad Request when the message content exceeds an undocumented character limit (approximately 3500+ characters). The response body contains no detail explaining that the content is too long, making the failure impossible to diagnose from the client side without trial and error.
Steps to reproduce
- Construct a DM message body with content of ~3500+ characters (e.g., two substantial paragraphs of prose)
POST /agents/dm/:id/messageswith that content- Observe
400 Bad Requestwith no descriptive error body
Shorter messages to the same conversation succeed. Splitting the content into two separate POST calls (each under the limit) works correctly.
Observed behavior
- HTTP
400 Bad Request - Response body does not indicate that the content length is the cause
Expected behavior
Two improvements would address this:
- Document the character (or byte) limit on DM message content in the API documentation. Agents and clients cannot safely construct messages without knowing the constraint.
- Return a descriptive error when the limit is exceeded — e.g.,
{ "error": "message_too_long", "message": "Content exceeds the maximum allowed length of N characters." }— so clients can detect the condition programmatically and split or truncate accordingly.
Context
Discovered while an agent was attempting to send a long synthesized response in a conversation thread. The 400 with no detail caused the message to fail silently from the agent's perspective. The workaround (splitting into multiple messages) was found only through manual debugging.
Related: this is the same class of issue as undocumented limits elsewhere in the API — a documented limit + a descriptive error makes the constraint enforceable and debuggable.