1ccacad63281094de8a3372d5a507d38f9969e5c
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e4197144a8 |
perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299 package-level regexp.MustCompile calls, in 148 files across agent, provider, gui, library, codexcat, sessions, usage, plugin and the rest, now go through lazyre.New too, so a launch that never reaches them (`magpie statusline`, run by Claude Code on every message) doesn't compile them. Fields, maps and params that held them are *lazyre.RE. Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build (t42) against this one (t43): - GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765 - `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M, peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30 changed packages ok; GOOS=linux go vet ok except ., internal/cli and internal/gui, which stop in wails v3's cgo files when cross-compiled (the same at main). New TestAllLazyPatternsCompile at the root compiles all 574 registered patterns (ok), so a bad pattern fails a test rather than a first use. Not run before push: the changed packages' own test suites; they run on mote after it. |
||
|
|
b2f7818d2e |
proc: a probe never runs a Windows GUI program, so asking opencode's version doesn't open OpenCode there either (saint carol)
saint carol, on Windows with OpenCode's desktop app: opening magpie, often right after an update, brings up OpenCode. |
||
|
|
af0cd09c9d |
proc: a probe never runs a macOS app's own program, so asking opencode's version doesn't open OpenCode (saint carol)
saint carol on Discord: opening magpie, often right after an update, brings up OpenCode, which they never asked for. magpie asks `opencode --version` at every start and after a CLI update (proc.Version for the agents' CLI info, library/rtk.go openCodeVersion, agent/cliupdate.go runCheck), all through proc.ProbeContext. When the `opencode` on PATH is OpenCode.app's own program (a link to OpenCode.app/Contents/MacOS/OpenCode, or the bundle's MacOS folder on PATH, where a case-insensitive disk finds OpenCode as opencode), running it with any arguments opens the app's window. A GUI app never answers --version, and a timeout isn't cached, so it happened again at each start. Nothing else in magpie opens OpenCode: no `open -a`, no opencode:// URL, and the Sessions menu's Open/Terminal actions are a user's click. ProbeContext now refuses (cmd.Err, nothing started) a program that is the main executable of an outermost .app bundle, after links: the CFBundleExecutable of an XML Info.plist, or the program named as the bundle when the plist can't be read (binary, as Kiro CLI.app's is). Every probe goes through it: version, auth status, Grok's agentProbe. A bundle's other programs still run (OpenCode's opencode-cli, Kiro CLI's kiro-cli beside kiro_cli_desktop), and so does a bundle inside another app's: ChatGPT.app's codex is CodexCLI.app's main executable (plist checked on this Mac, ChatGPT 26.1027). Tests (internal/proc/appmain_test.go, not on Windows): a fake OpenCode.app whose programs record that they ran. - TestProbeNeverOpensAnApp: a link to OpenCode is not run, Version is "", `opencode` found in the bundle's folder by PATH is refused, the bundled opencode-cli still answers. - TestProbeUnreadPlistByName: no plist / a binary one: OpenCode is not run, opencode-cli is. - TestProbeRunsANestedAppsCLI: CodexCLI.app's codex inside ChatGPT.app, with that app's plist keys, answers. - TestAppMainOnlyBundles: paths that only look like a bundle. Broken by hand: with the guard off, TestProbeNeverOpensAnApp and TestProbeUnreadPlistByName go red (OpenCode ran); with the nested check off, TestProbeRunsANestedAppsCLI and TestAppMainOnlyBundles go red. Run on mote at |