Commit Graph
6 Commits
Author SHA1 Message Date
zhou.han 9e86a2c7b7 proc: a Linux zombie no longer holds a lock (#1198)
yetihan (#1198): a lock whose owner is a Linux zombie was held for
good. process.kill(pid, 0) succeeds on a zombie, so 15 packages' lock
and liveness checks counted an exited, unreaped owner as alive.

- scripts/proc.mjs: processStatus(pid) is dead on ESRCH, and on Linux
  also when /proc/<pid>/stat says Z or X; EPERM is "permission", any
  other error "unknown". processAlive / processExists keep each
  caller's old EPERM and unknown-error meaning.
- scripts/sync-proc.mjs copies it into each package (--check in the
  tests); every package's own check keeps its old semantics, now with
  zombies dead. agent-console's daemon bundle and window-warmup's dist
  are rebuilt.
- 15 packages bumped.

Review run at 28ef6622 (mote, HOME=$(mktemp -d)):
- node scripts/sync-proc.mjs --check: ok.
- bun test (whole repo): 8934 pass, 0 fail.
- bun scripts/check.mjs: every package ok.
- window-warmup's build reproduces its dist/plugin.js byte for byte.
  agent-console's bundle diff read line by line: the proc module plus
  esbuild's renumbered imports, nothing else (esbuild isn't installed
  on mote, so it wasn't rebuilt there).
- Real zombie on Linux (WSL, magpie-desktop): a bash child left
  unreaped by an exec'd sleep, /proc stat "Z": the old kill(0) check
  says alive, processStatus says dead; the running process says alive.

Not tried: each package's lock contention end to end.
2026-11-16 12:19:09 +08:00
YangHonghang d54df279c0 window-warmup 0.1.4: Antigravity windows are warmed right after they reset, the service token survives restarts, and a new task opens at the bottom (YangHonghang, #878)
Antigravity-style idle cards (a resetsAt that rolls with each read, or the
old reset + 5h once a window has lapsed) are now read as idle and warmed
right after the reset; the service token is kept in the plugin's data
folder so an open page survives a host restart; a page whose token is
refused reloads once (an ww-reauth=1 marker in its URL stops a reload loop
and is removed after the next good request); a new task opens at the
bottom of the list.

Reviewed at 108d4752539b12e18f52aec7e320cf069b159792, run on macOS (mote,
Bun 1.4.2, HOME and TMPDIR in the run's own folder, Playwright 1.62.0):
- packages/window-warmup `bun test`: 285 pass, 0 fail, 0 skip
  (browser.test.ts ran in Chromium and WebKit).
- `tsc --noEmit`: exit 0. `bun scripts/check.mjs window-warmup`:
  registry.json and window-warmup ok. dist matches a fresh build
  (tests/dist.test.ts).
- Broken by hand, each red in scheduler/server/app tests: the 60s gap
  guard, the revoke branch's `resetRolls = false`, the probe wake-up's
  minDelay, the per-resetsAt probe cap (probedFor), the alreadyReloaded
  guard, and reauthURL's marker.
- A review-only browser test (not committed): a sandbox="allow-scripts"
  frame reached through a guide page that location.replace()s to the
  service, then the token rotated twice. In both engines the frame
  reloads with ww-reauth=1, the marker is removed by replaceState after
  the next good request, and the second rotation reloads exactly once
  more. The first rotation reloaded twice (two in-flight 401s each call
  location.replace); it settles and does not loop.

Not tried: a real Antigravity account (the author ran it 2+ days in
Docker), Windows and Linux.
2026-11-09 11:50:38 +08:00
YangHonghang ba4b7b0545 window-warmup 0.1.3: a task's editor opens under its own row, and the footer link no longer restyles the editor's buttons (#752)
renderList used to append the task editor after every row, so opening a task that wasn't the last one, or starting a new task while saved ones were listed, put the editor at the bottom of the list. Now the editor follows the row it opened: under the clicked task, or under the new row at the top. The footer's 反馈问题 button had reused the `.link` class, so its 11.5px faint rule restyled the editor's 立即发送一次 and 重试 buttons. The footer now has its own `.foot-link`. window-warmup goes 0.1.2 -> 0.1.3.

The browser smoke test (Chromium and WebKit) checks three things. Opening the first of two saved tasks puts the editor right under that row and not last in the list. Clicking 新建任务 then puts it right under the new top row, with one editor and not last. 立即发送一次 computes to 12px while the footer computes to 11.5px.

Run at the reviewed head b5787fee (on mote, macOS, Bun 1.4.2, Playwright 1.62.0 Chromium + WebKit):
- package `bun test`: 265 pass, 0 fail, browser smoke included in both engines. The browser file ran again on its own: 6 pass, 0 fail.
- `tsc --noEmit` (typescript 5.9.3, @types/bun 1.4.4): exit 0.
- `bun scripts/build.ts` rebuilds `dist/` byte for byte.
- `bun scripts/check.mjs`: window-warmup passes.
- repo root `HOME=$(mktemp -d) bun test`: 5926 tests, 0 fail. Browser tests skip at the root because bun test doesn't read NODE_PATH.
- merges cleanly onto main f2dc68c1. PR CI (test, on-npm) green.

Broken by hand, rebuilt into dist/, browser file run again each time:
- Only the new-task branch put back (editor appended after the loop): red in both engines. The wait for the editor under the top row times out after 15s.
- Footer back on `.link` in index.html and style.css: red in both engines, with run 11.5px instead of 12px.
- The whole old renderList: red in both engines, with editorIsLast true and prevIsOpenRow false.
- Head restored: green in both engines.

Not tried: the page inside a real magpie window.
2026-11-05 14:56:39 +08:00
YangHonghang 0bd00f0c72 window-warmup 0.1.2: effort-variant caches keep their public models, and Report a problem carries anonymized diagnostics (YangHonghang, #726)
window-warmup 0.1.2 (@magpie-community/page-window-warmup).

- Candidates are now the model cache, /v1/models and the chosen list together
  (deduplicated by full id), so a cache that stores effort variants
  (antigravity's gemini-3.8-flash-high/-low/-tiered) no longer leaves an
  account with no models; layer 3 still keeps only public ids.
- A "Report a problem" link at the foot of the page: GET /api/diagnostics
  (read-only, no model request, works for fatal and read-only instances)
  builds an anonymized report (accounts and keys as acct-N / key-N, task and
  card names left out, free text scrubbed of emails, key-shaped strings,
  Bearer tokens, URL secrets and home user names, saveError included), and a
  two-step copy puts an issue link and the report on the clipboard inside
  magpie's sandboxed frame.

Reviewed at head bf66c2b7302c66395833bb3e93054a55901d77c1, with main 9bba5fed
merged in locally, on a Mac mini (macOS, Bun 1.4.2):
- bun test in packages/window-warmup: 259 pass, 1 skip (browser smoke without
  Playwright), 0 fail; the diagnostics file runs in milliseconds now, with no
  wait on a connect timeout.
- tests/browser.test.ts with Playwright 1.62.0: 4 pass in Chromium and
  WebKit, the sandboxed two-step copy included.
- tsc --noEmit ok; dist/ rebuilt with scripts/build.ts is byte-identical to
  the committed one; bun scripts/check.mjs ok for every package.
- Broken by hand, one at a time: exporting saveError without scrub turns the
  new EACCES /home/alice case red; baseView passing every host turns the
  baseView test red; an unsettled /v1/models fetch turns the unreachable
  gateway test red; dropping the home-directory rule turns both privacy
  tests red.
- Left as is: the header comment in src/diagnostics.ts still says 几十 KB,
  and the unreachable-gateway test connects to a port it has just freed,
  which another listener could take in between.
2026-11-04 22:20:07 +08:00
YangHonghang 3e24e22837 window-warmup 0.1.1: models hidden by a routing group are sent, not called missing (#712)
A model a routing group keeps out of /v1/models (Group.Unlists, which magpie
still serves) was taken for gone: the page's model list was disabled and
tasks failed with "模型 X 已不在 Magpie 的模型列表里" without sending.
window-warmup now also reads each provider's chosen models (providers.json
"models") and counts a model as present when it is in /v1/models or chosen:
in the catalog (fetchCatalog/accountsOf), the auto-model pick and a fixed
model's send check. A model known only from chosen has no effort metadata, so
it goes without reasoning_effort. A model in neither is still refused.
Two gateway-unreachable tests now check the error is passed through rather
than its exact wording, which varies with Bun's socket timing.

Review: window-warmup lives in this repo since #661
(packages/window-warmup) and is published to the dist branch, not npm. 0.1.1
is free (main and dist have 0.1.0). Not mover-backed. No new host,
credential, dependency or workflow change; providers.json was already read
and only its "models" list is added (no key text). magpie's Group.Unlists
doc confirms "a request naming one is still served". dist/plugin.js matches
a rebuild of src (dist.test.ts, run on Bun 1.4.2).

Run at 8f10bc07 on mote (Bun 1.4.2, HOME a temp dir as CI): bun test
packages/window-warmup 246 pass 1 skip (browser smoke) 0 fail;
bun scripts/check.mjs exit 0. PR CI green.
Broken by hand: layer 3 without chosen, candidates without chosen, the fixed
model check without chosen, the auto pick needing /v1/models, and entryOf
dropping "models" each turn their new test red. fetchCatalog not passing
chosen is caught only by the dist byte check, not by a behaviour test.

Not tried: a real magpie with an unlisting group (the author ran it on a
Docker magpie with zcode GLM-5.3). A switched-off provider's chosen models
also count as present now, so its old tasks send and get the gateway's
error instead of the local one.
2026-11-04 15:24:16 +08:00
YangHonghang 1ab8238ade window-warmup 0.1.0: a page that sends a short message after a quota window resets, daily or every few hours (#661)
Adds packages/window-warmup (@magpie-community/page-window-warmup 0.1.0), by YangHonghang:
a page plugin whose host part runs a service on 127.0.0.1:3492 and, on a schedule
(after a quota window resets, daily at a set time, or every N hours), sends "hi"
with max_tokens 16 through magpie's gateway to a provider/account/model the user picks.
The registry entry moves from the author's own npm package magpie-window-warmup to this one.
The package README opens with the zh/en warning that sends spend real quota and that some
vendors (Claude subscriptions especially) may treat scheduled requests as unusual use.

Reviewed at 07a0b217adb2a111f839c984cbc955c5bb45b68d:
- Outside packages/window-warmup only README.md and registry.json change; no workflow and no other package.
- The service binds 127.0.0.1, checks Host (DNS rebinding) and Origin (null or itself),
  needs a per-process 32-byte token on /api/*, and serves the index with a nonce CSP.
- It reaches only MAGPIE_ADDR (default 127.0.0.1:3425). providers.json is read for sha256
  key fingerprints only; no spawn, eval or outside hosts.
- A window task sends at most once per resetsAt (or once per hour when idle); daily/every
  tasks catch up only the latest missed point, once.

Run on mote (bun 1.4.2):
- HOME=$(mktemp -d) bun test at the repo root: 5142 pass, 15 skip, 0 fail.
- scripts/check.mjs ok.
- packages/window-warmup bun test: 242 pass (dist.test rebuilds dist byte for byte).
- browser.test.ts with Playwright 1.62.0: chromium and webkit pass. Bun ignores NODE_PATH,
  so it needs node_modules/playwright linked and PLAYWRIGHT_BROWSERS_PATH set under a temp HOME;
  without them it skips.
Not tried: a real send through a live magpie gateway, and tsc --noEmit (no typescript on mote).
2026-11-03 15:43:10 +08:00