dsh-messages-sanitizer: Automatically fix orphan tool_calls in DeepSeek Harness sessions

dsh-messages-sanitizer is a DeepSeek Harness plugin developed by Leeminjing (MIT licensed, v0.1.1) that addresses the issue where tool scheduling crashes leave orphaned `tool_calls` in a session, causing subsequent requests to be continuously rejected with `400 INVALID_REQUEST` and resulting in a deadlock. The plugin implements four layers of fixes: first, injecting a synthetic error tool-result to automatically continue when the agent returns to idle; second, proactively inserting response messages before the next round of requests; third, stripping dangling `tool_calls`, neutralizing orphaned tool messages, collapsing duplicate user messages, and forcing a retry when the API still returns a 400 error; and fourth, performing pure array correction as a fallback for non-frozen requests. The fix is idempotent, and...

Read More