ccb75030aaba3cf7359ea2dd784c00ecc7e80c19
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0ac26fb52d |
update: a magpie a package manager installed leaves updating to it (shuhai on Discord, AUR magpie-bin)
shuhai (Arch) installs magpie from the AUR's magpie-bin, which puts the desktop build at /usr/bin/magpie. magpie's own updater saw a folder it can't write and pkexec on the machine, so it downloaded the release and, on restart, replaced the package's file as root. pacman's database then no longer matched the file, and the next `yay` upgrade (magpie-bin lags the releases, 0.1.2342 against 0.1.2357 today) put an older magpie back. The two updaters fought each other. Now magpie asks first who owns the binary it runs from (update.PackagedBy): pacman's local database, dpkg's .list files, rpm (`rpm -qf`, only where /var/lib/rpm exists), a Homebrew Cellar path or /nix/store. Only a system path counts (/usr but not /usr/local, /bin, /sbin, /opt), with merged-/usr aliases, and packages named magpie* are looked at first. A packaged binary: - GUI: the update is shown as available with "pacman installed magpie (magpie-bin), so pacman updates it, not magpie: yay -S magpie-bin" (apt, dnf, brew likewise; Nix with no command). Nothing is downloaded, there is no Download or Install, the Update pill isn't lit, and /api/update/install does nothing (state available, stuck "package"). - `magpie update` says the same and exits 1 before downloading. This takes the place of the Homebrew-only check it had. An unpackaged magpie (~/.local/bin, /usr/local/bin, a file pacman doesn't list in /opt) updates itself as before. Run: - mote: go test -tags nogui -run 'Packaged|Homebrew|NotWritable|InContainer' ./internal/update ./internal/gui ./internal/cli ok; full go test -tags nogui -count=1 -timeout 45m ./... at |
||
|
|
e6b851b0fe |
update: magpie update in a terminal restarts the app with its gateway handed over
gaubeebangeel on X has an agent run the magpie upgrade at 4am and had
to give that agent its own provider: magpie couldn't serve it through
the upgrade.
Cause: `magpie update` put the new version in and printed "quit and
reopen magpie to use it" (a .app) or "updated to X" (a binary). The
running app never restarted, so the agent (or the user) had to restart
it by hand, and a plain restart closes the port and drops streams.
Measured before, on mote, a sandbox HOME `magpie serve` with a fake
upstream streaming 61 chunks at 100ms, restarted by SIGTERM + start:
- the stream was cut at chunk 15 of 61 (unexpected EOF); SIGTERM to exit
took ~18ms, no drain;
- requests during the restart: 289 answered, 5 refused over 87ms.
Now `magpie update`, once the new version is in, POSTs it to the
running app's /v1/magpie/restart (gateway/restart.go). It is answered
only to a program on this computer over loopback; a LAN caller, a page
(Origin / Sec-Fetch) and another Host get 403. The updater's
restartBeside (gui/update_beside.go) restarts only when its own exe was
the one replaced (replaced() now also compares a .app's binary,
bundleExe), takes the version as ready without the feed, and runs the
same restart as Settings' AutoRestart: at once when it cuts nothing
short, else through waitIdle. On macOS and Linux that restart is the
existing SCM_RIGHTS handover, so the port never closes and in-flight
streams finish in the old process. The command prints what happened:
restarting (handing the gateway over), waiting for N requests, another
copy (current), magpie serve (unsupported), not running, or too old
(404: the first update into this version still needs a manual
restart).
Tests:
- TestUpdateInATerminalRestartsTheAppWithoutCuttingIt (darwin, linux):
a stream through the gateway, the exe rewritten, magpie update's ask
answered "restarting" with handover; the successor serves a request
while the stream runs, the stream ends whole, the old one quits only
after it. Red by hand with the route removed ("magpie update's ask:
404").
- TestUpdateOfAnotherCopyLeavesTheAppBe, TestRestartAskedOnlyFromThisComputer
(refused cases never reach the restarter), TestUpdateAsksTheRunningMagpieToRestart
(each reply, a 404 magpie, none running).
Run at this tree:
- rebased on
|
||
|
|
4a33cf0a98 |
update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).
- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
shows every release since the installed one (up to 1500) instead of
the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
channel keeps it; switching asks the feed again at once, and a
download from every version newer than Stable's pick is dropped,
never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
privacy pages (en, zh, ja) name ?channel=stable on /api/latest.
The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.
Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
GOOS=windows for ./internal/update/... ./internal/cli/...
./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
./internal/settings/...: ok. ./internal/gui -run
'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
900 and 420 wide: default lit, Stable saved, kept by another save,
kept over a reload, Every saved back, no click scrolls, no sideways
scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
assets after the first real cron run filled the ledger (400 releases
back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
empty (1213 and 1218 were never published).
After rebasing on
|
||
|
|
ff670797a1 |
gui: an update found waits for Download update when Settings' Download updates automatically is off (#2296, meifu2027)
On a metered network or a proxy billed by traffic, a newer version was
downloaded as soon as a check found it, by the clock or by Settings'
Check. Settings → About now has "Download updates automatically", on by
default (as before). Off (settings.json noAutoDownload):
- a check, by the clock or by a click, only reports the version: the
version row says "{v} is out · {size} MB" with its notes, and the
header's Update pill shows; the updater's state is "found";
- "Download update" on that row, or a click on the pill, posts
update/install, which downloads it (updater.download) as a retry does;
- a version downloaded on a click stays ready: a newer one found later
isn't fetched over it;
- a settings save that doesn't send the field keeps it (api.go), so an
older page can't switch it back on.
CLI: `magpie update auto notify|download` sets it, and the status says
which. The proxy-change retry in api.go goes through the same run, so it
respects the setting too.
hold() (the click guard that keeps what was clicked in place) took a
zero-height element as its anchor: the empty .val beside Settings' Add
to PATH. "Moved by less than half its height" never held for it, so
once the new row made About 27px taller than a 900x760 window, the click
slid the view 11px off its top (cli-path.test.cjs, red on this branch,
green on origin/main where About couldn't scroll). hold now prefers an
anchor with a height, and falls back to the old choice.
Run:
- go test -tags nogui ./internal/gui ./internal/cli ./internal/settings
(sandbox HOME): ok (gui 547s, cli 678s; settings ok 253s). A first run
with the default 10m timeout lost cli to it at load ~100
- TestUpdateDownloadWaitsForAClick broken by hand three ways, red each
time: no `case hold` (Check gave ready, 1 download); no api.go keep
("a save without noAutoDownload turned it off"); no `|| hold` ("a
newer one, downloads held: found 0.1.12").
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
gui, cli and settings: ok.
- GUI: update-download.test.cjs (en, zh, zh-TW, ja, de at 1100 and 420)
passes in Chromium and WebKit; breaking the found case times it out.
cli-path, click-scroll and update-download pass in both engines after
the hold fix. Every GUI test that checks scrolling (327
files): Chromium 2261 pass, WebKit 2263 pass,
6-wide at load ~100. Red: refusal-retries-setting ja 420 (#2258; base
|
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |