ac4af582301a4e8a29245dbba767eba31334ddf9
11
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3eb2bda4f2 |
settings: Codex, Claude Code and Grok Build each take a Long conversations of their own (molianyin4227 on Discord)
molianyin4227 (Discord #help): models differ, so one compaction size
for every agent fits none; they asked for Codex, Claude Code and Grok
Build to each have their own, falling back to the shared one.
- settings.AgentCompacts[agent] {At, Full} for the agents that write a
compaction window (CompactAgents: codex, claude, grok); Settings.
ForAgent(agent) lays it over CompactAt/FullContext for that agent's
readers only: codexcat.entriesAt, provider codexListed, Claude Code's
writeCompact and desktopPlan, grokModelTables, the route list's
buildModels, Codex's window line (api.go) and Tuned for you
(gui/tune.go, agent/tune.go). A model's or provider's own Compact at
still comes first. An agent with none follows the shared value, so
nothing new is written for it, and an agent outside the three has no
such key and is refused (provider.SetAgentCompact).
- POST /api/settings/agent-compact {agent, own, full, at}; own false
takes the agent's value away. settingsapi.Merge keeps the map.
- GUI: a row "Long conversations in <agent>" under Long conversations,
in the agent's opened row and its sheet: Every agent / Compact at N /
Full window (segs, no select), a size box when Compact at. It lives in
agentcompact.js, imported when the agent's settings hold Long
conversations, then put in synchronously (an async put-in after a
redraw moved the page in chromium: codex-memories-settings' scroll
check). It draws again only when its own values change. i18n in
zh, zh-TW, ja, de.
- Tuned for you's Use on an agent with its own value changes that one,
stashed under tune.long.compact.<agent>; Undo puts it back.
- codex-memories-settings' "no Codex" check counts Long conversations
alone again (:not(.agent-compact)) and waits for the new row.
- docs/subsystems/agent-wiring.md: a row for it.
Core size: app.js 1,311,919 bytes, 109 under origin/main
|
||
|
|
c903c3a411 |
usage: Use on Codex's window lands over 7 and 30 days, a model's own Compact at named apart (hoobnn on Discord)
hoobnn on Discord (11-01): "观测-用量-上下文里,在7天或者30天的选项里,点击
应用codex的上下文,没生效。" Over 7 or 30 days the range held calls on a
model whose provider has a Compact at of its own (430K); today's didn't.
Tuned for you's "Now" was the largest compaction point over every model
in the range, so it came from that model. Use put the advice in Long
conversations, which did move Codex's other models (Codex's list had
them at the advice), but the card still read 430K and then turned held
("compacts at its own 430K, which comes first"), so nothing seemed to
happen. And with Long conversations at magpie's default, a range of
only such models offered a Use that could move nothing.
codexWindow (internal/gui/tune.go) now reads "Now" from the models Long
conversations moves, and lists each model with its own Compact at as
Apart (largest first). Only a range whose every model has its own is
held (Own), whatever Long conversations says. The card names each
model kept apart under the row: "{model} compacts at its own {value},
which this doesn't move", in en, zh, zh-TW, ja and de.
provider.CompactSetIn is CompactSet with the caller's settings and
group finder, as CompactFor takes them.
Siblings: Claude Code's knob is per model (no max over models), so it
has no such mix. 1, 7 and 30 days go through the same codexWindow;
the GUI test covers 7 and 30 and the Go test the 1-day sample.
Run on mote at
|
||
|
|
05f6ca39b3 |
provider, gui: settings only read go through the shared copy
settings.Load clones the whole Settings, every provider's model prefs included. CompactsOf, OutputsOf, ModelNames, ModelEfforts, settings.SavedAddr and the GUI's providerInfoWith only read it, and providerInfoWith took a copy for each provider: 16 MB of what twenty window polls allocated in a real-account sandbox, more with each model a user has set prefs for. They read settings.Shared() now. ModelEfforts hands back a clone of the slice it finds, so a caller's change never reaches the shared settings. TestModelPrefsReadTheSharedSettings: 3000 other models' prefs; the values are right, a caller's change to ModelEfforts' list doesn't reach the settings, and each look allocates at most a tenth of Load's. Red on the old code: ~6058 allocations a look against 6056 for a Load. Run at this head on mote: go vet (darwin, GOOS=windows, GOOS=linux without the gui package) ok; go test ./internal/settings and ./internal/provider ok; ./internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red on main. |
||
|
|
f985d6bdb6 |
provider: a Max output kept for a model no longer listed doesn't block the editor's Save (#3305, LoKi)
LoKi (#3305, Windows, v0.1.1325, Zen Free plugin 0.1.14): settings.json
held "opencode-zen-free/space-bunny-free": 65536 from when Zen Free
listed it. OutputsOf gives the editor every saved limit, the editor
sends them back as `outputs` on every Save, and SetModelOutputs refused
any positive entry for a model the provider doesn't serve, so each Save
failed with "opencode-zen-free has no model space-bunny-free", with no
model picked too.
SetModelOutputs (models.go) and its sibling SetModelCompacts
(compact.go, the editor's Compact at, same check and same round trip)
now refuse an unserved model only when its value is new or changed: an
entry sent back as it is stored is kept, and the rest of the Save goes
through. The user's value isn't deleted, since they set it and the model
may come back on the next refresh. It still shows in Max output as
model=size, and taking it out there clears it, as before. A newly typed
model the provider doesn't serve, or a changed value for a retired one,
is refused as before. SetModelOutput (the CLI's single set) is unchanged.
Siblings checked: the editor's Context window goes through provider.Save,
which never checks it against the list, so a retired model's window
already saved; Names & levels (modelPrefs) sends only the entries
changed in that editor session (modelPrefsOfDraft), so a retired one
isn't resent.
Run at
|
||
|
|
81a24cf8fe |
groups: a found group is listed as auto/<model id as the vendor spells it>
ZeroClover asked on X: Auto Group ids group/auto-<slug> can't be looked
up on models.dev. A found group is now listed and written as
auto/<model>, e.g. auto/claude-opus-5.5: /v1/models, the catalog, agent
configs, the GUI's Routing page and the CLI. Context and output limits
come from the model's metadata as before.
What stays the same:
- The internal id is still group/auto-<slug> (Group.Ref() gives the
public one). Every old form is still accepted as input forever:
provider.CanonicalRef turns auto/<model>[:level][[1m]] into it at the
gateway (validateModel), keys, stats, affinity and usage, so both ids
route to the same group and count as one.
- A key's model list allows a model by either id, group/* included
(allows() in key_models.go).
- Hand-made groups stay group/<id>.
- A provider whose stored id is "auto" keeps its models: while one
exists, found groups are listed by their old id (AutoRefsOn) and
auto/<x> means that provider's model. Documented in
docs/subsystems/gateway-routing.md.
Agent configs: SyncCatalog rewrites a field that holds a found group's
old id (renameFoundGroups), but only while the value is still what
applied.json says magpie wrote; a value the user set stays. A pick by
the old id written now is written as auto/<model> (Apply). Hidden,
picked and ordered model lists saved by the old id hold for the new one
(visible.go), and a bare model id still reaches its found group (bare.go).
Claude Code is given a dotted Claude version dashed (ClaudeSpelled), so
auto/claude-sonnet-4.5 sits in its settings as auto/claude-sonnet-4-5.
That routes to the same group, but with found groups off nothing reads
it back dotted, and Reseat took the field for changed and left the agent
on a group that was gone. Reseat now compares a group pick by its
canonical id (samePick). The old ids had no dots, so this is new with
auto/<model>.
Run at this tree (sandbox HOME, caches pinned):
- gofmt -l: clean. go vet ./...: clean on darwin, GOOS=linux -tags
nogui, GOOS=windows.
- go test -p 4 -timeout 45m ./...: every package ok except agent and
gateway, whose failures were the tests' expected ids (updated here)
and two regressions now fixed (bare ids; desktop models hiding groups
by prefix). Every failing test passes on rerun. Load average was
~210-290 from other sessions throughout.
- Reruns: provider, cli, codexcat ok. internal/gui: only
TestSetAnswersWhileDevinAndProvidersHang fails (set slow/slow-1 took
10.19s), and it fails the same in a git-archive export of
|
||
|
|
be6a74f13e |
provider: a routing group told its largest member's window runs to it when the user typed it (Osal on Discord)
Osal set the codex provider's windows to each model's most (gpt-6-astra=872k and the rest) and ran Codex on "6 Astra · routing group Ultra". Codex said "已用 114k 标记,共 258k": 95% of magpie's default working window, 272K. A group that names no size of its own is told its largest member's window (#712), but buildGroupEntries never carried whether the user typed that window (Entry.WindowSet), as it does for a group set to a size (#1809) or one following its smallest member (#2224). CompactFor then returned 0 and codexcat wrote context_window 272000, max_context_window 872000. Now the largest member's WindowSet comes along (a tie counts as typed), unless a rule of length lifted the window past it; WindowTyped says the same for Claude Code and Claude Desktop (largestWindow). A group whose largest member's window nobody typed keeps the default, and a size typed in Settings (Compact at) still comes first. TestLargestMemberTypedWindow (internal/agent): on the old code the gateway's list compacts group/ultra at 0, magpie-models.json tells it 272000 (max 872000), Claude Code gets CLAUDE_CODE_AUTO_COMPACT_WINDOW 272000 and Claude Desktop no per-model window; all four pass now, and a group whose 1M member is untyped keeps 272K. Run: gofmt -l (clean); go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows (clean); go test -run 'TestLargestMemberTypedWindow| TestSmallestMemberTypedWindow|TestTypedWindowReaches' ./internal/agent; go test -timeout 45m ./... at |
||
|
|
8f4d091c6e |
provider: a group following its smallest member runs to that member's window when the user typed it, not magpie's 272K (#2224, Zypixh)
A group set to "smallest member" was told the smallest window, but not that it was one the user typed: groupEntries set Entry.WindowSet only for a group's own size, and WindowTyped said yes only for g.Context > 0. So a 500K typed on the provider for gpt-6.1-sol reached /v1/models, yet Claude Desktop's modelSettings.<id>.autoCompactWindow and Codex's compaction were magpie's default 272K, while the same group set to 500K itself got 500K. smallestWindow now gives the smallest window among a group's members and whether the member it comes from has a typed one (a tie counts as typed); groupEntries carries that into WindowSet (Codex, CompactFor) and WindowTyped asks it for a smallest-member group (Claude Code and Desktop). Members are already flattened through groups in groups, so an outer group passes it on. A group whose smallest member's window nobody typed, and largest/unset groups, are unchanged. Run (sandbox HOME, pinned caches): - TestSmallestMemberTypedWindow (new, internal/agent): on the old code FAIL "the gateway's list compacts group/pool at 0; want 500000" and "Claude Desktop: group/pool ... compacts at "272000"; want "500000"", same for the nested group/outer; with only compact.go reverted the Desktop lines fail. With the fix ok; group/plain (untyped) stays 272000. - go test -count=1 -timeout 30m ./internal/provider/ ./internal/agent/ ./internal/gateway/: ok (374s, 958s, 1042s on a loaded machine; a first run with the default 10m timeout timed out in gateway under load) - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. Not run: the full go test ./... (disk kept low); not tried with the real Claude Desktop. |
||
|
|
f94809d23e |
agent: Claude Code isn't handed 272000 for a routing group made only of Claude models (#1741, yanjieee)
writeCompact gives a Claude model its own window (no
CLAUDE_CODE_AUTO_COMPACT_WINDOW unless the user set a threshold), but
claudeModel looks only at the id's last part, so group/auto-claude-opus-5-5
or any group of Claude [1m] models was told magpie's default 272000.
provider.ClaudeGroup is true when every member of a group (nested groups
flattened, by the listed name or the wire name, Bedrock names included)
is a Claude model; writeCompact now treats such a group as it treats a
Claude model. A group with another vendor's model keeps 272000. A
threshold set on a member's provider still comes first (CompactSet), and
the user's own env, autoCompactWindow and modelSettings are untouched.
Siblings: only Claude Code has a Claude exemption. Codex (codexcat
work.Working, route.go/models.go CompactFor) applies the working window
to every model, so has no group misread. claudeOutput's claudeModel uses
are about output tokens and are left as they are. Part (b), per-model
modelSettings windows, is tracked separately.
Run: TestClaudeGroupCompactWindow (new) fails on the old writeCompact
("a group of Claude models: 272000"), passes now, with a user-owned env
500000 and autoCompactWindow 900000 kept; go test ./internal/agent
./internal/provider; gofmt -l; go vet darwin, linux -tags nogui, windows.
Not tried in a real Claude Code session.
|
||
|
|
f340aecabc |
provider, agent: a context window the user typed on a routing group or a provider is the one Codex and Claude Code run to, not magpie's default 272K (#1809)
A DeepSeek V4.1 Flash routing group set to 500K reached the catalog as Context 500000, but magpie's default working window (settings.Working, 272K, #876) cut it: Codex's magpie-models.json said context_window 272000, max_context_window 500000, and Codex runs to 95% of context_window, the ~258K in the report. Claude Code showed 500K (CLAUDE_CODE_MAX_CONTEXT_TOKENS) while magpie also wrote CLAUDE_CODE_AUTO_COMPACT_WINDOW=272000, so it compacted at 272K too and only displayed the larger number. From Codex's source (openai/codex @0c7362d, codex-cli 0.162.1): config.toml's model_context_window sets context_window to min(value, max_context_window); usable = context_window x effective_context_window_percent (95 by default); the auto-compact limit is min(model_auto_compact_token_limit, 90% of context_window). magpie writes neither config key and still doesn't, so a user's own model_context_window keeps working as before. magpie's default compaction now gives way to a window the user typed, as it already gives way to Claude Code's own autoCompactWindow ( |
||
|
|
116ca957cc |
agent: a provider's Compact at reaches Codex's on-disk catalog (#876) (#924)
Where Codex compacts a long conversation reached the gateway's /models (provider.CodexListed sets catalog.Model.Compact) and Claude Code (claude.go calls provider.CompactSet), but not the list magpie writes for Codex on disk: magpieModels left Compact unset, so codexcat fell back to the threshold for every model. A threshold the user set on a model or on its provider did nothing while Codex read that list — the case where Codex is not signed in to ChatGPT and model_catalog_json is what it reads. magpieModels now carries it, as the gateway's list and Claude Code already do. provider.CompactSetIn is compactSet for a caller holding the settings and the group finder already, as EffectivePriceIn is for prices: this loop runs for hundreds of models at magpie's start. TestCodexCatalogCompactAtReachesDisk fails without the change (204800, want 100000) and passes with it: relay's "*" and then relay/glm-4.6's own threshold reach the file, with the model's window kept as the maximum, and the whole window comes back when they are cleared. Co-authored-by: TryWorld2026 <tryworld@users.noreply.github.com> |
||
|
|
1aaac93b52 |
provider, gui: Compact at — where Codex and Claude Code compact a long conversation, set per provider or per model in its editor and to any size in Settings → Long conversations (#876, hisiling)
Until now the only choice was 272K for every model or Full window for every model. The 272K default stays as it is (
|