empty-reply 0.1.0: a reply with reasoning but no text ends early, so the agent retries (#900)

Adds packages/empty-reply (0.1.0): a reply made of reasoning alone, with
end_turn (Anthropic) or response.completed (Responses), loses its end
events so Claude Code and Codex retry; a whole reply becomes an error
body or status "failed". max_tokens, refusal and incomplete are kept.
A stopgap for yetone/magpie#3358 until the gateway checks this itself.

Reviewed at 900 head: bun test packages/empty-reply 17 pass,
bun scripts/check.mjs all packages ok, bun test scripts 22 pass (mote,
Bun 1.4.2). Read every case in cases.json against the Anthropic and
Responses stream shapes. The author ran Claude Code 2.1.319 and
codex-cli 0.167.0 against a reasoning-only Chat upstream (ordered and
rotate). Not run by the reviewer in a live gateway.
This commit is contained in:
Qin Huijian
2026-11-09 23:51:33 +08:00
committed by GitHub
parent cbb58f654a
commit f9124bc831
7 changed files with 351 additions and 0 deletions
+1
View File
@@ -63,6 +63,7 @@ These packages aren't OpenCode plugins. magpie runs them in its gateway, on the
| [output-strategy](packages/output-strategy) | Seven composable output styles with a selection panel; off by default, cache-stable, and Codex `instructions` stay untouched |
| [word-guard](packages/word-guard) | New API's 敏感词过滤: turn away or mask words and patterns in what users send, and in replies |
| [think-tags](packages/think-tags) | Take a leading `<think>`, `<thinking>` or `<thought>` block out of a reply's text, or put a Chat reply's `reasoning_content` into it (`thinking_to_content`) |
| [empty-reply](packages/empty-reply) | Drop the end of a reply that has reasoning but no text, so Claude Code and Codex retry instead of stopping |
| [antigravity-cloak](packages/antigravity-cloak) | Claude Code and Claude Desktop on Antigravity: break the words Antigravity turns their system prompt away for, in what Antigravity alone is sent |
| [codex-history](packages/codex-history) | Opt-in Responses history compatibility after switching providers: remove historical ciphertext and optional item IDs while preserving readable content and tool-call pairing |
| [history-trim](packages/history-trim) | Send a request's history smaller: fold a run of blank lines, drop a system prompt written twice and a message repeated right after itself, and cut a past tool result longer than `maxToolLength` at a word boundary |