e740ee7cc02b8a0fceb28b899ccba3ddacaba9b9
3557
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e740ee7cc0 |
agent: a Claude Code tier set to a model keeps it when the main model moves onto that model, not "Same as main model" (#2257, luokinging)
A Fable tier set to GPT-6.1 Sol read "Same as main model" once the main
model was switched to Sol, and the next main-model move took it with it.
On a move of the main model, a tier equal to the new main model was kept
as its own only when it equalled what it would follow there. Fable follows
nothing on a model that is no Fable, and haiku follows a Claude model on
its Haiku, so neither was marked: Get then hid the tier as following, and
the next move rewrote it. The new main model itself now counts as the
tier's own model too, for every tier and both routes (magpie and Claude
Code's /model). GUI, TUI and CLI all read the same Field.
A user already caught by it sees "Same as main model" and sets the tier
again once; that state can't be told from a tier that follows.
TestClaudeFableTierOnClaude modelled 0.1.1229's wiring with fable=Sol
written before the main model moved onto Sol, which is this issue's own
case; its fixture now writes it after, as 0.1.1229 did.
Run:
- TestClaudeOwnTierOnTheNewMainModelStays (every tier, two own models,
magpie and /model): on the old code fable fails for both models and
routes, and haiku given Opus fails ("haiku reads \"\""); passes now.
- CLI in a sandbox HOME/CLAUDE_CONFIG_DIR, old and new binary: main ->
k2.8, fable -> Sol, main -> Sol, main -> GLM. Old: fable gone after the
move onto Sol, no ANTHROPIC_DEFAULT_FABLE_MODEL after GLM. New: fable
Sol after both, env ANTHROPIC_DEFAULT_FABLE_MODEL=oa/gpt-6.1-sol.
- go test -tags nogui ./internal/agent/ ./internal/tui/ ./internal/cli/:
ok. gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean.
Not tried: the GUI by hand (no asset changed; it reads the same Field).
|
||
|
|
fbfb76149c |
provider: TestCopilotSecretToolUsername's fake secret-tool answers a loaded Mac's suite, not "token """ after two 5s waits (#1627)
The cause: the test wrote its fake secret-tool with os.WriteFile, so its first exec paid macOS's check of a newly written program (0.27s here at load ~10, several seconds while a go test ./... starts its binaries, as testenv.Program's own doc records). That ran into copilotSecretWait (5s), which the happy path was held to: both lookups (account, then username) were killed and the token read as "". Not a product bug from this cause: copilotSecretTool runs only on Linux, against the user's installed secret-tool, which has no such check. The 5s bound is for a keyring prompt nobody answers (#723) and stays. The fix, in the test only: - both fakes are testenv.Programs (a file that has already run once); - the lookups that answer get copilotSecretWait = 10 minutes, since which attribute is asked is no question of time; only the keyring that never answers keeps 200ms; - that case's bound moves from 10s to 30s: bounded it takes 2.4s at most unloaded, unbounded 60s, so a loaded runner has room on both sides. Run at the reviewed head (macOS, load ~9-15): - Injected delay (sleep 6 at the top of the fake): the old test fails with copilot_cli_test.go:94 token "", want the one under username (12.01s); the new one passes (27s). Removing only the 10-minute wait by hand, with the delay, goes red again. - Broken by hand in copilot_cli.go: asking "account" only fails the test (token ""), and dropping the timeout fails it on the hang case (63s). - go test -count=20 -cpu 1,4 -run 'TestCopilotSecretToolUsername$|TestCopilotCLI' ./internal/provider: ok. - gofmt -l: clean. go vet -tags nogui for darwin, windows, linux: clean. - go test -p 4 -timeout 40m ./... under a sandbox HOME: 53 packages ok, no FAIL. |
||
|
|
9916a94608 |
gateway, usage, plugins: OTel export is the first plugin on the gateway's observer point (P3)
P3 of docs/subsystems/plugin-runtime.md opens the gateway to plugins. The
observer point is first: it only reads, so it carries the least risk.
With plugins/otel off, the gateway exports nothing and does no observing
work. It keeps no reply whole and adds no request context.
- usage.Observer:
- Methods: Serve, Bodies, Begin(Request) Watch and Ledger(Record). Watch
has Attempt and End.
- Observe(o) registers an observer until its remove is called.
- ServeObservers is counted, and only Server.ListenAndServe calls it.
- ObservedBodies takes the most any observer wants.
- Record.SkipOTel becomes Watched, set by appendUsage for a request an
observer watched.
- The gateway's otel.go becomes observe.go:
- observeRequest asks each observer through Begin.
- attempt and end call each Watch. Bodies are added only when an
observer asks for them, and the whole reply only for WholeBodies.
- internal/otlp: the exporter (otel*.go) moves out of internal/usage, and
the gateway's per-request span state moves into request.go. otlp.New()
is an Exporter, a usage.Observer. What it sends is unchanged.
- plugins/otel:
- Apply registers otlp.New() and disposes of it when turned off.
- InUse is 1 while settings.OTelExport says to send. A user who exports
only through MAGPIE_OTEL_* keeps the plugin on under Essentials.
- pluginrt.KeepFresh: the process serving the gateway refreshes every 2s
when plugins.yml or settings.json changes. A switch made in the window or
the CLI reaches a running gateway, or a headless serve, without a restart.
- docs: plugin-runtime.md gets a P3 section, a gateway runtime path and an
updated failure section; reference.md says the export is the otel plugin.
Run at this tree on origin/main
|
||
|
|
52ee847612 |
gui: a Linux bar's tray icon is the bird's silhouette, not the app's tile, and the tooltip says today's total (ylorn on Discord)
ylorn (Hyprland, 0.1.1241): the StatusNotifierItem's IconPixmap was the
coloured app icon on an opaque white tile, which clashed with a bar's
monochrome icons and became a solid block on bars that tint icons by
alpha; the tooltip said only "magpie".
- Linux now gets the macOS menu bar's template bird (tray.png) in one
colour on transparency (trayIconFor / linuxTrayIcon, trayglyph.go):
light, or dark when xdg-desktop-portal's org.freedesktop.appearance
color-scheme is 2 (prefer light); it is set again on the portal's
SettingChanged (watchTrayScheme, own D-Bus connection). An unreadable
portal counts as no preference (light). No IconName is set: a host
that resolves a -symbolic name but draws it untinted would show a
black bird on a dark bar with no pixmap fallback. macOS keeps its
template icon, Windows the coloured app icon.
- With no cards in the menu bar the tooltip is "magpie" over one line of
today's total, as the panel's Usage tab sums it (trayIdleTip: all
tokens, cost in Settings' currency, requests), refreshed with the
cards' loop. Cards picked: unchanged.
- The menu is unchanged (Open / version / Quit): no info lines. The
panel one click away has the models and usage, and the menu is shared
with Windows and macOS.
Run (sandbox HOME, pinned GOMODCACHE, shared GOCACHE), on origin/main
|
||
|
|
82f48f0935 |
gateway, provider, gui: a provider set to compact natively is asked Codex's compaction_trigger as sent and its sealed compaction goes back unchanged; a checkpoint stays with its writer (#1099)
A new per-provider option, off by default. With it on, Codex's compaction_trigger reaches the provider as Codex sent it, and the provider's encrypted compaction item goes back to Codex unchanged instead of magpie's magpie1: summary. Off, nothing changes. Where it can be on (provider.CarriesCompaction): a provider with a Responses API (Sub2API and other OpenAI relays, a remote magpie), a ChatGPT (codex) account, and the built-in GitHub Copilot on its GPT Responses path. Copilot's Claude models are asked on chat completions, so they still get magpie's summary (CompactsOn). A group compacts natively only when every member does. No silent downgrade: - A turn carrying a sealed compaction goes only to the key or account that wrote it (compactions.json beside affinity.json, 0600, 1024 entries / 30 days). With none left, Codex gets a 400 saying the conversation was compacted natively on <who>, not a summarised or dropped context. - A provider whose request would have to be translated (not relayed) is refused with a 400 instead of losing the item. - The upstream's own refusal goes back to Codex as it came, one call. - base_instructions and Codex's identity are untouched. Turning it on: - GUI: the provider editor's Compaction row, "Codex compacts on this provider" (shown only where the wire can carry it; zh, zh-TW, ja, de). - CLI: magpie provider set <id> compaction=native|magpie. A provider that can't carry it is refused. Run on origin/main |
||
|
|
118f4f28bf |
plugin: a community plugin npm doesn't have installs from the plugins repo's dist branch, so a reviewed plugin no longer waits unmerged for an owner's npm 2FA (magpie-community/plugins#84)
npm's Trusted Publishing can't create a package, so a new plugin's first
version needs an owner's 2FA, and reviewed PRs sat unmerged for it. A
trust made after 2026-09-03 also allows stage publish only, which is why
npm refused zed 0.1.7 and zen-free 0.1.7.
The plugins repo now packs every merged version onto its `dist` branch
(scripts/dist.mjs, magpie-community/plugins f5308cd): tgz/<file> and an
index.json with each version's sha512, manifest and README, with no
credentials. magpie still asks npm first. Only when `bun add` fails for a
@magpie-community package at latest or an exact version, and not because
of the user's minimumReleaseAge (that hold is kept), does installDist
fetch the tarball. It refuses the tarball unless its sha512 is the index's,
keeps it in plugins/dist and runs `bun add ./dist/<file>`. A later npm
install replaces it, and pruneDist removes tarballs package.json no longer
names. npmAsk (market version, Update, the hourly check) takes dist's
latest when npm errors or is behind, and Readme falls back to dist's. The
branch is read through jsDelivr when the China mirror switch is on, else
raw.githubusercontent.com. installMu is now held for the whole install,
fallback included.
Run at this head (on origin/main
|
||
|
|
7a3fed6bb5 |
gateway: a group in the group sinks its own rate-limited keys by its own Sink, not only the group the agent named (#2255, ggbdpq)
What changed
- planLevel applies a nested group's own Sink (sinkOwn) to its own
candidates and their trace rows at both places it plans one: the
weighed units (Smart, usage, pace, weight) and the ordered walk. A
key or account of that group rate limited with quota left goes behind
its group's others, within that group's place, as it plans by its own
routing (#576) and rules. The group the agent asked for still sinks
the whole after, as before. sinks() still leaves out rotate, weight
and manual.
- Why: only planGroup read Sink, for the group asked for; an inner
group's switch did nothing, and its rate-limited account went back
to the front as soon as its rest ended.
- provider/group.go's comment and gateway-routing.md's Sink row say so.
Ran
- TestNestedGroupSinksItsOwnOrder (outer ordered, smart and by weight;
three levels deep with the middle group's Sink and with the
innermost's; inner Sink off; the outer's Sink alone): fails on
origin/main
|
||
|
|
d182294be7 |
gateway: a page at a localhost subdomain spends a subscription only with a gateway key, as Origin null does (#2256, ggbdpq)
What changed
- corsGuard refuses (403) an http(s) Origin at a subdomain of localhost
unless the call carries an enabled gateway key (localhostSubdomain),
the rule Origin "null" got in #2242. foreignPage still passes it, so a
page there that holds a key keeps working; neither gets CORS headers.
- Why: Chrome and Firefox resolve *.localhost to loopback themselves,
but Safari and other WebKit views hand the name to the system
resolver, which before macOS 26 asks the network's DNS (WebKit bug
160504, closed MOVED: "implemented in OS frameworks below WebKit",
2025-09-19; fails on macOS 15.7). A captive portal's or hostile
network's resolver serves such a page from anywhere, and its "simple"
text/plain POST spent subscriptions with no key.
- tauri.localhost and wails.localhost stay keyless on Windows only,
where Tauri's and Wails' webviews serve themselves at those names. On
macOS and Linux those apps use tauri:// and wails://, so the two names
are any page's there, and a hostile resolver answers them as readily
as any other (the residual the report left open). webviewOS
(runtime.GOOS) lets the test be each system.
- The same page also reached the gateway rebound: at evil.localhost:3425
once the name turns to 127.0.0.1, its GET carries no Origin, and
lanGuard's ownHost counted every *.localhost Host as this computer, so
GET /v1/models and /v1/magpie/quotas answered 200. ownHost no longer
counts a subdomain of localhost (localhost itself and
docker.for.mac.localhost still count); a browser at one needs a key.
- TestForeignPagesRefused's tauri.localhost row now sends a key, and
TestReboundPageRefused expects wails.localhost refused.
- docs/subsystems/gateway-routing.md says both.
Ran
- TestLocalhostSubdomainNeedsAKey (darwin, linux and windows as
webviewOS; six routes; cross-origin and rebound; the fake vendor never
reached): fails on origin/main
|
||
|
|
e9943c1797 |
release: a release whose notes went out without Chinese is said on one open issue, not only in magpie-releases' log (#2122, KaiZe on Discord)
magpie-releases writes the Chinese notes with a DeepSeek call. Its balance ran out, so v0.1.1233 to v0.1.1242 shipped English only, and Chinese apps showed English notes until a user reported it. The failure was only a warning in a log nobody reads. mirror-release now checks notes.md for the <!-- lang:zh --> marker. When it is missing, the job comments on the open "Release notes without Chinese" issue, or files that issue if none is open. If gh fails, the step only warns, so the release itself never fails here. What was run: the step's script against a fake gh in four cases (Chinese present, no issue open, issue already open, gh failing); the real `gh issue list` query, read-only; a YAML parse of the workflow. Not run: a real release (the next tag will run it). No Go code changed. |
||
|
|
21aa402856 |
gui tests: the Codex subagent details test writes its rollouts now, not on 2026-10-15, so main is green in UTC (#1591)
3c4b4dc97's TestCodexSubagentDetailsReachSessionAPIs held usage's clock at 2026-10-15 12:00 local and wrote the rollouts then, but /api/sessions/overview reads sessions.StatsFor, whose 7-day window ends at the real today. On CI (UTC, still 10-14) the fixture day was tomorrow and the child was left out: "overview token top omitted the active Codex child", red on macOS and ubuntu at |
||
|
|
8d2a4a7da3 |
gateway: a Codex subagent sealed to ChatGPT's backend says to turn on Settings › Codex subagents on any model, or to start a new thread when it is on (#2245, qikairo7)
TestSealedTaskNamesSubagentsOnAnyModel. Run at this head (on 6485056e1, with the #2245/#2246/#2247 fixes together): gofmt -l clean; go vet ./... for darwin and windows, and linux -tags nogui; the full go test ./... in a sandbox HOME, all green. The new test fails on the old code and passes with the fix. |
||
|
|
91c4705e39 |
gateway: a nested group's own firstToken times its seats, not the outer group's (#2246, Gaudi-XIX)
Each candidate now carries the firstToken of the innermost group that sets one; a candidate with none falls back to the requested group's value. TestNestedGroupFirstToken. Run at this head (on 6485056e1, with the #2245/#2246/#2247 fixes together): gofmt -l clean; go vet ./... for darwin and windows, and linux -tags nogui; the full go test ./... in a sandbox HOME, all green. The new test fails on the old code and passes with the fix. |
||
|
|
8ef14be3e6 |
gateway: an effort=auto group leaves a turn the agent sent with reasoning none alone and asks no classifier, so its pick and what went out agree (#2247, sryimnoob123)
The classifier's pick was recorded but never applied when the agent asked for none, costing a classifier call per turn. The outer effort in the routing record is what the agent asked; the effort sent is tries[].effort on the try marked picked:true, which the groups help now says. Thanks to ggbdpq for the reproduction. Run at this head (on 6485056e1, with the #2245/#2246/#2247 fixes together): gofmt -l clean; go vet ./... for darwin and windows, and linux -tags nogui; the full go test ./... in a sandbox HOME, all green. The new test fails on the old code and passes with the fix. |
||
|
|
198c7637a1 |
gateway tests: the queued-stream tests order the gateway's writes and the vendor's arrivals by a sequence, not a clock that ticks every ~0.5ms on Windows (#2249)
TestQueuedStreamKeptAliveForASlot checked heard.Before(asked) on
wall-clock times. On Windows time.Now() advances in ~0.5ms ticks, and
the keepalive, the slot being freed and the vendor being asked fit in
one, so heard == asked and the test failed with the right order.
Loosening it to !asked.Before(heard) would pass a broken keepalive: with
queued keepalives off, the first write (the reply) lands in the same ms
as the ask, seen below.
A shared counter (step) now gives each gateway write a place in order,
taken before the write so nothing the agent does on hearing it can come
earlier, and each vendor arrival and answer one too. The sibling checks
use it: TestQueuedStreamKeptAliveForTheMinute's same heard-before-asked
and TestQueuedStreamKeptAliveOnceSentToItsVendor's writeLog.within (its
"kept alive before the vendor was asked" is the same strict compare on
the one write that frees the slot).
Run:
- Reproduced by truncating both clocks to 100ms (forced equal ticks):
old ForASlot FAIL 5/5 at queue_keepalive_test.go:387 with equal
times, the issue's message; OnceSentToItsVendor FAIL 5/5 "the agent
wasn't kept alive before the vendor was asked". With the fix and the
same truncation, all TestQueuedStream* pass 3/3.
- Broke the guarded behaviour by hand (queuedAlive := func() {} in
gateway.go): all three tests FAIL at the body check; with the body's
": keepalive" check also dropped, each FAILs at the new order check
(ForASlot :433, ForTheMinute :304, OnceSentToItsVendor :368).
- go test -tags nogui -race -count=20 -run of these and
TestTranslatedSilenceStillTimesOut: ok (358s). gofmt -l clean,
go vet -tags nogui ./internal/gateway (darwin) clean.
Not run: the full go test ./..., GOOS=linux/windows vet, the Windows
box. Stopped because the disk dropped below 10G free.
|
||
|
|
85ab808b5e |
gateway tests: TestTranslatedSilenceStillTimesOut times the client's idle wait over the body only, not over getting the headers (#2248)
The 400ms context deadline covered the whole request, so on a loaded
machine the gateway's slow response headers ended the test at
http.DefaultClient.Do ("context deadline exceeded") before it reached
what it checks. The 400ms now starts once Do returns (time.AfterFunc
cancel), standing for the client's idle timeout over the body.
Run:
- Reproduced by injecting a 600ms sleep before the fake vendor's first
byte: old test FAIL keepalive_test.go:202 "context deadline exceeded",
the issue's error; fixed test passes 3/3 with the delay in.
- Broke the guarded behaviour by hand (a 5ms ticker calling alive() in
readSSEAlive, so silence is covered), delay still in: FAIL "a silent
provider was covered for: 30 in_progress events".
- go test -tags nogui -race -count=20 -run of this test and the
TestQueuedStreamKeptAlive* tests: ok (358s). gofmt -l clean,
go vet -tags nogui ./internal/gateway (darwin) clean.
Not run: the full go test ./..., GOOS=linux/windows vet. Stopped
because the disk dropped below 10G free.
|
||
|
|
aae49d0866 |
provider: moved Cursor users get plugin 0.2.13, where a Run cancelled while it opens is closed upstream and dashboard usage is collected per account (plugins #130, #131)
0.2.13 (magpie-community/plugins 3351e47) carries two community fixes by nicegui. #130: a cancel landing between the HTTP/2 head and runOnce's abort listener was never seen, so the Run kept streaming upstream with its heartbeat for nobody; it is now closed at each hand-off. #131: the usage ledger's claimed/owed/flights were keyed by conversation alone, so a conversation moved to a second Cursor account had that account's own dashboard event taken as the first account's debt; they are now keyed by account and conversation. The built-in doesn't share this code, so un-moved users are unchanged. The cursor mover's min goes to 0.2.13 so keepMovedCurrent updates every moved user. Run: npm view @magpie-community/opencode-cursor-auth@0.2.13 version --prefer-online gives 0.2.13. Plugin: full bun test 1292 pass, 0 fail; own repros fail on 0.2.12 and pass on 0.2.13. Here: gofmt -l; go vet ./internal/provider for darwin, GOOS=linux -tags nogui, GOOS=windows; go test -timeout 40m ./... in a sandbox HOME: exit 0. Not run: a real Cursor account, nor GUI tests (no GUI change). |
||
|
|
84f14e555c |
usage: a Codex call with no response_id leaves compaction out of Usage requests instead of saying false (#1591)
Codex added token_usage_record and compaction_response_id together, in
openai/codex#41912 (2026-08-31). A call that magpie reads from a
token_count event alone, as in older rollouts, has no response_id. It
can't carry the compaction marker either way. The previous commit
reported such calls as `compaction: false`, which claims they were not
compactions. codexCompactionOf now returns no state for them, so the
ledger and the requests page leave the field out, as they do for any call
with no native evidence.
What was run:
- New test TestCodexCallWithoutResponseIDHasNoCompactionState. On the
previous commit it fails with `ledger: a call with no response_id claimed
a compaction state: {..."compaction":false...}`, and with the same message
for the requests page. It passes now.
- go test -tags nogui ./internal/sessions ./internal/usage: ok.
For all three commits on origin/main
|
||
|
|
a78ac27532 |
sessions: a Codex subagent in a legacy-history rollout gets its spawn task_name too, and a forked child's copy of its parent's spawns no longer erases its siblings' titles (#1591)
Two gaps in the previous commit's title link: - Legacy rollouts. Codex's ThreadHistoryMode is Legacy by default. The local thread store has only defaulted to Paginated since openai/codex#47900 (2026-09-24). A legacy rollout doesn't persist item_completed for a started SubAgentActivity. It persists an event_msg instead: {"type":"sub_agent_activity", "event_id": <call id>, "agent_thread_id", "kind":"started", ...}. Its children got no title. That event now links the same way, through one helper (codexAgentStarted) shared with the item_completed path. - Forked children. A forked child's rollout repeats its parent's history, including the spawns of its siblings. The same call id then linked from two files, which counted as a conflict and erased the sibling's title. Titles are now keyed by {child, parent}, and only the file of the child's own parent_session names it or takes a name away from it. What was run: - New tests. On the previous commit each fails with: - TestCodexSubagentTaskTitleFromLegacyActivity: `legacy activity title for child-started = "", want "Legacy started task"`. - TestCodexSubagentTaskTitleComesFromItsOwnParent: `a fork's copy of the parent's spawn erased the child's title: ""`. - Broken by hand: with the parent dropped from the key, the second test fails with `a spawn its parent never made named the child: "Only in the fork's copy"`. - go test -tags nogui ./internal/sessions ./internal/usage: ok. - The event's field names come from Codex's source (protocol SubAgentActivityEvent and the rollout persistence policy, openai/codex 669449b). Not tried: a real legacy-history Codex subagent rollout. |
||
|
|
3c4b4dc973 |
sessions, usage: a Codex subagent with no title takes its parent's spawn_agent task_name, its nickname shows apart, and Usage requests say which calls were compactions (#1591, Hogeexxl)
Hogeexxl's change (his fork branch codex/codex-session-details, f7c176c9),
cherry-picked with his authorship:
- A Codex child thread whose title is still empty after the existing
precedence takes the task_name of the parent's spawn_agent call, linked by
the call id and the SubAgentActivity "started" item that names the child's
agent_thread_id. Conflicting links leave the title empty.
- session_meta.agent_nickname is exposed as `nickname` on the list, one,
manage and overview responses, beside the title, not in place of it.
- GET /api/usage/requests and /v1/magpie/usage/requests carry `compaction`
(true/false) for Codex calls with native evidence, and leave it out
otherwise. A gateway row matched by a unique response_id takes the marker
and keeps its own model, usage, cost and kind.
- Flags bits 1024 (rowCompactionKnown) and 2048 (rowCompaction) are new.
TestRowFlagsApart covers them, and they don't overlap 1..512. The sessions
cache goes to version 21 and the calls cache to calls-v15.
Review:
- Rollout format checked against Codex's source (openai/codex 669449b):
- v2 spawn_agent args carry task_name.
- A paginated rollout persists item_completed with a SubAgentActivity
item: kind "started", id = the call id, agent_thread_id.
- SessionMeta has a top-level agent_nickname, which Codex's own list.rs
and metadata.rs read too.
- compaction_response_id lives in token_usage_record.
Gaps in legacy rollouts and in calls without a response_id are fixed in
the next two commits.
- Privacy: only a title string the user's own Codex wrote and a boolean
are added to local API responses. Nothing new goes to a vendor or to
telemetry. The ingest POST parses fields one by one, so it is unchanged.
- No .github, dependency or network changes.
What was run:
- His tests pass: go test -tags nogui ./internal/sessions ./internal/usage,
and the two new internal/gui API tests.
- Broken by hand, each caught by his tests:
- the nickname read removed;
- the conflict checks removed;
- mergeCodexCompactions broken;
- the gateway pair's setCodexCompaction removed;
- the flag read forced to true.
- Not caught:
- the parent check on the title link (covered by a test in the next
commit);
- `copy.codexCompactions = nil` in cloneCodexChunks removed. That line is
defensive only: the shared chunks never hold the map.
- The gofmt, vet and full-suite record for the three commits is in the
last one.
|
||
|
|
f255a3e3b7 |
gui: a routing group's editor keeps its member rows and pattern row inside it, a long model's name ellipsized, not the chips cut off (碳碳双键 on Discord)
碳碳双键's screenshot (zh, ~770px): in a group's editor the 模型 rows ran
past the editor's right edge, 跟随分组推理 / 标准速度 cut off, and the 模式
row didn't line up with them. .fallback and its .fbl are grids with an
auto track, which grows to the widest row's min-content: one long model
id (nvidia/nemotron-3-super-120b-a12b:free) widened the whole column.
The track is minmax(0, 1fr) now, so the column is the editor's width. A
member row's name and its provider shrink and ellipsize (the provider
first), with the whole name as a title on hover; when the chips still
don't fit they wrap to a second line, right-aligned. The rules group
(.rt-rules) and the phone's own row layout (body.web, which wraps and
starts at the left) are left as they were; the new rules sit in :where()
so the phone's still win.
New test group-editor-fits.test.cjs: Chromium and WebKit, the desktop
window and the web page, 1100, 770 and 420 wide, en, zh, zh-TW, ja, de.
It checks that nothing in the members or patterns box passes the
editor's edges, no chip is cut, the page doesn't scroll sideways, the
pattern row's edges are the members box's, and the long name is a title.
It fails on origin/main
|
||
|
|
00501401ae |
gui: the subagent effort note's words live with the Routing page, which is a plugin now (#2232)
Koohoko's patch was written before Routing moved into plugins/routing ( |
||
|
|
d966e19154 |
gateway, gui: the Routing page tags a Claude Code subagent's turn as it does Codex's
Codex names a subagent's request (x-openai-subagent: collab_spawn), and the Routing page tags its row Subagent, with why it went where it did. Claude Code names no kind, so Claude Desktop's subagent turns, which magpie now moves to their own model and effort, read as the lead's: a Desktop session's rows on one routing group could not be told apart. Claude Code 2.1.295 sends x-claude-code-agent-id from every agent context but the main one. Its x-claude-code-request-class and x-claude-code-agent-type hints go only to a first-party base URL or with CLAUDE_CODE_GATEWAY_HINT_HEADERS, so magpie doesn't get them. - subagentTurnOf keeps the id in Route.SubagentID for a request that offers tools and names no kind: the turn desktopSubagentPick and desktopSubagentEffort take. Desktop's and terminal Claude Code's turns are kept, moved or not. The lead's turns, a subagent's tool-less helper calls (#2081: Claude Code's housekeeping) and a blank id are not. A kind wins over the id. - A Desktop pick or effort that found the turn is trusted, so the body isn't decoded again; a request without the id isn't decoded at all. Only a subagent's turn with neither setting reads its tools once. - Kind stays empty (#2081), so the ledger, the Usage page and the Purpose filter keep the turn unmarked. The ledger's Subagent already keeps the same id, on the helper calls too. - routing.js tags it through tagKind in the request list (by request and by session), the story, the replay and the tray panel, with Codex's words and reasons (kindWhy's collab_spawn: moved or kept, within a routing group, on the model asked for). No new strings. - The day's history keeps the id. A route kept before it has no tag, and its moved/kept story reads as before. Verified at this head, on |
||
|
|
cdeb00f841 |
gui tests: desktop-subagent-model reads each write once its answer is back
A pick on the Agents page redraws its square at once and writes behind it, queued (commit, and the effort slider's onchange). The test read the fixture's last write as soon as the square changed, so a slow write raced it: in a broad Routing run, six files at a time, Chromium's en 1100 case read "high" for the subagent effort just set back to Default. Each pick now waits for its /api/set answer, which the fixture sends after noting the write. The app is unchanged. Checked with the fixture's write held 300 ms (a probe, not committed): the test before this fails 4 of 4 (Chromium and WebKit, 1100 and 420, en) at "Desktop pick posts the catalog id", the model pick #2081 brought; with this change it passes 4 of 4. Unheld, the race is rare: six runs of the whole file at once pass 120/120 before this and after it. The file alone: 20/20. The three UI breaks of the subagent effort still fail 4 of 4 (zh), and pass restored. |
||
|
|
b476dc5a93 |
agent, gateway, gui: Claude Desktop's subagents can have a reasoning effort of their own
After #2081 gave Desktop a subagent model, its effort still came from the request. Add subagent_effort beside that model, using the existing effort slider. The live setting DesktopSubagentEffort belongs to magpie; no Claude client file or binary is changed. Empty preserves the request's effort, including disabled thinking. A pick applies only to Desktop requests with an agent id and tools, independently of model replacement: unset, equal and unavailable model picks all work. Reuse the attempt-level fitting; fixed group-member efforts and reasonless models keep their existing precedence. count_tokens applies the pick after unmasked-body restoration. A Codex SubagentPick is not evidence of a Desktop tool turn. Route.Effort keeps the incoming level, SubagentEffort records the configured pick, and tries/usage keep the actual level. Routing explains the pick even without a model replacement. Options follow the target model; a saved level survives a model change. POST /api/settings preserves it. Disconnected preferences, Disconnect/reconnect and restored settings work; a Live pick gives restart advice only when it actually connects the agent. Codex's own settings and default-effort explanation are unchanged. Verification on |
||
|
|
932a62d5e0 |
gateway tests: a silently kept cache stays in Gemini's shape, across a restart, and a prompt too small still moves (#2230)
JasonBuildAI's test covers OpenAI's Chat shape and a reply with no usage. TestAffinitySilentCacheGeminiRestartAndSmall adds the cases the same substitution has to hold for: Gemini's usageMetadata (promptTokenCount, cachedContentTokenCount 0 on a first turn), the stick read back from affinity.json after the in-memory one is dropped, and a 600-token prompt, under cacheWorth, which still moves as "no-cache". Each case also checks the trace tells CacheRead 0 and CacheWrite equal to the prompt sent. Run: - With the substitution in answered taken out, both this test and TestAffinityKeepsACacheTheVendorKeptSilently fail "Why:no-cache ... want cache" (the second turn went to k2). With it: PASS. - go test -tags nogui -run TestAffinity ./internal/gateway: ok. - go test -tags nogui ./... on macOS with this series (at 1b96dcc96 before the rebase): every package ok. gofmt -l, go vet ./... on darwin, linux (nogui) and windows, and the three builds: clean. |
||
|
|
7c5bfd7a1d |
gateway: auto affinity keeps a conversation where a vendor's cache is kept without saying so (#2230, JasonBuildAI)
A vendor that keeps the prompt cached by itself and reports nothing of it —
OpenAI's automatic prefix cache, Gemini — says neither a read nor a write of
the turn that built the cache. affine judged that turn's stick by what the
reply read and wrote (0 + 0), found it under cacheWorth and moved the
conversation's second turn as "no-cache": the whole prompt went afresh to
another key or account and was paid for in full, on every turn after the
first, for anyone with more than one key or account and Affinity auto (the
default).
7f968b95b named this as not covered: "a vendor that caches without reporting
a write (OpenAI's automatic prefix cache, Gemini) still reports CacheWrite 0
on a first turn, so its second turn may still move".
What such a vendor holds of the conversation after a turn is the prompt that
turn was sent, which is what its cache now has. answered takes the reply's
usage rather than its two cache counts, and where the reply reports neither
a read nor a write, the prompt it was sent (Input) stands for the write: the
second turn stays to read it, as it does for a turn that wrote its cache. A
reply that reports no usage at all (Input 0) counts as no cache, as before,
and a prompt under cacheWorth (1024) still moves. A read or a write the
vendor does report is used as it was, and resting, spent, cold, strict, turn
and rotate are judged before this, so nothing else changes.
The observable change: with Affinity auto, a conversation whose last reply
reported neither a cache read nor a cache write, and was sent at least 1024
tokens, is kept where it was (Why "cache", Kept true) rather than moved
(Why "no-cache"). Its stick, affinity.json and the trace's
Affinity.CacheWrite carry the prompt sent, and Affinity.CacheRead stays 0,
which is what the Routing page shows as read and written; the page itself is
unchanged.
Tests:
- affinity_silent_cache_test.go (new): TestAffinityKeepsACacheTheVendorKept
Silently. Two keys, least-used routing, and a Chat vendor reporting
prompt_tokens 3000 with cached_tokens 0 — what OpenAI and Gemini send of a
first turn — keeps the second turn on k1 as "cache", with the trace
telling CacheRead 0 and CacheWrite 3000; a vendor reporting no usage at
all still moves to k2 as "no-cache".
- TestAffinityKeepsACacheJustWritten, its "too little either way" (300/300,
no-cache) case included, passes as it did.
Run:
- go test -tags nogui -count=1 -run TestAffinity ./internal/gateway: ok,
80.982s (TestAffinity 39.36s, TestAffinityKeepsACacheJustWritten 26.54s,
TestAffinityKeepsACacheTheVendorKeptSilently 9.68s).
- go test -tags nogui -count=1 -timeout 45m ./...: every package passes
except 21 tests red on this Windows machine — agent 4
(TestInstallWithoutNodeParses, TestWSLClaudeFollowerOnTheMainModelIsNoDrift,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI), gui 4
(TestGatewayHeldByAContainer, TestGatewayFixQuitsOnlyAMagpie,
TestFXStateDoesNotWait, TestUpdateThatWontStart), library 3
(TestAgentsSkillsFolders, TestRemoveFoundSkill,
TestHooksCodexTrustMovesWithTheGroups), gateway 2 (TestClaudeAsRootEnv,
TestSweepBridgeProjectsTakesOnlyTheBridgesFolders) and one each in backup,
davsync, pluginrt, provider, sessions, update and usage. A fresh worktree
at the base
|
||
|
|
ec15f87393 |
sessions: a Codex Desktop fork's replayed parent checkpoints book no usage, so a thread_spawn session isn't counted ~1000x (#2234, zlxdengtianhei)
A token_count event that can't be paired with a response record fell
back to the cumulative total's delta whenever a previous total existed,
even when the event's own last_token_usage was there. A Codex Desktop
subagent fork (thread_spawn) writes two cumulative counters into one
rollout: its parent's, replayed with last=0, and its own. Each switch
from the fork's lower counter back up to the parent's booked the gap,
tens of millions of tokens, as one call. The reporter's day read 187.4B
tokens where ~10.3B was real.
last_token_usage is the request's own usage, exact even when zero, so it
is used whenever it is valid; only a missing or invalid last falls back
to the delta, and with no previous total to the total itself, as before.
Run:
- TestCodexUsageForkReplayCountsOnlyLast (new), on the reporter's own five
lines (testdata/codex-fork-replay-checkpoints.jsonl, numbers untouched),
checking both Calls and the session summary. Old code: FAIL "calls
booked {Input:832145 Output:281374 CacheRead:82834688 ...}, want
{Input:3273 Output:1201 CacheRead:72448 ...}". New: PASS, on macOS and
on the Windows box with every TestCodex* test.
- TestCodexUsageUnpairedCountKeepsLegacyDelta and the other Codex usage
tests still pass; go test -tags nogui ./... on macOS with this series:
every package ok.
- gofmt -l, go vet ./... on darwin, linux (nogui) and windows: clean.
Not run: a reindex of the reporter's full dataset; the numbers above are
from their excerpt.
|
||
|
|
4f020a95ff |
gui tests: the take-over test copies its fake magpie on Windows, so the temp folder can be deleted
TestGatewayFixQuitsOnlyAMagpie hard-links the running test binary as the fake magpie it ends. On Windows a hard link to a running executable is that executable, so t.TempDir's cleanup failed "unlinkat ...magpie.exe: Access is denied" and the test went red even once the take-over worked (#2231). On Windows it now copies the binary, as it already did where linking fails. Run on the Windows box with the previous commit: 3 of 3 PASS (~7s each); without this change the take-over passes and the test fails in cleanup only. macOS: go test ./internal/gui ok in the full-suite run. |
||
|
|
b25659344f |
proc: on Windows a port nobody listens on reads as no listener, not "exit status 1", so the take-over doesn't say "stuck" (#2231, JasonBuildAI)
ListeningOn on Windows ran Get-NetTCPConnection with -ErrorAction
SilentlyContinue. When nothing listens the cmdlet fails with
ObjectNotFound, and PowerShell still exits 1 for it, so the read answered
"exit status 1" where lsof and /proc answer no pids and no error. The
Gateway page's take-over waits for exactly that answer to know the older
magpie let the port go; with an error it waited out its deadline and said
"stuck" with the port already free. The command now catches the error and
exits 0 only for ObjectNotFound; any other failure (the cmdlet missing, a
PowerShell cut short) is still an error.
JasonBuildAI's 85a8c8c0 reads "exit 1 with nothing on either stream" as
none found instead. Catching the category keeps a silent failure of
another kind an error, so this takes that route; his separate point that
the darwin reader has no deadline guard is not in this commit.
Run:
- TestNothingListeningIsNoError (new), on the Windows box: old code FAIL
"nothing listens on 56409: exit status 1", new PASS; TestListeningOn
passes on both. go test ./internal/proc on macOS: ok.
- TestGatewayFixQuitsOnlyAMagpie (internal/gui) on the Windows box: old
code FAIL "take-over: {OK:false Reason:stuck ...}" after 12.5s; with
this change the take-over succeeds (the test's own cleanup failure is
the next commit). With both, 3 of 3 PASS in ~7s each.
- go test -tags nogui ./... on macOS with this series: every package ok.
- gofmt -l, go vet ./... on darwin, linux (nogui) and windows: clean.
|
||
|
|
d92cc5b84b |
sessions: WorkBuddy's and MiniMax's session folders behind a link are read too, each session named under the agent's folder (#2233)
The previous commit followed a linked ~/.codex/sessions. Two more agents hand one root to filepath.WalkDir the same way and missed everything behind a junction or a symlink: WorkBuddy's (and CodeBuddy Code's) projects folder (buddyFiles) and MiniMax Code's sessions folder (minimaxCallFiles). The follow-and-rename is now walkLinked, used by all three, so each names its files under the agent's own folder rather than the link's target, as JasonBuildAI's change does for Codex. The other WalkDir calls in internal/sessions walk magpie's own folders or a single session's folder, not an agent's root. Run: - TestBuddyProjectsBehindALink (new): with buddyFiles back on filepath.WalkDir it fails "WorkBuddy sessions behind a link: 0, want 3"; with walkLinked's rename taken out it fails "a WorkBuddy session behind a link is named .../002/projects/..., want it under .../.workbuddy/projects", and TestCodexRolloutsBehindALink fails "a rollout behind a link reads as .../002". Passes with the change, on macOS (symlink) and on the Windows box (mklink /J junction), with every TestCodex* test there. - go test -tags nogui ./... on macOS with this series: every package ok. - gofmt -l, go vet ./... on darwin, linux (nogui) and windows: clean. - Windows internal/sessions as a whole: TestCursorEditorCopiedOncePerChange fails there with and without this (a %TEMP% folder another test leaves; noted on #1827). |
||
|
|
85e84d6254 |
sessions, usage: a Codex folder whose sessions folder is a junction lists its sessions and calls again (#2233, JasonBuildAI)
The Codex CLI on Windows leaves every folder under .codex as a junction when .codex is kept on another drive, sessions and archived_sessions among them. codexFilesIn handed that folder to filepath.WalkDir, which lstat()s the root it is given, and to lstat a junction is not to see a folder: the walk called back once for the root, descended no further, and missed every rollout. The Codex session was absent from the Sessions page, and its calls, tokens and cost from Usage and the ledger. On the machine this was found on, whose ~/.codex/sessions is a junction to D:\CDriveData\C_\Users\黄江南\.codex\sessions, two binaries built from this tree and from |
||
|
|
8bf98110b8 |
plugin: a folder plugin's path written on macOS or Linux is a path on Windows too, so a backup or a sync leaves it out (#2229, JasonBuildAI)
plugin.IsPath read a spec as a path when filepath.IsAbs said so on the host. On Windows "/Users/me/plugin" is not absolute, so a folder plugin added on a Mac was carried into a backup and a WebDAV sync as if it were an npm package, and the Windows machine restoring it asked bun to install "/Users/me/plugin". A spec starting with / or \ (a UNC path among them) now counts as a path on every system, as a drive-rooted one already did off Windows. Run: - TestIsPathWhicheverSystemWroteIt (new). On the Windows box at the old code it fails for "/Users/me/plugin", "/home/me/plugin/index.js" and `\Users\me\plugin`; on macOS for the two backslash forms. Passes on both with the change. - On the Windows box, the three reds the issue names, old code then new: TestPluginsCarried (provider), TestRestorePluginsAndSignIn (backup), TestSyncPluginsAndSignIn (davsync) FAIL then PASS. - go test -tags nogui ./... on macOS with this and the next four commits: every package ok. - gofmt -l, go vet ./... on darwin, linux (nogui) and windows, and the three builds: clean. - Windows internal/plugin as a whole: TestTaggedRepos, TestTaggedReposSlowRead, TestReadmeOfTaggedRepo, TestGitPluginUpdateOnlyWhenItsRepositoryMoved, TestMarketIconsAreBundled, TestEnsurePi and TestGitPlugin fail there with and without the change (Windows-only, CI compiles them only). TestLoadConcurrentWithSavesAndEdits failed once in the full package run with the change; alone it passed 6 of 6 at the old code and 6 of 6 with it. Noted on #1827, the open issue for Windows-only reds. |
||
|
|
1ad60446ff |
gateway: a model failing between its siblings' answers climbs its own rest ladder, not a minute forever (#2241, weizsw)
The backoff count was kept per account (restKey), and any model's answer
cleared it. On an account serving several models, a model that kept
failing while its siblings answered was counted 1 every time and rested
one minute, forever. weizsw's Antigravity seat: 41 of 43 rests at
failures: 1.
restAfterMarked now also counts each model's own failures (restID), and
only that model's answer clears that count (servedCandidate). When a
model's own count is past the account's, a sibling answered since the
model last did, so the failure belongs to the model. It climbs its own
ladder (1, 2, 4, 8, 10 minutes) and rests alone, keyed by restID, while
its siblings stay served. If every model fails with no answer between
them, the account still climbs and rests whole, as before. A window
rest wins as before. A candidate naming no model keeps the account's
count alone.
What was run:
- TestModelLadderClimbsPastSiblingAnswers (new, model_ladder_test.go).
Old code: FAIL ("failure #2 after a sibling's answer: 1 failures,
rests 59.99s; want 2m0s"). With the restID choice taken out by hand:
FAIL ("rests antigravity@seat@example.com, want the model alone").
With the fix: pass.
- The first full run caught TestSmartRouting. Its modelless candidate
("t#fail") was given a "t#fail/" count that its served() call never
cleared. Fixed by counting per model only when the candidate names
one. TestSmartRouting and the rest/ladder tests pass.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and GOOS=windows
clean.
- HOME=<scratch> go test -tags nogui -timeout 40m ./...: every package ok
except gateway's TestSmartRouting (above). After the fix, gateway was
rerun whole: ok (468s).
|
||
|
|
c20bb76c4c |
gateway: a sandboxed frame's Origin: null spends a subscription only with a gateway key (#2242, JasonBuildAI)
A sandboxed iframe, or a page opened from file://, sends `Origin: null`.
foreignPage judges only http and https origins, so corsGuard let "null"
through without a key. A simple text/plain POST from such a page (no
preflight) reached /v1/chat/completions and spent the user's
subscription. corsGuard is where every route's same-origin is decided,
so the fix goes there: a request with Origin: null is answered only
when it carries a working gateway key (keyedCaller, which the listed-
origin 401 path now uses too). It gets 403 and a message that says how
to send a key. App schemes (app://…) and requests with no Origin are
unchanged.
The patch is JasonBuildAI's fe11a8abd (fork branch
fix/null-origin-keyless-spend-a13b21). docs/subsystems/gateway-sessions.md
also says that a null Origin needs a key.
What was run, at this commit's parent
|
||
|
|
d5847f1985 |
provider: a Codex token refresh replaces ~/.codex/auth.json through a flushed temp file, so a crash or a file held on Windows leaves Codex signed in, not an empty auth.json or a spent refresh token (#2239, JasonBuildAI)
codexToken wrote the rotated tokens back into the user's own Codex sign-in (~/.codex/auth.json, $CODEX_HOME when set) with a bare os.WriteFile: O_TRUNC, then write, error dropped. A machine going down between the two leaves the file empty or zeroed (#1505's shape, on the vendor's sign-in), and on Windows a file another program holds for a moment refuses the open, so the rotation never reached the disk while the refresh token on it was spent (refresh_token_reused on the next refresh, magpie's or Codex CLI's). It now goes through writePrivate (edit.Target + steady.WriteFile: temp file beside it, fsync, rename, held target waited out by steady.Rename for up to 0.5s, mode 0600); a write that still fails is logged rather than dropped silently, and the fresh access token still serves the request. codexToken is the one path for the default home's account, its usage, resets, keep-alive and the Usage page. Siblings: grepped every os.WriteFile / O_TRUNC / os.Create outside tests. The only other write of an agent's live sign-in that truncated was writeClaudeCredential's file branch (Claude Code's .credentials.json, written when magpie switches Claude Code's sign-in off the Keychain); it now goes through writePrivate too and returns a failed flush as an error instead of "saved". Saved accounts' refreshes (logins_on.go) already go through writeLogins; Kiro's IDE file through writeFileAtomic; Codex/Claude switches through writePrivate; mcpauth and plugin-auth through steady. Gemini's oauth_creds.json, Cursor's, Grok's, Command Code's, ZCode's credential files are only read. The remaining os.WriteFile calls write magpie's own caches, marks, ids, temp files, or create a file only when it is empty (dsh, zcode). docs/subsystems/providers-accounts.md's #1505 entry says so. Tests (internal/provider/credentials_write_test.go, _windows_test.go): - TestCodexRefreshFlushesAuthJSONBeforeReplacingIt: steady.Sync made to fail leaves auth.json byte-identical and no temp file; with a working flush, auth.json still holds the old sign-in at flush time, the temp is beside it, the result keeps every other field and mode 0600. - TestClaudeCredentialFlushesBeforeReplacing: same for .credentials.json, and a failed flush is an error. - TestCodexRefreshOutlastsAHeldAuthJSON (Windows): auth.json held with CreateFile(GENERIC_READ, FILE_SHARE_READ) for 100ms during the refresh; the rotated r-work-2 must be on the disk afterwards. Broken by hand: with both writes put back to os.WriteFile, on macOS the first two FAIL ("a flush that failed left auth.json ...r-work-2..., want the sign-in as it was"; "a write whose flush failed reported as saved"), and on the Windows box (Windows 11 x64, amd64 test binary, sandbox USERPROFILE/APPDATA/LOCALAPPDATA/TEMP) all three FAIL, -count=3, the third with "the rotated tokens are not on the disk, only the spent one's: ...r-work...". With the fix all three PASS 3/3 on Windows and the two PASS on macOS. Run on origin/main |
||
|
|
ce13984567 |
testenv: a stand-in codex is found before the installed one on Windows, so the gateway's tests don't read the user's Codex version (#1827, EdwinDigital)
Windows finds a program through PATHEXT and skips a file with no
extension. testenv.inertTools wrote a .bat beside each #!/bin/sh stand-in.
The gateway's TestMain calls StandIns directly, though, and StandIns wrote
only the extensionless file. On a box with Codex installed, LookPath went
past the stand-in to the user's codex.cmd.
TestCodexPoolSaysTheClientsVersion then saw the installed 0.162.0 instead
of its fixture's 0.161.0, which is exactly what EdwinDigital reported. The
.bat is now written in StandIns, so every caller gets it.
TestStandInsComeBeforeTheInstalled puts StandIns("codex") on PATH first
and an "installed" codex (codex.cmd on Windows) that prints 0.162.0
further down. LookPath must pick the stand-in, and running it must fail
with no output.
Run:
- gofmt -l is clean.
- go vet passes for darwin, linux -tags nogui and windows (testenv and
gateway).
- go test ./internal/testenv/ passes on macOS.
- Windows 11 x64 box (ssh), test binaries cross-built with Go 1.26.8.
A fake codex.cmd printing "codex-cli 0.162.0" was on PATH.
- The gateway binary before this change fails
TestCodexPoolSaysTheClientsVersion with EdwinDigital's error (UA
codex_cli_rs/0.162.0). The binary after it passes.
- The testenv binary before this change fails the new test, and the one
after it passes.
- Full gateway binary on that box, with its testdata copied (no source
tree): the same failures before and after. They are source-reading tests
that need the checkout, and TestClaudeAsRootEnv (#1827). The one
exception is TestQueuedStreamKeptAliveForASlot, which failed once in the
run after this change. It passes 5 of 5 alone on both binaries. Its cause
is Windows' ~0.5ms clock tick in a strict Before (filed as #2249).
|
||
|
|
bcd7881364 |
git: every text file checks out with LF, so a Windows checkout with autocrlf on doesn't turn four guard tests red (#1827, EdwinDigital)
TestEveryNoticeIsTranslated (agent), TestBuiltinsTranslated, TestPurposeAssetMatchesUsage and TestRedactKindsAreRedacts (gui) parse source files with LF-only patterns. Git for Windows' default core.autocrlf=true checked those files out with CRLF, and all four failed there; EdwinDigital found they pass from an LF checkout. A root .gitattributes with `* text=auto eol=lf` makes every text file check out with LF whatever autocrlf says. internal/agent/testdata's own `* -text` still keeps its CRLF .cmd fixtures byte for byte. The index already holds every text file with LF (git ls-files --eol: the only i/crlf files are those two -text fixtures), so nothing is renormalised. Run: two --shared clones with core.autocrlf=true and a sparse checkout of internal/gui/assets, notice.go and the mise-windows fixtures. At the parent, i18n.js and app.js check out with CRLF; at this commit with LF, snow.cmd keeps CRLF, and git status is clean in both. Not run: the four guard tests on a Windows checkout (no Go on the Windows box); a checkout made before this commit keeps its CRLF until the files are checked out again, as in a fresh clone. |
||
|
|
595b9a25bc |
gateway: WorkBuddy's own X-Conversation-ID names its session, so Routing groups its requests by conversation, not under No session ID (#2236, EdwinDigital)
WorkBuddy and CodeBuddy name their conversation in X-Conversation-ID, which sessionHeaders didn't list, so every WorkBuddy request had no session: Routing put them all under "No session ID", and affinity, usage, transcripts, OTel and a remote magpie lost the conversation too. The header is appended last, so the aliases already read keep precedence, and the vendor is never sent it. Moved users are covered by the same line: the gateway gives a plugin the session as ConversationHeader from conversationID(), plugins.go passes it as FetchRequest.Session, and the WorkBuddy plugin derives its own X-Conversation-ID from that. No plugin change is needed. EdwinDigital's record (Windows ARM64, Go 1.26.8, temporary HOME): - Removing only the alias makes TestWorkBuddySessionHeader, TestWorkBuddySessionThroughGateway and TestRemoteMagpieKeepsTheSession fail. They pass with -count=20. - gofmt and git diff --check are clean. Windows go vet ./... and Linux ARM64 go vet -tags nogui ./... pass. - Installed WorkBuddy 5.8.2 (engine 2.161.0) ran against the patched gateway and a loopback streaming mock. Two native sessions grouped 2+1, with both titles resolved. Review and run at this head (macOS, Go private cache, sandbox HOME): - I read the patch line by line. - The three tests pass. Commenting out the alias by hand makes all three fail. - gofmt -l is clean. go vet passes on darwin, linux -tags nogui and windows. - go test -tags nogui -count=1 -timeout 40m ./internal/gateway/: ok (811s). Not tried by me: a real WorkBuddy or CodeBuddy client, and real vendor calls. EdwinDigital ran WorkBuddy against a mock. |
||
|
|
2bbe89bdba |
gui: the Requests tab's Agent name sits on the row's middle line, level with the time and model, not ~2px above them (#2237, duanckham)
The Agent cell's .who was inline-flex. Its first item, the agent icon, holds no text, so the box took the icon's foot as its baseline and sat that on the line's baseline, which lifted the name about 2px over the Time and Requested cells. .who is now a flex block, which the cell centres as it centres the time and the model. New internal/gui/tests/usage-ledger-agent-middle.test.cjs: for a Codex row with a route link (the reporter's), a Claude Code row and magpie's own row with its badge, the name's text midline is within 1px of the time's, the requested model's, the cell's and the icon's, and Status stays level with the time. Chromium and WebKit, en/zh/zh-TW/ja/de, at 1100 (light) and 420 (dark). On the old CSS every case fails (name ~2.07px above the time); with the fix 22/22 pass. Run: that file plus usage-ledger*, ledger-* and own-* GUI tests in both engines (254/254), go test -tags nogui ./internal/gui/ (ok). CSS only, no Go change, so no vet. Not tried in the real Wails window. |
||
|
|
3d3a834d62 |
gateway: a held key its owner lets see quotas is told those of the providers and accounts it may use, not none (#2216, Kenoia)
#1981 refused every quota route to a gateway key held to a budget, models
or accounts, so a Remote magpie set up with such a key showed none of the
providers it may use. A key's owner can now let it be told them:
access.Key.Quotas, set from the key's new "Quotas" badge on the Gateway
page or `magpie gateway-key quotas <id> on|off`. Off stays the default,
so #1981's answer is unchanged for every key until its owner says so.
With it on, /v1/magpie/quotas (and ?kept=1), /quotas/history,
/quotas/cards and POST /quotas/refresh go through scopeQuotas
(internal/gateway/quotas_scope.go):
- a provider is told only when the key may use every model the catalog
lists of it: a key with some of a provider's models is told nothing of
it, since the models it may not use spend the same quota;
- of those, only cards of accounts and keys AllowsAccount lets it use,
matched by the card's User against AccountIDs (a name two accounts
share needs both; a card no account is known by only where the key's
list names none of that provider's); a provider's only key's card,
named by no one, is that key's;
- cards read from another magpie (From) are never told;
- a refresh of a card outside the scope is 403 gateway_key_held, one
naming no card reads again only the scope's cards, not ReadAllCards;
- a scope with no card answers the cards routes 403 gateway_key_held, so
the remote shows the key's own card rather than "nothing read".
/v1/magpie/concurrency and /v1/magpie/usage still refuse a held key.
Run at the reviewed head:
- gofmt -l: clean; go vet ./... (darwin), GOOS=linux -tags nogui,
GOOS=windows: clean.
- go test -tags nogui -timeout 45m ./... in a sandbox HOME, after the
rebase onto
|
||
|
|
f0f63bf6b8 |
provider: Zen's free models answer again: asked at opencode.ai/inference/v1, with stand-in tools that take a parameter, and without x-session-affinity (c9cu on Discord)
c9cu: "opencode muse 1.3 又不行了,magpie v0.1.1239". Zen's free tier moved and tightened in mid-October 2026, found against the real upstream on 10-15: - free models answer only at https://opencode.ai/inference/v1 (models.dev's opencode api is that URL now); OpenCodeFreeURL maps /zen/... there for a free model, never /zen/go or another host, in forwardOnce and the probe; - the bash and read tools offered must each have at least one parameter: the stand-ins (zenfree.go, the probe) now carry OpenCode's own (OpenCodeToolSchemas); - a request carrying x-session-affinity is answered 403 FreeTierError. OpenCode 1.19.0, captured through a forwarding proxy, sends Zen neither x-session-affinity nor X-Session-Id, so OpenCodeClient takes both out; the agent's own session id still names x-opencode-session. Bisected header by header: X-Session-Id, Accept and the UA version don't matter; x-session-affinity alone turns a 200 into a 403. Live against the real Zen with the public key (a test file since removed): muse via /v1/responses streamed (xhigh) and not, big-pickle on chat streamed, mimo-v2.6-flash-free on chat: all 200; muse via /v1/messages 200. The same code with x-session-affinity left in: 403 on every case. Run: gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui on internal/provider and internal/gateway; the full go test -tags nogui -count=1 ./... in a sandbox HOME, whose one red was gateway's TestOpenCodeClientHeaders still expecting the two headers (updated here), then internal/gateway alone again: ok (678s). New tests TestZenFreeAtInferenceURL, TestOpenCodeFreeURL and the probe's non-empty properties check fail on the old code. The community plugin got the same fix in magpie-community/plugins 5fc0a75 (zen-free 0.1.7); its npm publish is blocked on the repo's publisher setup. |
||
|
|
8e8316ed2f |
provider, gui: a routing group's pickers offer OpenRouter's decision models only as the provider's picks say (coeo91 on Discord)
coeo91 picked two free OpenRouter models, and a new routing group's member
picker showed those two and then a run of others. Those were OpenRouter's
decision models (liquid/d1, pplx-decider, jev-latest and the rest of its
output_modalities=decisions list): Deciders() took decideModels() for a
provider that lists its decisions (OpenRouter, oMLX, MLX-Serve), Bailian,
a remote magpie or a plugin, whatever its picks, while the provider editor
draws the same models as unpicked chips.
OfferedDeciders is what a group's pickers offer: with picks saved, only
the picked decision models plus any a group already names as a member or
classifier (so a group made before reads the same); with no picks, every
one, as before. /api/groups' deciders (member and classifier pickers),
the templates and the TUI's member picker use it. Deciders() is
unchanged, so the gateway still lists every decision model to a remote
magpie (X-Magpie-Deciders) and RouteDecider still answers an unpicked one.
docs/subsystems/providers-accounts.md says which is which.
Run in a private GOCACHE and sandbox HOME:
- the new TestOpenRouterDecidersOfferedAsPicked passes; with the pick
filter turned off by hand it fails ("chat models picked, offered:
[pplx-decider-v1-27b liquid/d1 jev-latest]").
- go test ./internal/provider -run 'Decide|Decider|OpenRouter|Template|
RemoteMagpie|Bailian|OMLX|Omlx|MLX': ok.
- go test -tags nogui ./...: every package ok except internal/library,
which hit the 10m timeout with the machine at load ~150 (stacks in
mcpauth flow.end sleeps; nothing here touches library). Rerun alone
at the same load with -timeout 25m: ok in 252s, 285 tests passed, the
slowest TestAgentMCPFiles at 33s, so the 10m was the whole suite's
load on this box, not a hang.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows;
GOOS=linux -tags nogui and GOOS=windows builds.
After rebasing on origin/main
|
||
|
|
7be68467f4 |
gateway: Claude Code's own "Prompt is too long" is a 400 that says whose check it was, not a 502 that reads as Anthropic's fault (#2162, iefnaf)
iefnaf's pi, on claude/claude-sonnet-5-5 through a Claude subscription, was answered 502 "Claude Code: Prompt is too long" at about 176-180K tokens of a 1M model, in 30-50ms, with no request id. That is Claude Code's own check, not Anthropic and not magpie: Claude Code 2.1.299 refuses a conversation locally once its estimate passes its window less the reply's room, and it clamps a 1M model's window to 200K for the rest of the process once Anthropic has answered 429 "Extra usage is required for long context" (its longContext1mCreditsBlocked latch). 200K less the reply's room and 3000 is about where the refusals sat. A fresh API-key Claude Code against a fake upstream is refused only near 990K, which is why it isn't the model's window. Lifting the check (CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE) was tried and dropped: Anthropic would then refuse the same request itself. The bridge passed that error on as a 502, which a client reads as an upstream fault. bridgeFailed now answers a status-less "Prompt is too long" from Claude Code with 400, as Anthropic's own too-long answer is, so writeError gives it context_length_exceeded and a routing group offers the overflow to a member with a bigger window. The words a client knows an overflow by stay first, and what follows says it was Claude Code's check and what to do: compact, or turn on extra usage for the Claude account. A run error with a status, or one about quota, keeps its own, as before. Run, on origin/main |
||
|
|
f348025c09 |
gateway: a Chat or Messages client's interrupted tool call gets its synthetic result on the way into Responses, not the upstream's 400 "No tool output found" every turn (#2222, ggbdpq)
A Chat or Anthropic client whose turn was cut off (Esc, a dropped connection, a crash) sends its history with a tool call no result answers. buildChat and buildAnthropic each give such a call a synthetic result (pairToolMessages, pairToolBlocks), but buildResponses didn't, so a Responses upstream answered 400 "No tool output found for function call <id>" on that turn and every turn after it. ggbdpq's patch called pairToolItems on the body in forwardTranslated. It is called at the end of buildResponses instead: that is where every Responses body is built from a client's request, including Zed's (zed.go builds through it and doesn't pass forwardTranslated). The patch's tests are kept as written. Run, on origin/main |
||
|
|
05107bf03e |
tui: the library page keeps the row picked in view, however many section heads the window holds
What changed: viewLibrary sized its window from the row picked down in rows (`start = lrow - visible + 3`), but the loop it feeds spends the same budget in lines: every section head it crosses takes a line and the blank before it, two the row count never paid for. With two or more heads between the window's start and the row picked (servers, then skills, then those found in the agents — a handful of each on a terminal some thirty lines tall), the loop stopped above the row picked: the highlight vanished, and j and down did nothing the screen could see until the row count brought it back. The window now starts where the lines to the row picked still fit, counted the way the loop spends them. Run: go test -tags nogui -count=1 ./internal/tui/ (the new TestLibraryViewKeepsTheRowPicked is red without the change, watched on |
||
|
|
7a6b101045 |
provider, gui: a login token beside sub2api's /v1/usage is told the panel's account query, not sent to the key's
What changed: - balance.go: the guard that never sends a balance token to new-api's /api/usage/token ( |
||
|
|
f299faef48 |
gateway keys: a key holds several limits at once, every one must pass, and the 429 names the one that resets last (#2227, oxsean)
A key may now hold up to five limits, each in its own window (5 hours
and a week, say). A request needs every one: budget.Reserve checks
each, holds one reservation per window and settles each, and when some
are spent refuses with the spent limit that resets last, so
X-Magpie-Limit-Reset and Retry-After say when the key is really back.
Two limits in one window are refused (change that one instead).
Saved format: the first limit stays in "limit", which older magpie
reads, the rest go in "moreLimits". A file without moreLimits reads as
before.
- access: Change.Index adds (index = len), replaces (keeps its Since)
or removes (nil) one limit; reset-limit-key with an index resets one,
without resets all; the plain limit-key replaces all, as before.
- /v1/magpie/limit: "limit" is the binding one (what older clients
read), "limits" is each. A remote key card shows a window per cap of
each limit and falls back to "limit" from an older remote.
- CLI: magpie gateway-key limit <id> list | add <period> ... |
remove <n> | reset [<n>]; the single-limit form still replaces all.
- GUI: the key's badge names the limit holding it most and "+N limit(s)",
a line per limit under the row, and the editor has a tab per limit
with Add a limit / Remove this limit. Strings in en, zh, zh-TW, ja, de.
- docs/reference.md and docs/subsystems/gateway-routing.md say so.
Run (worktree on
|
||
|
|
a870fb2158 |
gui: with Reduce Motion the header is fitted to its tabs' real width, so no page scrolls sideways a few pixels (#2142, #1864, #2023)
The reduced-motion rule sets every element's transition-duration to .01ms
with !important. An element that declares no transition has the default
`transition: all 0s`, which that turns into `all .01ms`. So a header tab's
label span eased its font-size for one frame when fitTop() added crowded or
packed, and fitTop's synchronous measurement still read the old, wider
text (Chromium and WebKit both). It fitted the header to the narrower tabs;
a frame later the tabs came to 594px instead of 576, .actions poked past
the window, and the page's scrollWidth was over innerWidth. That is
usage-sum-whole's sideways overflow at 740-860px in de and ja, and what
real users with Reduce Motion saw.
Under reduced motion, anything that declares no transition of its own now
has transition-property: none, through :where() so it has no specificity
and any declared transition wins. Every transition in app.css declares its
property in a base rule (checked: no longhand-only declaration relies on
the default `all`), and no JS sets a transition duration. transitionend
listeners in app.js are on .ag-open, .agent-fold and .agent-hid-fold, all
of which declare theirs.
usage-sum-whole also counted a width as cut when the page's frames were
held past its 3s wait by a busy machine ("1220px: " with nothing after
it). It now looks again once the wait ends, and a redrawn cost with no sum
in it yet isn't read as a cut one.
Run:
- usage-sum-whole: 3 runs x 8 cases, 24/24 pass. Without the app.css
change, 6/8 (de and ja overflow at 780 and 850-860). With a 3.5s busy
loop injected at 1220px: 8/8 with the new wait, "1220px: " in every
language with the old one.
- Full GUI suite (chromium + webkit, all languages and widths the tests
carry) with the change at load ~300: 9335 tests, 127 failing in 30
files. Every failing file was rerun alone on this tree and on
origin/main
|
||
|
|
91b9065a5f |
gui: the window's core scripts have a size budget, so a page can't grow back into it (P2)
TestCoreScriptBudget adds up the scripts index.html loads that aren't a plugin's (assets/plugins/<id>/) or the words (i18n.js): app.js may weigh 1,215,000 bytes (1,198,239 now Sessions, Library, Routing and Usage are plugins) and the core 1,377,000 (1,358,034), about 1.4% room. A change that needs more raises them and says why in its commit. boot.js, made by the server, isn't on disk and isn't counted. Run: go test -run TestCoreScriptBudget ./internal/gui ok. Broken by hand: with the app.js budget at 1,190,000 it fails naming app.js's bytes, and with plugins/usage/page.js counted as core it fails on the total (about 1.5 MB). |
||
|
|
3c7ec4ba24 |
gui: Usage is a plugin's page, its code, markup and words in plugins/usage (P2)
P2 of docs/subsystems/plugin-runtime.md, the fourth page after Sessions,
Library and Routing, and the largest part of app.js.
- The Usage page's code (~3000 lines: the Overview's cards, the
Requests ledger and heatmap, the Sessions tab, the Agents list) moves
from app.js to assets/plugins/usage/page.js; its markup, index.html's
<main id="view-usage">, is client.js's part html. app.js 25756 →
22675 lines (1,355,376 → 1,198,239 bytes).
- page.js builds on app.js at the top level (its timers, ?view=usage's
tab and filters), so it is the one plugin script that loads after
app.js. index.html: kernel.js, the plugins' other scripts, app.js and
the scripts beside it, each page.js, then start.js, which is app.js's
old tail (magpie.start(), navHides, OPEN_VIEWS, the first page shown,
load()), so the first page has its code. TestBuiltinClientsLoaded
holds that order.
- Hooks: open loads it, refresh(again) is load()'s read of it, reload is
Refresh now, costs redraws costs on a currency change, tab says the
tab for focusQuotaCard. app.js calls those through magpie.call. The
allowance cards, quotasOpened, panelQuotaFocus and panelUseFocus stay
in app.js: the tray panel draws them too.
- plugins/usage: Essential, Requires window, no InUse. Off, its nav tab
goes and so do the ways to it (data-feature="usage": the panel's Open
Usage, Routing's View usage); show("usage") gives way to Agents; the
panel's Allowances tab stays. builtins.test.cjs switches it off and
checks each.
- The 173 strings only Usage says move to plugins/usage/i18n.js;
i18n.js 15032 → 14344 lines. "{n}s" and
"All sessions" stay: context.js says them too since #1591.
- context.js: with context.js now in before the first page is shown,
the page's open and load()'s first refresh both reached loadContext,
and the second drew "Reading…" again over the advice the first had
just drawn, so its curves never played their entrance (context-tune,
3 of 3 red). loadContext draws the waiting pane once for the same
days. Its dead last line, which loaded the tab once context.js came
in late, goes.
- context-window.test.cjs's "arrives after the state" becomes "loads at
once though context.js is slow": start.js now waits for it.
usage-stale-answer reads page.js beside app.js. quota-refresh-order
(#1630) cut app.js at the period picker's comment, now in page.js; it
ends at the next comment that stays (5 of 5; without keepRefreshedQuotas'
call, 2 of 5 red).
- docs: plugin-runtime.md, gui-shell.md.
Run, at this tree on origin/main
|