Files
plugins/packages
yetone e38f4f39fe agy-cli 0.1.94: an ending with only thinking is asked again in the session, then is an error
fnckerpoi on X (magpie 0.1.4402, agy-cli 0.1.91, DSH 0.2.2-rc.3 through
billion-context, provider concurrency 1): "acp-proxy: the turn
degenerated again after the continuation nudge".

The words are billion-context's. Its plugin pipe calls a turn
"degenerate" when it ends cleanly (end_turn) with no tool call and no
answer text but did carry thinking; it then resends the request once
with a nudge appended, and when that comes back the same it ends the
stream with this error.

agy-cli handed such turns over. When a model call returns neither text
nor tool calls, agy writes "⚠ Model produced invalid output." (dropped
since 0.1.42, #1124) and calls the model again; when that call is empty
too, agy ends the prompt on end_turn with only thinking, and the bridge
sent it as a finished reply that said nothing. billion-context's nudge
then arrived as a new request whose history (no empty assistant turn)
no longer matched the session, so the bridge stopped agy and replayed
the whole conversation in a new session: the same context, cold, and
with concurrency 1 queued behind the other requests. It came back empty
again. Concurrency 1 adds the wait; it doesn't cause the empty reply.

- Turn tracks, since the turn began or its last tool call, whether the
  model said any non-blank text, thought, or hit agy's invalid-output
  retry. An end_turn (or no stop reason) with thinking or that retry and
  no text is an empty ending.
- #runTurn asks such an ending once more in the same session, as one
  more session/prompt of the same response, with neutral words that
  name nobody ("Your last reply was empty. Continue: …"). The client
  sees only the answer.
- Still empty, the turn ends with an AgentTurnError: "the model ended
  its reply twice with no text and no tool call (agy: Model produced
  invalid output); send the request again, or try another model". It is
  an error before any content, so magpie's gateway asks the next
  account, and agy's session is kept, so the same request sent again
  continues in it instead of a replay.
- A bare empty ending (no thinking either) and a max_tokens ending are
  passed through as before. One more ask per tool call, not per turn.
- README (zh, en): what happens to such a reply.

Run (mote, bun 1.4.2, HOME=$(mktemp -d)):
- test/repeat-batch.mjs: 75 pass. The four new tests against origin/main
  11e7afe5's index.mjs (AGY_BRIDGE_TEST_INDEX): the ask-again and the
  error-and-session-kept tests fail, the bare-empty and max_tokens ones
  pass on both. The #1124 case that expected a banner-only reply to end
  as an empty end_turn is removed: that was this bug.
- bun test ./packages/agy-cli (every suite and smoke.mjs): 41 pass,
  0 fail. bun scripts/check.mjs agy-cli: ok.

Not tried: a real Antigravity account. The owner's Google account is
refused (403, ToS) on agy turns and no other signed-in agy account was
found here, on mote or on mica. The empty ending was built from agy's
own banner bytes and its end_turn, not captured from a real empty
reply, and whether the model's empty call is Gemini's
MALFORMED_FUNCTION_CALL is not known. Not run under billion-context
itself.
2026-11-18 10:29:47 +08:00
..
middleware: param-override, model-map, system-prompt, word-guard and think-tags — gateway middleware that magpie runs on every agent's requests and replies, mostly New API's channel settings with the same JSON (the owner) — magpie can now run a plugin as gateway middleware (onRequest, onEvent, onResponse, in-process on moejs), and these are the first ones: param-override is New API's param_override (both forms, operations with gjson paths and conditions, return_error); model-map is model_mapping (chains, /regex/ keys with $1) and puts the asked-for name back into replies; system-prompt adds a prompt in each API's own place, keeping an agent's own unless override (New API's semantics), by agent or model; word-guard is the sensitive-word filter (reject or mask the user's text, optionally replies); think-tags strips a leading <think>…</think> from replies across stream chunks, or puts Chat reasoning_content into the text (thinking_to_content). Each is one file with no imports, named @magpie-community/middleware-<name>, with magpie.options as the example the app's editor starts from; registry.json lists them with "kind": "middleware" and no providers; check.mjs skips middleware-only packages. scripts/middleware.mjs calls the hooks as the gateway does (events split, [DONE] passed by) and runs each package's cases.json. Tested with a real DeepSeek account and real Claude Code through magpie's gateway: a mapped model named back in message_start, max_tokens capped, a system prompt appended for claude only, a word turned away as a 400 in Anthropic's shape, return_error as a 403 in Chat's, <think> stripped from Chat and Responses streams and an Anthropic whole reply, reasoning_content moved into the text. bun test (61 for these five) and bun scripts/check.mjs pass; packages/devin's two image tests fail on this machine only, as on main. Their first npm version has to be published by hand (trusted publishing can't create a package); until then magpie shows them as Coming soon.
2026-10-05 20:49:42 +08:00