ac4af582301a4e8a29245dbba767eba31334ddf9
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
73a12e8bf6 |
wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file when that file already exists` (linusxiong). In the distro ~/.codex is a link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't follow a link the distro has: a mkdir of it says it exists, and nothing below it can be made, written, read or listed. ggbdpq found and explained the link (thanks); their patch, which takes that EEXIST as "there", wasn't used: the writes below the link fail next (its test passed because a symlink here is followed). The fix, for every agent folder and every writer through \\wsl.localhost: - The WSL probe asks `readlink -f` in the distro where each agent folder, its skills folder and the folders beside them lead (wslLinkPaths -> distro.Links; a $HOME that is itself through a link is left alone), and which drive each Windows mount is (win:/mnt/c C: -> distro.Drives). - distro.open opens a path at or below a link where it leads: on a Windows drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the distro, through \\wsl.localhost again. native spells it back through the link, so the agent is told its own path. - A link readlink couldn't resolve is never guessed at: distro.open errors, and the agent is unreached (Agent.Unreached: its notice says why; every field Set and Sync returns it). - Writers: the agents' own files (place.join/place.open, every filepath.Join(at.home, ...) in internal/agent), the library's WSL targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir), the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs). - Not changed: magpie's image MCP server opens arbitrary paths an agent in WSL gives it the same way; filed as #4578. Links deeper than the probed paths (other than <agent dir>/skills) aren't resolved. A distro probed by an older magpie has no Links until probed again (each run). Run: - Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex, .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway Windows test running the real probe with that HOME: probe said link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi, win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\ magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file when that file already exists" (the report's error). distro.open wrote SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both read back with cat in the distro through the links; .pi said "~/.pi in WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target removed after. - New tests with a fake distro whose ~/.codex and ~/.claude are links to /mnt/c/... that don't exist here, so, as through \\wsl.localhost, nothing below them can be made: TestWSLFolderIsALinkToC, TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink, TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved (agent). - Broken by hand: the library tests on the base (with a no-op FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the report's error; with ggbdpq's patch applied they still fail (the skill mkdir, and RTK's hook not written). - mote: go build ./...; go vet of agent, library, sessions, provider for darwin, GOOS=windows (and linux for agent, library); gofmt -l clean; go test -timeout 45m ./internal/agent ./internal/library ./internal/sessions ./internal/provider: all ok. - Windows (win-run): the same four packages. The new tests pass (the RTK ones skip: the fake distro runs sh). 32 tests are red, all already red at the base |
||
|
|
d06df18255 |
agent: magpie configures the Aside account Aside has active, or the one picked on its row (#1499, fjrtdk)
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. |
||
|
|
4a97acf12a |
refactor(agent): separate Aside provider connection from model settings (#827)
* 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. |
||
|
|
165fee0df5 | agent: an agent's own provider named as one of magpie's isn't magpie's, in every agent that spells a model provider/model (the rest of #835) — OpenHanako's own deepseek/deepseek-v4-pro read as magpie's deepseek, and so did a model of any agent's own provider whose name magpie has a provider by: Pi's, Crush's, Hermes's, OpenCode's relay/glm-4.6 with magpie's relay had the row connected on the agent's own model, and Disconnect from magpie put that model back and left the row connected. An agent says how magpie's values are spelled in it (Spelled, replacing #835's Prefixed): magpie/<ref> for Antigravity CLI, Pi, OmO, Aside, Goose, Zed, VS Code, Crush, DeepSeek Harness, Command Code, fx, omp, Hermes, Mister Morph, Kimi Code, Empryo, MiniMax Code, Droid, Qoder, Qoder CN, Grok Build, AtomCode, Cline and OpenHanako, whose every Get spells magpie's so (a sandbox Set of magpie/relay/glm-4.6 read back as that in each); for OpenCode, MiMo Code and OpenChamber also a provider of the config's own that sends to magpie's gateway, as openCodeRef names a model there. A stopped WSL distro's agent keeps its live one's. Left as they are: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, Copilot, Devin (magpie's are bare refs there), Muse Code (a model with / is magpie's by design: Meta's have none), Alma (its own are providerId:model), Air (magpie's only). TestOwnProviderNamedAsMagpies (26 agents: own relay/glm-4.6 not connected, Connect, Disconnect puts it back and the row is off) fails on the old code in each; TestOpenCodeGatewayProviderIsMagpies. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
c6875999b0 |
fix(agent): isolate Aside disconnect previews from the live daemon (#818)
* test(agent): reproduce Aside daemon calls during disconnect previews * fix(agent): isolate Aside disconnect previews from the live daemon |
||
|
|
28a830fc5c |
aside: magpie picks Aside's model, its thinking level, its four task models and its picture model (#789)
* aside: magpie picks Aside's model, its thinking level and its four task models (X: junjie — Aside Settings → Models has a Default model row magpie could not touch, and Fast/Standard/Deep/Visual rows it could not reach at all) Aside reads the same provider list Pi does, so magpie hands it the whole catalogue in a provider block of its own, carrying the magpie-aside token so its requests are told apart in usage. What differs is the default: Aside keeps it as one object in ~/.aside/u/0/settings.json naming the provider, the model, the thinking level and fast mode together, so the model field reads and writes two keys where Pi's are two strings, and both go through Aside's own settings API — the running daemon holds its default and writing the file behind it leaves the daemon on what it already had, read back the same way with the old model still named after magpie had written the new one. The API is reached through the repl, the settings command having no set of its own. The four task roles are the same shape as the default and are wired the same way, each a Quiet field following the model, so a role the user has not set is not a line of its own and follows the default. A role is written whole: thinkingLevel is required by Aside's schema and a role without one is refused, so a role keeps the level and fast mode it had, a new one takes the default's, and where neither is set it takes the level Aside gives its own roles. Taking magpie out puts every role back, the user's own model where there was one and nothing at all where magpie was the only thing that set it, and a role the user moved onto a model of their own is left alone. Each change checks the value that came back: Aside answers a set with the settings as they now are and drops what it will not take without a word — a role naming a model it has not resolved yet is the one that happens — so without the check a change that went nowhere read as one that landed. Caught, it is written to the file, which is what Aside reads at its next start, and the Agents page says so. The account magpie wires is 0: the folder is ~/.aside/u/0 while the CLI names it u0, and TestMain stands in for the binary so a test can never change the real Aside's default. A models.json carrying a magpie provider of someone else's is refused rather than written over, and one that will not parse is the user's to fix. With the owner's real Aside under a sandbox HOME: a pick reached the gateway and was attributed to a client named Aside, the default put the user's own minimax model back and took the magpie provider out, and a role set through magpie was read back by the running daemon the moment it had a magpie model to resolve. Not tried: a change written to the file taking hold at Aside's next start, which needs a restart. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... pass (TestBunThroughBridge fails, reproduced on a pristine worktree of the parent; internal/plugin passes alone and times out only under the full run's load). * aside: the row appears for an Aside that is installed and not yet used (the CI preview of #789 could not find .row.agent[data-id="aside"]) Detected() took ~/.aside/u/0, the account folder, and that only exists once someone has signed in. The binary was the other look and the CLI installer links it into ~/.local/bin, which a magpie launched from Finder has no PATH entry for, so an Aside that was installed and never used showed no row at all — the preview installed one, drove the UI and could not find it in either the installed list or the row selector. The installer writes ~/.aside/cli and the daemon writes the rest, so ~/.aside is the folder that is there from the install, and it is the one Detected() should ask about. Path stays the account's settings.json, which is the file magpie edits and the only one worth reading a model out of. TestAsideIsDetectedBeforeAnyAccount fails on the old Dir: it takes PATH away so the binary cannot be found either, makes the installer's folder and no account, and expects the row. * aside: a wedged repl gives up, and the model comes off through Aside (yetone on #789) Three things about the way out of an agent and into one, all found on a real Aside. The repl had no timeout. proc.Command(...).Output() waits as long as the command does, so a daemon that has wedged or one waiting on input leaves a pick in the Agents page or the CLI hanging on it, and switching off asks up to five times over — the default and four roles. proc.CommandContext with ten seconds: Aside answers in milliseconds, and a run that does not is written to the file instead, which is what Aside reads at its next start, with the notice that says so. TestAsideGivesUpOnAReplThatHangs runs the real command against an aside that never returns: it passes in the timeout, and without CommandContext it hangs until the test's own timeout kills it. Switching off with no model of the user's behind magpie's wrote settings.json directly. By then the provider block was gone, so the running daemon went on using magpie/… with no way to reach it, and asideStale was never set, so nothing said the change needed a restart. It goes through asideApply like every other change, with the value that came back checked. The provider block now goes last, after the default and the four roles are put back. A step that fails on the way out otherwise leaves the settings naming a provider that is no longer there. TestAsideDefaultTakesTheProviderOutLast watches the block from inside the settings step and fails on the old order. The icon is Aside's own brand-embossed-light.svg with the embossing's transparency taken off, so the mask is solid and takes the row's text colour like every other agent. As it was, the white fills at 8–20% opacity the dark and light brand files are built with left the mark almost invisible on a light row, and it vanished entirely in dark mode. Same paths, same shape, now solid; checked in the app next to Pi's. Tested against Aside 1.0.928.1 (daemon 1.26.928, CLI 1.26.916.1741) on darwin/arm64. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./internal/agent pass (408). * aside: the model Aside draws with is magpie's to set too (X: Aside Settings → Images had no row for it) Aside keeps a fifth model setting beside the default and the four task roles: imageGenerationModel, the provider and the model it draws pictures with and nothing else — no thinking level, no fast mode, since neither means anything for a picture — and no key at all on an account that has never picked one. It is a magpie field like the roles: Quiet, so it is not a line of its own on an account that has none, and taking the model after while it is unset. A model of magpie's needs the provider block to reach it through, and what it named before is remembered the same way a role's is, so `magpie aside model default` puts the user's own picture model back and takes a picture model of magpie's off rather than leaving it naming a provider that is no longer there. Not wired: customModels, which is the user's own model definitions with their own credentials, and asideModelCatalog, a list of model ids to pin or hide. Neither is a model magpie picked, so neither is a setting of magpie's to own. Aside 1.0.928.1, daemon 1.26.928. go vet, the agent/gui/profile tests, the three CLI cross-builds and the CLI verification under a temp HOME all pass. |