Files
magpie/internal
yetone 58b6ad2e80 claude: with CLAUDE_CONFIG_DIR set, the keychain item read and written is the one Claude Code keeps there (#1842)
What changed: magpie read and wrote Claude Code's own sign-in under the
service "Claude Code-credentials" whatever CLAUDE_CONFIG_DIR said. Claude
Code 2.1.296 names its item "Claude Code-credentials-<sha256(dir)[:8]>"
when CLAUDE_CONFIG_DIR is set (j$ in its secure storage: the suffix is
dropped only when CLAUDE_CONFIG_DIR is unset), which is what
claudeDirService already computes for saved accounts' directories. Now
claudeHomeService gives that name for the read (both the account's item
and by service alone) and for saveClaudeCredential.

Why now: the previous commit asks the account's item before the file, so
with CLAUDE_CONFIG_DIR set the plain "Claude Code-credentials" item — the
default directory's sign-in, maybe another account — would have beaten the
.credentials.json in CLAUDE_CONFIG_DIR. It was already wrong before that
commit (a sign-in was written to an item Claude Code under that directory
never reads), only less visible.

Run (tip of both commits, sandbox HOME, fake `security` on PATH, private
GOCACHE): TestClaudeConfigDirKeychainItem fails with claudeHomeService
ignoring CLAUDE_CONFIG_DIR (it read "home-item") and passes with it.
gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and
GOOS=windows pass; go test -count=1 ./internal/provider ok (116s);
go test -race -count=5 on the keychain tests ok.
Not run: no real Keychain, no real Claude Code run under CLAUDE_CONFIG_DIR
(the name rule is read from the 2.1.296 binary), no other package's tests
(only internal/provider changed).
2026-10-13 00:43:08 +08:00
..
settings: keep awake can keep the display on too (#975, Hu9956: magpie's keep-awake held the system up, but the screen still went black and locked, and their agents record the screen to check their work, which a locked screen stops) — Settings › General's "Keep awake while agents work" row now has three segments, Off / On / Screen on too, saved as keepAwake and the new keepAwakeDisplay (default off, so On and every existing settings.json behave as before). awake.Keep takes a Level (Off, System, Display) in place of a bool; a level changed while held releases and takes the hold anew. On a Mac the display level runs caffeinate -i -d -w <pid> (pmset -g assertions on a caffeinate of the same flags shows PreventUserIdleDisplaySleep beside PreventUserIdleSystemSleep); on Windows SetThreadExecutionState gets ES_DISPLAY_REQUIRED too; on Linux logind's idle inhibitor (systemd-inhibit --what=idle:sleep, unchanged) is all there is, and whether the screen stays on is up to the desktop. keepAwakeDisplay is this computer's own (KeepOwn) and goes in prefsKeep, so another setting's save keeps it. The row's line says the display stays on when it's chosen; it keeps its English in data-en, so a language change re-translates it. zh/ja/de strings added. No TUI or CLI has keep-awake, so none changed. TestKeepDisplay (taken once, taken anew with the display, not again at the same level, back to System, released at Off), TestCaffeinateArgs, TestExecutionState (GOOS=windows test build) and TestKeepAwakeKeptAndOwn cover it; go test ./internal/awake ./internal/settings ./internal/gui ./internal/gateway pass, -race -count=5 on awake. keep-awake.test.cjs now runs en/zh/ja/de at 900px and 440px in Chromium and WebKit (display posts keepAwake+keepAwakeDisplay true, the line changes, another setting's save keeps it, segments fit the row, On and Off clear it, no click moves the page): 32/32 twice; gui-ja, gui-de, i18n-keys and click-scroll pass. go vet (darwin, windows, linux), darwin, linux (nogui) and windows builds pass. Not tried with an agent recording the screen; the reporter is asked to confirm.
2026-10-06 15:33:28 +08:00
…
…