Files
magpie/internal/update
yetone ca87ae9c59 update: an x64 magpie emulated on Windows on Arm updates to the arm64 build (EV_John_Liu on X)
EV_John_Liu on X: "能不能出个windows on arm的版本啊…看到magpie是转译的".
magpie ships magpie-windows-arm64.exe and magpie-cli-windows-arm64.exe,
and the site's Windows button offers it on Arm, but an x64 install on an
Arm64 computer fetched the x64 build on every update and stayed emulated.
update's arch() swapped only an Intel Mac under Rosetta.

- internal/winarm: Emulated() asks IsWow64Process2 (x/sys/windows) once;
  an amd64 build whose nativeMachine is IMAGE_FILE_MACHINE_ARM64 runs
  emulated. A failed call (no IsWow64Process2 before Windows 10 1709)
  means not emulated. false off Windows.
- update: arch() gives arm64 for windows/amd64 when emulated, so
  BinaryAsset picks magpie-windows-arm64.exe (GUI) and
  magpie-cli-windows-arm64.exe (CLI). The swap is the x64 one: canStart
  starts the downloaded exe (it runs natively there), the running exe is
  moved aside, the arm64 one renamed in under the same name, and
  magpie.com is rewritten from the new app's own launcher.
- pii (sibling found on the way): pf-serve has no windows-arm64 build.
  After the switch an arm64 magpie looked for a windows-arm64 pf-serve,
  found none, and left Privacy Filter / AstrLink Guard "not downloaded"
  while on. target() now maps windows-arm64 to the x64 pf-serve Windows 11
  runs emulated; candidates() runs it on the CPU (the x64
  pf-serve-vulkan has no x64 Vulkan driver there), then pf-serve-base
  for an emulation without AVX2. The guard's status says emulated
  (Status.Emulated), and its row reads "On, slowly under x64 emulation:
  the next update installs magpie for Arm" in all five languages, like
  the Rosetta line. app.js's and the core's script budgets grow by its
  66 bytes.
- gui feedback: the diagnostics block's Arch line says
  "amd64 (emulated on arm64)" / "amd64 (under Rosetta on arm64)".

Checked, not changed:
- site/public/index.html: the Windows main button already turns to
  /download/windows-arm64 when userAgentData's architecture is "arm".
  Run in Playwright Chromium and WebKit with a Windows Edge UA and
  injected userAgentData: arm -> windows-arm64; x86 and no
  userAgentData -> windows-amd64.
- telemetry (stats "arch") sends the build's GOARCH; left so, since what
  is sent and the privacy text stay as they are. After the update it is
  arm64 by itself.
- rtk: an arm64 magpie no longer upgrades a standalone x64 rtk.exe
  (rtkArch == "amd64" only), filed as #6896.
- claudecode (win32-arm64) and Bun (windows-aarch64) downloads already
  have arm64 builds.

Run (worktree at origin/main 17da22414):
- mote: go test -count=1 ./internal/winarm ./internal/update
  ./internal/pii ok; ./internal/gui -run Feedback ok.
- mote: go vet ./... ok; GOOS=linux go vet -tags nogui ./... ok;
  GOOS=windows go vet ./... ok; GOOS=windows GOARCH=arm64 go vet of
  winarm, update, pii, gui ok; darwin, windows and linux builds ok;
  gofmt -l clean.
- mote: node --test privacy-model.test.cjs (Chromium and WebKit, five
  languages, two widths) ok; i18n-keys' "a plugin's words are its own"
  is red at this base on claude_image_budget_test.go's ", with an
  image", already #6877.
- xiaomi-gpu (x64 Windows 11, real IsWow64Process2 saying not
  emulated): win-run go test ./internal/winarm, ./internal/update -run
  'WindowsOnArm|Rosetta|Asset|InstallBinary', ./internal/pii -run
  'ArmWindows|GuardNow|Base', ./internal/gui -run Feedback ok.
- magpie-desktop (WSL2): winarm, update, pii ok; gui -tags nogui -run
  Feedback ok.
- mote: go test -count=1 -tags nogui -timeout 45m ./... : every
  package ok but internal/gui's TestCoreScriptBudget (app.js 66 bytes
  over: the new pmSub line). The budgets are raised by those 66 with
  why (pmSub draws every Privacy row, no lazy page to move it to);
  internal/gui then ok in full.
- mote: gui-de, gui-ja, gui-zh-tw, i18n-en-no-cjk and the three other
  privacy-*.test.cjs, in Chromium and WebKit: 28 of 28 each. Not the
  whole GUI suite: the change is one string in one row, no API,
  selector, CSS or layout.

Broken by hand (each red, then restored):
- arch() without the windows clause: TestWindowsOnArmUpdatesToArm64
  (BinaryAsset magpie-windows-amd64.exe) and
  TestWindowsOnArmInstallsArm64Exe (magpie.exe still "2.0 for x64").
- pii target() without the mapping: TestArmWindowsRunsX64Serve
  (target windows-arm64, Supported false); candidates() without the
  Arm branch: its subtests start pf-serve-vulkan.
- Status without Emulated: TestGuardNowSaysEmulated.
- archNote without the emulated case: TestFeedbackArchSaysTranslated.
- app.js without the emulated line: privacy-model's "AstrLink Guard
  says what runs it" red in every language.

Not tried: real Windows on ARM (no such machine); detection is injected
in the tests, and the real call was only seen saying "not emulated" on
x64 Windows.
2026-11-17 04:29:02 +08:00
..
update, gui: a new version Windows won't start is never left in place — tried before it goes in, and a restart into one that doesn't say it is up puts the running one back; that version isn't downloaded again by the clock, and Settings › About › Version says why (#894, hisiling) — on Windows 11 with Smart App Control on, the update put the new unsigned exe in place of the running one and restarted into it; CodeIntegrity (3033/3077) refused it, magpie never started again and the working version sat in .old. Now, on Windows, the downloaded exe is first started suspended with no window and ended at once (Windows checks a program when its process is created), and one refused stays out: the running exe isn't moved. At the restart the new process is given MAGPIE_STARTED, a file it writes first thing (AwaitPredecessor); the old one waits up to 20s for it and, if the start fails (ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION 4551, 1260 or any other), the new process quits before saying so, or it says nothing in time (then it is ended), puts the running exe back over the new one (the new one renamed .blocked if it can't go) and keeps running instead of quitting; nothing notes it as updated in the app. The version is noted in the config folder (update-blocked.json, this machine's only, never synced; gone once a version at least as new runs); the clock's checks leave it alone and show why, a Check clicked downloads and tries it once more. Settings › About › Version: for an application control policy, "0.1.x didn't start on this computer: Windows' Smart App Control (or another app control policy) blocked the new version, which isn't signed. magpie stays on 0.1.y. Download it and run it yourself, or turn Smart App Control off and check again", else the reason, with Download and Check; the error in full on hover. en/zh/ja/de. A user who double-clicks the refused exe is refused by Windows before magpie runs; only signing helps there. TestRelaunchRefusedPutsBack (4551 at the start), TestRelaunchSilentPutsBack (no word in time, killed; quit at once), TestRelaunchReportedStays, TestReportStarted, TestBlockedNote and TestUpdateThatWontStart (the restart doesn't quit, the note, the clock not downloading it again, a Check that does) are new and fail without the change; on Windows TestInstallBinaryRefusedStaysOut, TestTrialStart and TestStartCheckedPutsBackForReal (real processes: not a program, quits at once, runs on silent) pass on the Windows 11 test box with the whole internal/update package (Smart App Control itself isn't on there, so the refusal is simulated). update-blocked.test.cjs (Chromium and WebKit, en and zh: the reason and both versions, full error on hover, Download opens the release, Check downloads, the other reason, no select, no scroll, no left border) fails without the change; update-check, update-mirror, update-auto, update-wait and update-download-percent pass in WebKit; click-scroll's request-list case fails now and then the same on main. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
2026-10-05 19:43:31 +08:00
update, gui: Settings › About › Command line says what magpie runs in a new terminal and adds it (PAMI on Discord) — the app downloaded from the site, and every Windows one, left terminals without the magpie command, and nothing in the GUI said whether it was there. A Command line row now asks each shell installed (zsh, bash, fish and the login shell; PowerShell and cmd on Windows) for its PATH and says, with a dot each, whether its magpie runs this app, another copy (with that copy's version, read from its .app's Info.plist or Homebrew Cellar folder, never by running it), or none. Add to PATH links this app's program (Homebrew's opt link, the AppImage) into the folder on the default shell's PATH whose magpie runs first, else ~/.local/bin or the like when on PATH, replacing another copy there as install.sh's ln -sf does; on Windows it puts the app's folder first in HKCU\Environment Path and broadcasts WM_SETTINGCHANGE. A shell whose PATH lacks that folder gets its own button naming its profile (~/.zshrc, ~/.bash_profile on the Mac or ~/.bashrc, fish's config.fish), which links into ~/.local/bin and adds that folder with one marked line, once; no profile is written otherwise. A translocated or disk-image app is told to move first and gets no button. It says new terminals take the change (on Windows: new PowerShell/cmd windows, restart Windows Terminal). GET/POST /api/cli; en/zh/ja/de. TestCLIOnPath (temp HOME, stubbed shells: link, fish profile once, a shadowing copy replaced, no folder → zsh's profile kept and appended, an unknown shell refused, plist version, translocated refused) and TestPathFirst are new; cli-path.test.cjs (WebKit, en and zh: per-shell dots, Add posts {} and turns green, fish's button posts fish alone, Windows lists PowerShell and cmd, translocated gets no button, no scroll, no select, no left border, translations) fails without the change; cli-behind and update-auto pass. Not tried on a real Windows machine. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestOTelWholeWaterfallFallback and TestDevinSignedInOnlyInMagpie failed once each under load and pass alone).
2026-10-05 17:49:20 +08:00
update: What's new and the waiting update's notes follow the app's language (freecss on Discord: 更新后的公告的语言是不是应该设置里面的走) — the release notes were English alone. A release's notes are to carry a Simplified Chinese translation below a <!-- lang:zh --> marker (the magpie-releases workflow, changed separately); usemagpie.ai's /api/latest and /api/notes take ?lang=zh for the Chinese where a release has it, and give anything else, an app from before included, the English alone, everything above the marker. The page asks /api/whatsnew, /api/update and /api/update/check in its own language (?lang=); magpie asks the site in it, keeps What's new's notes per language, and asks again for the waiting update's notes when a page's language isn't the one they are held in (at most once a minute); a check by itself asks in the pages' last language, else the app's, as the tray menu has it. Notes that come back whole (a site not yet deployed) are cut in the app too; notes without the marker (every release so far) are English, in either language. The worker must be deployed (npx wrangler deploy in site/) before the workflow change ships, or apps would get both languages. TestInLang, TestFeedsAskInLang, TestAskedLang, TestWhatsNewInPageLang, TestUpdateNotesInPageLang, site/worker.test.mjs (node --test site/worker.test.mjs), whats-new.test.cjs's language check (Chromium and WebKit, en and zh); update-check, update-hide, update-auto, sync-update pass in WebKit. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeRunEndsWhenTheClientLeaves flaked once under the full run, passes alone; gateway untouched).
2026-10-02 11:31:11 +08:00
update, gui: a new version Windows won't start is never left in place — tried before it goes in, and a restart into one that doesn't say it is up puts the running one back; that version isn't downloaded again by the clock, and Settings › About › Version says why (#894, hisiling) — on Windows 11 with Smart App Control on, the update put the new unsigned exe in place of the running one and restarted into it; CodeIntegrity (3033/3077) refused it, magpie never started again and the working version sat in .old. Now, on Windows, the downloaded exe is first started suspended with no window and ended at once (Windows checks a program when its process is created), and one refused stays out: the running exe isn't moved. At the restart the new process is given MAGPIE_STARTED, a file it writes first thing (AwaitPredecessor); the old one waits up to 20s for it and, if the start fails (ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION 4551, 1260 or any other), the new process quits before saying so, or it says nothing in time (then it is ended), puts the running exe back over the new one (the new one renamed .blocked if it can't go) and keeps running instead of quitting; nothing notes it as updated in the app. The version is noted in the config folder (update-blocked.json, this machine's only, never synced; gone once a version at least as new runs); the clock's checks leave it alone and show why, a Check clicked downloads and tries it once more. Settings › About › Version: for an application control policy, "0.1.x didn't start on this computer: Windows' Smart App Control (or another app control policy) blocked the new version, which isn't signed. magpie stays on 0.1.y. Download it and run it yourself, or turn Smart App Control off and check again", else the reason, with Download and Check; the error in full on hover. en/zh/ja/de. A user who double-clicks the refused exe is refused by Windows before magpie runs; only signing helps there. TestRelaunchRefusedPutsBack (4551 at the start), TestRelaunchSilentPutsBack (no word in time, killed; quit at once), TestRelaunchReportedStays, TestReportStarted, TestBlockedNote and TestUpdateThatWontStart (the restart doesn't quit, the note, the clock not downloading it again, a Check that does) are new and fail without the change; on Windows TestInstallBinaryRefusedStaysOut, TestTrialStart and TestStartCheckedPutsBackForReal (real processes: not a program, quits at once, runs on silent) pass on the Windows 11 test box with the whole internal/update package (Smart App Control itself isn't on there, so the refusal is simulated). update-blocked.test.cjs (Chromium and WebKit, en and zh: the reason and both versions, full error on hover, Download opens the release, Check downloads, the other reason, no select, no scroll, no left border) fails without the change; update-check, update-mirror, update-auto, update-wait and update-download-percent pass in WebKit; click-scroll's request-list case fails now and then the same on main. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
2026-10-05 19:43:31 +08:00