ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b295d11965 |
serve, update: one magpie works the gateway; the service waits, the copy an update left stops (#4938)
ox01024's #4938, Bug 2. Two magpies did the gateway's work at once on a Mac: - launchd's com.yetone.magpie.serve ran `magpie serve` beside the app. It ran startUp (plugin Settle/Refresh, FoldCopies, Hold, the agent moves), the plugin host and every account's model fetch, then failed to bind, exited 1 and was started again 5s later: 6,035 times in two days, a 279MB serve.log, and logins.json.lock held against the app's requests until they went 504. - The copy an update left (.magpie-update/old) handed the socket over, hid, and lived on ~3h, its loops writing beside the new one. What changed: - cli: `magpie serve` (no --web) checks codexrelay.Leave, gateway.ServedBy and gateway.Taken before startUp, as the app's serveGatewayLocked does. While the port is held it prints one line and looks again every 15s, doing nothing else. Once the port is free it serves (serve_wait.go). It waits rather than exiting 0: under KeepAlive SuccessfulExit:false a clean exit would leave no service after the app quits. - gui: after a handover the old magpie's loops end with backendCtx: - library.KeepLinked (now takes a ctx), - provider.WatchQuotas, - the menu bar usage loop, - the updater's check/auto-restart loop. lighten lets its hidden webviews go as lightweight mode does, so their polls stop. quitBy exits it at handedOffDrain + 3m whatever holds its quit up (gateway.HandedOffDrain getter; exitNow stubbable). - docs/subsystems/gui-shell.md says both. Run at the pushed head on mote (mote-run): - gofmt -l internal/: nothing. go vet ./internal/{cli,gui,library,gateway}; GOOS=linux go vet -tags nogui and GOOS=windows go vet of the same: ok. - go test -count=1 -timeout 45m ./internal/cli ./internal/library ./internal/gui ./internal/gateway at |
||
|
|
692a779d3d |
library: an instruction set can be kept in a file of your own, such as ~/.agents/AGENTS.md (新v学员 on Discord)
新v学员 keeps one user-level ~/.agents/AGENTS.md by hand and wants every agent to follow it. Only Factory Droid, omp and Cline CLI read that file natively; Codex, Claude Code, Gemini, OpenCode, Pi, Amp and the rest don't. Rather than teach magpie a new agent target, a set of shared instructions can now be kept in that file instead of a copy in the library, and the library writes it into every agent that is on, as it does any set. What changed: - InstrSet.File: a set kept in a file of the user's own. Its text is read from that file, Save writes to it (kept aside in the backups first, written atomically, never removed: emptied, it stays empty), and Remove lets go of the set without touching the file. - The file is refused when it is relative, a folder, an agent's own instructions or override file (magpie writes into those), a file holding magpie's marked block, inside the library, or another set's. A file not there yet is made on the first save. - The GUI checks the active linked file every 30s (KeepLinked) and writes a change made in an editor into the agents. - Carried by davsync or a backup, a linked set goes as its text; where the file is stays this computer's. Put back, the set keeps its file and the file gets the carried text, never emptied for a text not carried. A profile restored with no text doesn't empty it either. - GUI: New set has "Keep in a file…" (filled with ~/.agents/AGENTS.md); a linked set is tagged "Your file", says where it is kept, and warns when Droid or omp is on, as they read ~/.agents/AGENTS.md themselves and would get it twice. Strings in zh, zh-TW, ja and de. Run: - gofmt -l; go vet for darwin, linux/amd64 -tags nogui and windows/amd64 on ./internal/library ./internal/gui. - go test ./internal/library ./internal/gui -count=1: ok. - New TestLinkedSet, TestLinkRefused, TestLinkedSetCarried. Each was broken by hand and went red: putText writing a linked file like a library one, Collect not stripping File, Put not restoring it, SyncLinked not syncing, linkable not checking agents' own files. - library-linked-set.test.cjs in chromium and webkit, at 1100 and 420, in en, zh, zh-TW, ja, de: 22 pass; red with the file left out of create. library-instr-sets and i18n-keys still pass. Not done or tried: - No CLI to link a set (`magpie library instructions set <file>` still copies once), and the headless `magpie serve` doesn't watch the file: after an edit there, `magpie library sync` writes it out. - Not tried with real Droid or omp reading the same file. |