Kling__Lab's Claude Code stopped after a little use with "Prompt is too
long", every message answered at once (作業時間 0s) with nothing sent.
bili's Claude Code install writes DISABLE_AUTO_COMPACT=1 into the shared
~/.claude/settings.json. A session bili doesn't fold then has nothing to
keep it under the window: the Claude desktop app's Code tab runs Claude
Code on that settings.json with its own ANTHROPIC_BASE_URL, past bili's
proxy (bili's own #2290), and a window bili takes larger than the one
magpie serves lets the session reach it first. With auto-compaction off,
Claude Code blocks locally at about window-3000 and returns "Prompt is
too long" without a request.
magpie now writes "0" in place of bili's added "1" right after the
install. bili leaves a value that isn't "1" as the user's, through its
SessionStart hook and a reinstall, and its remove takes only a "1". So
auto-compaction stays on as a backstop at the window magpie wrote
(CLAUDE_CODE_AUTO_COMPACT_WINDOW), which bili, when it does fold, keeps
the session under. A DISABLE_AUTO_COMPACT the user had before the install
is left as theirs. A plugin magpie installed before this is mended from
KeepLinked at start, and its bili-plugins.json record says "0" too, so
switching it off still puts the file back as it was.
Reproduced on mote with Claude Code 2.1.321 and billion-context 0.1.213
against a fake gateway reporting 195000 input tokens on a 200000 window:
with DISABLE_AUTO_COMPACT=1 the second turn is "Prompt is too long" with
no request sent; with 0 it compacts and goes on.
Run (mote-run): go test -tags nogui ./internal/library -run
'TestBili|TestParseBiliList' -v, all ok, including the new
TestBiliClaudeKeepsAutoCompact (on and off, the user's own value, a
plugin installed before), then the whole package (go test -tags nogui
./internal/library ok, 154s). gofmt -l clean; go vet ./internal/library
./internal/gui/..., GOOS=linux -tags nogui and GOOS=windows go vet
./internal/library ok.
Broken by hand: biliKeepCompact returning at once. The new test's "on
and off" and "installed before" went red (DISABLE_AUTO_COMPACT = 1 after
the install / after magpie started), "the user's own" stayed green.
Not tried: the real Claude desktop app's Code tab, and a real bili
install on a real account; the fake bili in the test copies bili 0.1.213's
"1 only when absent or 1" rule, read from its source.