ac4af582301a4e8a29245dbba767eba31334ddf9
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0d70f335ec |
agent: the disconnect preview of a plugin's agent shows what it puts back, not nothing (plugins#799)
Purfeather found that disconnecting MiniMax Design (an agent a plugin adds)
showed the dialog's generic sentence: /api/agents/.../disconnect-preview
returned changes: []. The preview runs Disconnect in a process whose HOME
(and APPDATA, LOCALAPPDATA, XDG_*) is a temporary copy, but a plugin agent's
stash key is "plugin:<id>:" + the file's whole path, so the copied
stash.json named the file under the real home. The dry run found no stash,
read the agent as not on magpie, and changed nothing.
The same holds for every built-in whose stash key carries its file's path
(Droid, AtomCode, Cline, Qwen, Kimi, Zed, Hermes, Muse, Snow, ...): their
previews found the file wired but not what to put back, and showed magpie's
lines taken out instead of the user's model going back.
The fix is in one place, DisconnectPreview: after copying magpie's files it
rewrites the copy's stash so each key naming a path under home names it
under the copy's home (moveStashKeys/movedKey; a separator must follow
home, and Windows compares without case, since %APPDATA% can spell the
home folder otherwise). The real stash, its key format and the real
connect/disconnect are unchanged, so stashes users already have keep
working and nothing is migrated. A stash that is missing or doesn't parse
is left as it is.
Run at this head (
|
||
|
|
0cabaaf243 |
agent: a portable VS Code on a Mac is wired in its code-portable-data folder (#4151)
faketrader runs VS Code portable on a Mac: /usr/local/bin/code links into /Applications/Code/Visual Studio Code.app, and the build reads /Applications/Code/code-portable-data/user-data/User. magpie detected it but wrote ~/Library/Application Support/Code/User, which that build never reads. Their patch on #4151 is the base; this takes its rule and makes it VS Code's own (configurePortable in src/bootstrap-node.ts), on every OS: - A build is portable when its product.json has no `target` (an installer's build has one) and its data folder exists: on a Mac product.json's `portable`, else `<applicationName>-portable-data`, beside the .app; on Windows and Linux `data` beside the install, also for a build that updates into `<install>/<version>/resources/app`. - The build is the one the launcher on PATH is, through a Scoop shim and every symlink. A launcher whose product.json names another editor (a fork's `code`) isn't the build's. With no launcher of its own, a Mac reads the app folders and Spotlight and takes a portable bundle only when every bundle found is that one; beside an installed bundle, which one runs is unknown and nothing moves. - VS Code, Insiders and VSCodium each go by their own bundle and launcher. - User and extensions come from one place (vscodeDirs): connect, Sync, profiles and Disconnect use the portable User folder, and Zoo Code is found by its extension in <data>/extensions and writes its import file there. Windows' Zoo Code under Scoop looked in ~/.vscode/extensions. - Disconnect's preview is refused for a file in a portable data folder: the preview's child keeps PATH, and its launcher would reach the build's real files, not the copy. That also covers Scoop under home on Windows, which main previewed. - An installed build with no portable folder keeps the OS's folder and ~/.vscode/extensions, unchanged. #3260 and #4009 (Windows): |
||
|
|
e50d73aa36 |
agent: disconnect previews sweep sandboxes a killed magpie left (#3136)
DisconnectPreview builds its dry-run sandbox with os.MkdirTemp and cleans it with a bare `defer os.RemoveAll(tmp)` (internal/agent/preview.go). Two consequences reported by OldSuns: when the removal fails (on Windows the dry run's bun host still holds magpie-bun.exe after cmd.Run returns) the error is dropped and the sandbox - each with an 86 MB bun re-downloaded into it - stays in the temporary directory for good; 12 dirs / 985 MB in the report, 99 dirs in ggggggggggz's. And nothing ever reclaims sandboxes left by a killed magpie, unlike the cursor snapshots, whose sweepCursorSnaps removes stale magpie-cursor-* copies. The change: DisconnectPreview sweeps magpie-preview-* folders older than an hour (a live preview lasts seconds; the dry run is bounded at 20 s) before creating its own, the way the cursor snapshots do; cleanup goes through removePreview, which retries while processes are still letting go of files (5 tries, 0.1 s-0.5 s apart) and logs the error instead of dropping it when it still cannot remove the folder. Only the reported prefix is swept; the other magpie-* temp prefixes have their own lifecycles (#2321, cursor_snapshot.go). Each sandbox also holds a copy of magpie's config folder's files (logins.json, providers.json and the rest, copyTop), so a sandbox the removal left behind kept the user's sign-ins in the temporary folder for good. The sweep takes those too. Reported by OldSuns, ggggggggggz and track23; the fix is skygunner's branch fix/3136-agent-magpie-preview-86-mb (98e5e7bc7), ported as it is apart from the test: it now sweeps a temp dir of its own (TMPDIR, TMP and TEMP set to t.TempDir()) instead of the machine's, where it could take another magpie's stale sandboxes. What was run (on the ported tree): - TestDisconnectPreviewSweepsStaleSandboxes with sweepPreviews() taken out by hand: red ("a stale sandbox is still there after a preview"). - go vet ./internal/agent/ for linux, windows and darwin: ok. - go test ./internal/agent/ on mote: ok 170.4s. - Windows (xiaomi-gpu, win-run): go test -run 'TestDisconnectPreview|TestRemovePreview|TestPreview' ./internal/agent/: ok 7.8s. - On mote, the built binary's agent-disconnect-dry-run for opencode, claude and codex under an empty sandbox HOME, then with a plugins.json naming an OpenCode plugin: nothing downloaded, the sandbox stayed at 8-12K. Not reproduced: the 86 MB bun and the pnpm install inside a sandbox. The reports are from v0.1.1223; on main the dry run started no plugin host in the cases above, so nothing here changes where bun comes from. The sandboxes it left are what this removes. Refs #3136 |
||
|
|
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. |
||
|
|
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 |
||
|
|
c744a097b6 |
agent: avoid panics in disconnect preview masking (#788)
Check for a key/value match before indexing its value boundary. Compact JSON arrays and TOML table headers can contain secret-related words without matching that pattern. Cover both cases in TestMask. |
||
|
|
661d27b560 | agent: the disconnect preview right on Windows, and the Codex panel says what connecting does (owner: 去 Windows 测试机上测一下 / 是不是需要界面上解释一下现在的逻辑) — on the Windows test box Claude Code's and OpenCode's disconnect previews were empty though both were connected. Claude: the dry run's temporary home has no ~/.codex/auth.json, so a codex/… model wasn't magpie's there; the magpie asking now writes the providers it has on into that home and the dry run takes their models as magpie's (TestDryRunKnowsTheAskersProviders). OpenCode: magpie/codex/gpt-6.1-sol, a model its copy of magpie's list didn't have yet, read as not connected and Disconnect left it on magpie; a magpie/… value whose model magpie routes is magpie's (TestOpenCodeOnAModelNotInItsList). The preview pairs a line going back only with one as deep (Claude's model, not a modelPicker row) and doesn't mask …_TOKENS counts. The Codex panel, joined: 「重开 Codex 后,/model 里自己的模型照旧,magpie 的模型也在里面。」, and 新会话默认 says 「和 Codex 的 /model 是同一个选择,在哪边改都行」 rather than 「不设就用 Codex 自己上次的选择」 beside a value (/api/state: joined). On Windows (sandbox USERPROFILE/APPDATA, real accounts): previews for Claude, OpenCode, Codex and Gemini; disconnecting all four restored them (Claude back to opus, Gemini to Google sign-in, Codex keeps its [model_providers.magpie] by design), real ~/.claude untouched; real Claude Code requests via yylx/claude-opus-5-5 and codex/gpt-5.5 answered. The new tests fail on the old code. go vet, builds (darwin, GOOS=linux, GOOS=windows), go test -tags nogui -count=1 ./... under a temp HOME and the 34 agent GUI tests pass but cli-update, menu-scroll and old-webkit, which fail on main too. | ||
|
|
d0d098c69f |
agents: the 「接入」 boards filled in — the opened row as designed, real accounts tried
- The opened row follows the boards: what to do in the agent, running copies with the old list, Claude Code's tiers (each with its own effort beside its model again, #536), the model list by whose models they are with what's hidden, the model new sessions start on, what connecting costs (Gemini's Google sign-in), and the files put back on disconnect, shown line by line. - Disconnecting asks first and shows the lines it puts back. Secrets are masked, and a config of tens of thousands of lines diffs in a fraction of a second. - Connecting prefers the agent's own subscription when magpie serves it (Claude, Codex). - The dry run goes through proc. - Every model hidden still keeps the row connected, with the way back to the list (#356). - Routing groups are named in Chinese. - Phone widths: the pickers and squares wrap inside the opened row, and the name stays beside its logo. GUI tests moved to the new rows: connected fixtures carry refs and open the row from its link. tier-effort and mobile-web each found a real gap and now guard the fix. Tried in a sandbox HOME with the owner's real accounts: - Claude Code: connected, a request answered, and disconnect restored the settings exactly. - OpenCode: a request answered. - Gemini CLI: connected. - Codex: connected. - Model list picks were saved. go vet, builds (darwin, GOOS=windows, GOOS=linux -tags nogui) and go test -tags nogui ./... under a temp HOME pass. The agent GUI tests pass except cli-update's tight-row case, menu-scroll and old-webkit, which fail on main too. |