Commit Graph
1 Commits
Author SHA1 Message Date
yetone 9608d0311d grok 0.2.2: Responses requests ask for Grok Build's loop checks (yetone/magpie#3594)
Grok Build 1.0.67 sends `x-grok-doom-loop-check: 1024` and
`x-grok-exact-repetition-check: 64` on every /v1/responses request
(seen in a mitm capture of the real CLI; the strings are in its binary
next to "server reported doom-loop triggers for this response"). The
plugin sent neither. Without them cli-chat-proxy lets a reply that
repeats itself run on: it cut "* " repeated after ~4,265 output tokens,
and a looser loop runs to max_output_tokens (128000 from Pi). That is
the "repeats until max output, ends in Internal error during token
generation" of #3594, seen on Pi -> magpie -> Grok but not in Grok
Build. The fetch now sets both on a Responses request unless the
caller set them already.

Ruled out while diffing the CLI's request against magpie's: the system
prompt. `instructions`, a system message and a developer message in
`input` all reach the model (same input_tokens, 1266 vs 1249 without,
same reply), so magpie's `instructions` is not lost.

Run:
- bun test in packages/grok on mote: 85 pass 0 fail.
- bun run check (whole repo) on mote: exit 0.
- Broken by hand: loop-check.test.mjs against index.mjs at HEAD:
  2 of 3 fail (the headers are missing); with the change 3 pass.
- Real account (owner's SuperGrok, sandbox magpie on origin/main with
  this plugin from disk, requests through mitm): the same "* " x3000
  prompt over /v1/responses, /v1/chat/completions and /v1/messages each
  carried both headers upstream and was stopped after ~1,020 deltas
  (~1K tokens) with "Internal error during token generation", against
  ~4,265 tokens without the headers (direct curl, earlier).

Not tried: the CLI's client-side doom-loop recovery (it resamples a
confident tool-call loop with a reminder). The proxy's
response.doom_loop_check event (a soft loop it reports, not stops)
goes through as it came and nothing acts on it yet.
2026-10-30 06:51:57 +08:00