magpie icon indicating copy to clipboard operation
magpie copied to clipboard

[Bug] Claude subscription: a turn the interactive mode can't take silently runs as claude -p (about twice the cost) with no warning and no way to refuse

Open NickWilde18 opened this issue 2 weeks ago • 0 comments

magpie version

v0.1.4634 (cb0403c)

Where

Gateway only

OS

Linux x64

Agent, provider and model

Claude Code 2.1.330 → Claude subscription, interactive mode on → claude-opus-5-5

Steps to reproduce

  1. Keep the Claude subscription in interactive mode (claudePrintMode off).
  2. Have a long Claude Code conversation (here about 240K tokens).
  3. Make the bridge start a fresh run for it. Here pace routing moved the conversation to another subscription account.
  4. The fresh run's first message is the whole conversation, 502,926 bytes here. The interactive mode doesn't take it (the transcript of that Claude Code has its start-up lines and no user row, and it ends after about 3.6 s). This is the paste limit of #6126.
  5. The bridge asks the turn again as claude -p (serveSubscriptionAs with unpastedCode), and the turn succeeds.

It happened twice in one conversation on the same day, both times on a fresh run. The routing record of each says entry: print, entryWhy: unpasted. Every later turn of the conversation went on in that -p run.

What happened, and what you expected

What happens. The turn silently moves to claude -p, which the plan counts at about twice the interactive mode's (as magpie's own words say, in claudePrint's unpasted reason). Nothing tells the user:

  • The client gets an ordinary 200, with no header or notice that the run is now -p.
  • The interactive-mode try that failed isn't recorded as a try in the routing record, and its error isn't in usage.jsonl. The only trace of why is one log.Printf line ("the interactive mode didn't take a turn's message … asked again as claude -p, which the plan counts at about twice …"). When the gateway's output goes to a terminal that has since closed, that line is lost.
  • The run then stays -p for every following turn of the conversation, until the run ends. So a single failed paste makes the rest of the conversation cost about twice as much.

There is no setting that refuses this fallback. Turning the interactive mode off (claudePrintMode) makes every turn -p, which is the opposite of what a user who wants to avoid the cost needs.

Expected. The user decides whether a turn may cost about twice as much:

  1. A setting to refuse the unpasted fallback: the turn fails with a clear error naming the cause (the paste wasn't taken, #6126), instead of running as -p. I would rather see an error than pay about twice without knowing.
  2. When the fallback is allowed (the default can stay as it is), make it visible: a response header the client can show, the failed interactive try recorded as a try with its error, and a note in the provider or recent-calls view that the conversation's run is -p and why.
  3. Ideally, a fresh run of a long conversation doesn't need to paste the whole conversation into the interactive mode at once. That is #6126's fix, and it would make this fallback rare.

Related

  • #6126: why the paste fails (the submit window is 4 × 3 s whatever the paste's size). Back then the failure was a 502. Now it turns silently into a -p run.
  • #7420: in this same -p run, magpie's extra cache mark plus Claude Code's own four make five, and Anthropic answers 400. The two together turned a long conversation into "every Claude turn fails" after a silent move to -p.

Error text or logs

routing record, fresh run: entry=print entryWhy=unpasted (one try recorded)
interactive-mode transcript of the try: start-up lines only, no user row, ~3.6 s
first message of the fresh run: 502,926 bytes
usage.jsonl: no error recorded for the failed interactive try

NickWilde18 avatar Nov 21 '26 19:11 NickWilde18