The gateway takes gateway.Token, and the keys that name an agent
(gateway.TokenFor), only from loopback. When MAGPIE_ADDR pins the
gateway to an address beyond loopback and sharing is on, keyAt gives the
LAN sharing key, and most writers use it. T3 Code's instance still wrote
gateway.Token, so every call it made got 401. Air's and OpenChamber's
Checks compared against gateway.Token, so they said the wiring Sync had
just written was off.
The same mistake was in every writer that pairs gateway.URL() or
gatewayV1() with a fixed token:
- agy, Alma, Cindy, Claude Desktop, Copilot for JetBrains, Cursor's
local agent, OpenHanako, Pencil, VS Code / Insiders / VSCodium,
WorkBuddy-family models.json, ZCode (both files), Zed's credential,
Aside's provider, and the legacy Claude token rename.
- Fix: these now take agentKey(agent) or hereKey(), which are keyAt and
agentKeyAt for gateway.URL(). On loopback they are unchanged.
- Alma re-keys a provider that holds any of magpie's keys other than the
one it should have now.
- WorkBuddy and Aside also count the new key as theirs.
- ZCode treats a saved address equal to the pinned gateway as this
machine's, not another magpie's.
What was run:
- New tests: TestT3CodeKeyBeyondLoopback and
TestAirAndOpenChamberChecksTakeTheKeyForTheGateway (from the
reporter's patch), and TestPinnedGatewayKeyForEveryWriter, which covers
the other writers.
- With the product files reverted, all three are red. The T3 token reads
"magpie", and each of the 11 writers shows its old key. They are green
with the fix.
- go test -tags nogui ./internal/agent/ is green.
- gofmt -l and go vet are clean on darwin, linux and windows.
Not tried with a real T3 Code, Air, OpenChamber or a real pinned
MAGPIE_ADDR on a second machine.
akic404 runs a public magpie as the upstream and a local magpie that reaches
it as a remote magpie; with recording on, only OpenCode's conversations were
kept, on either side. The gateway records a turn only under the session the
client names (it never makes one up), and the configs magpie wrote for Pi and
omp didn't have them name one:
- Pi (1.1.0) sends x-session-affinity on Chat and Anthropic Messages only when
the provider's compat says sendSessionAffinityHeaders (Responses sends
session_id anyway). magpie's Pi provider block now sets it. A value the
user set in that block is kept through a sync and a pick (piBlockKept, for
pi, OmO and the aside's native Pi path).
- omp (18.6.1) sends its session header on Chat/Responses only to OpenAI
itself, unless the provider's compat.promptCacheSessionHeader names one
(pi-catalog 16.0.6+). magpie's omp provider entry now names
x-session-affinity for omp 16.0.6 and later; an older or unknown version
is left as it was.
withCaller already passes the session on to a remote magpie, so naming it
once is enough for both sides to record.
Run:
- Header dump (fake upstream LLM): real pi and omp with these provider
blocks send x-session-affinity / session_id on every API; without them,
nothing on Chat/Messages.
- End to end in sandbox HOMEs: an upstream (magpie web --gateway) and a
downstream (serve, remote magpie to the upstream), both recording; the new
binary wrote ~/.pi/agent/models.json and ~/.omp/agent/models.yml through
`magpie pi …` / `magpie omp …`; real pi (Chat and Messages models) and real
omp turns were recorded under gateway-conversations on both sides.
- TestPiNamesItsSessionToTheGateway and TestOmpNamesItsSessionToTheGateway
fail on the old code (no compat; Compat field missing) and pass now.
- go test ./internal/agent (-timeout 40m), gofmt -l, go vet for darwin,
GOOS=linux and GOOS=windows on internal/agent.
Aside keeps one folder per account (~/.aside/u/<id>, each with its own
settings.json, models.json, credentials.json and state.db), and which one is
in use is currentAccountId in ~/.aside/accounts.json, which the app and
`aside account use <id>` both set. magpie only ever wrote u/0 and asked the
runtime about --account u0, so with u1 active Connect changed an account
the reporter wasn't using.
- magpie now follows currentAccountId. An accounts.json that is missing,
doesn't parse, names no active account, or names one with no folder is
"unknown" and keeps u0, as before; it is never written.
- The Aside row gets an account field (under Details, shown only with more
than one account) listing each account with its e-mail or "Local
Account" and which one is active in Aside; `magpie aside account u1` does
the same from the CLI. The pick is kept in magpie's own
aside-account.json; Default removes it and follows Aside again. A pick
whose folder is gone is passed over.
- What magpie remembers to put back on Disconnect is per account
(aside-state.json for u0, as before, aside-state-uN.json for others), so
switching accounts never restores one account's model into another. The
legacy stash still migrates into u0's only.
- All runtime reads and writes go to `aside repl --account uN` for the
account in use.
- GUI strings in en, zh, zh-TW, ja, de.
Run: go test -tags nogui ./... in a sandbox HOME; new
aside_account_test.go uses the reporter's accounts.json bytes
(TestAsideFollowsTheActiveAccount, TestAsideUnreadableAccountsKeepU0,
TestAsidePickedAccountOverridesActive, TestAsideRestorePointsArePerAccount,
TestAsideKeepsModelsPermissions); with asideChoice forced to 0 the follow,
pick and restore tests fail, and with one shared record the restore test
fails. GUI: aside-account.test.cjs (chromium and webkit, 980 and 360px,
en/zh/zh-TW/ja/de) plus aside-native, i18n-keys, agent-field-names,
agent-layout and agent-models-picker, 45 passing. gofmt -l; GOOS=linux and
GOOS=windows go vet -tags nogui ./internal/agent ./internal/gui.
syncJSON and Pi's writeMagpie set providers.magpie to a freshly built
object, so a key magpie doesn't write there was dropped on every sync.
theirsKept now merges magpie's block into what the file holds: keys magpie
writes are its own, objects in both are merged key by key, and anything
else (compat, an options key, Crush's extra_headers) stays. The model list
is still magpie's whole, so a model gone from the catalog leaves it, and a
sync with nothing new writes nothing.
The same goes for every agent that writes the block whole: Pi and OmO,
Aside, Pencil, OpenCode (and the agents built on it), OpenChamber, Crush
and Command Code.
Verified: TestPiKeepsTheirKeysInMagpiesProvider (the reporter's
compat.sendSessionAffinityHeaders: true in Pi's models.json, through
SyncCatalog and a pick) and TestOpenCodeAndCrushKeepTheirKeysInMagpiesProvider
fail without the change ("compat.sendSessionAffinityHeaders dropped by the
sync", "opencode sync") and pass with it. go test -race ./internal/agent
and go vet ./... pass in a sandbox HOME.
* refactor(agent): connect Aside as a native provider with verified settings
* fix(agent): offer explicit offline Aside model and disconnect actions
Offer Save for next start after an initial runtime read failure, using a
structured API error instead of saved runtime state. Keep refusals and
failed readbacks on the live error path.
Add a separate offline disconnect confirmation that restores the checked
file plan, clears restore records and removes the provider last. Bind the
confirmation to its preview revision and roll back ordinary write failures.
Cover offline API and browser flows, cancellation, stale plans, missing
CLI, restore metadata and native provider spelling. Keep state file-only.