ac4af582301a4e8a29245dbba767eba31334ddf9
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7a56c83e72 |
gateway: a compaction Copilot sealed stays out of Codex's auto-review
echo_ts (Discord #feedback) runs Codex Desktop's turns on GitHub Copilot
through magpie, with Copilot's native compaction on, and Codex's
auto-review on its built-in codex-auto-review through the ChatGPT
sign-in. The guardian's review carries the conversation's history, so
after the first compaction it carried Copilot's sealed compaction item
too. A request for one of Codex's own models with no magpie Codex
account to route it is relayed to the sign-in as it came, and
codexInputAs keeps any non-magpie1: compaction ("OpenAI's own, for
OpenAI"), so OpenAI was sent Copilot's ciphertext and refused every
review: 400 invalid_encrypted_content "The encrypted content P4ih...bDU
could not be verified". After the next compaction, the new ciphertext.
The siblings: a side call routed through magpie (the auto-review set to
a magpie model, a subagent or a title on another provider's model)
met checkpointReaders, found no writer among its candidates and was
refused with checkpointError, so the review failed there too. A turn or
a /responses/compact on one of Codex's own models relayed to the sign-in
sent the seal to OpenAI to be refused (sealedCompact took a Copilot
writer for the sign-in's own and relayed it).
Now:
- compactionAside names the calls Codex makes beside the conversation
with its history in them: the guardian (or anything asked on
codex-auto-review), memory, subagent, title, description, thread
summary, prediction and suggestion. In serve, when the writer of the
sealed compaction isn't among such a call's candidates, it goes on
without the compaction item (withoutCompaction, body and plain);
instructions, developer/user messages, the turns since and their tool
calls and outputs stay. The conversation's own turns are still held
to the writer or refused saying why (#1099), unchanged.
- foreignToSignin: on the relay to Codex's own sign-in (codexBackend), a
compaction magpie recorded as sealed by a provider other than the
Codex subscription is never relayed. A side call goes without it; a
turn or a /responses/compact is answered checkpointError, magpie's
own explanation, with nothing sent to OpenAI. A seal with no record
(OpenAI's own, compacted on the sign-in), one the codex provider
sealed, and one whose provider can't be read are left as before.
No portable plaintext summary exists for a native compaction (only the
writer can read it), so the side call goes without it rather than with
a summary.
Run (on mote, through mote-run, at
|
||
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
d10f377657 |
providers: Names & levels is Names, prices & levels, where a model's own price at one provider is set (ferock4669)
ferock4669 asked on Discord whether magpie has a screen to price each model, since one model can cost differently on each provider. It has: each row in a provider's per-model list has a price box (input, output, cache read, cache write, 1h cache write, long-context tier, $ / 1M tokens), saved in settings' ModelPrices under pid/model. It wins over the list price in Usage (usage.Pricer through provider.BasePriceIn) and in a key's spend cap (usage.KeySpent through NewCoster). Nothing has to be built; the button opening it said only "Names & levels", so nobody finds a price there. What changed: - The button, its panel's heading and fold, and every note that sends the user there say "Names, prices & levels" (zh 名称、价格与推理档位, zh-TW 名稱、價格與推理檔位, ja 名前・価格・推論レベル, de "Namen, Preise & Stufen"); the gateway's vision and compaction notes, the provider package's text, the subsystem pages and the site's start docs (en, zh, ja) follow. - The button's tooltip says it sets what each model costs at this provider; Usage's "estimated" tooltip says where a provider's own price is set and that it counts over the list price. Both in en, zh, zh-TW, ja and de. - Not changed: the Codex model description text in internal/codexcat (it goes to Codex, so a vendor sees it) and core_budget_test's history comment. - app.js: a comment above the price box is shortened so the core script stays under its budget, not raised (app.js 116 bytes under origin/main). Run at the pushed head (rebased on origin/main |
||
|
|
fff05e55d8 |
gateway: Codex's compaction trigger is summarised, not refused, when no key that lists the model can carry it (#2725)
nativeCompactionFor kept Codex's compaction_trigger whenever the
provider asked had native compaction on and could be asked it on
Responses. When the vendor's lists held the model to a key that speaks
no Responses there (a key set to Chat), compactionCarriers then cleared
every candidate and Codex got 400 carrierError, with no upstream asked:
the dead end #2725 reports. The trigger is now kept only when a key or
account the request would go over (the provider's and its fallbacks',
or a group's members', held and capped ones too, not one whose own
list lacks the model) carries it (plannedCarrier). Otherwise
codexCompact gives magpie's summary through the listed key, as with
native compaction off.
Patch by ggbdpq (#2725): route (a) and both tests are theirs. Changed
from it: their planCarries ran s.plan / s.planGroup, which weighs the
keys, and a provider routed in turn moves its turn along there
(routes.Rotate). nativeCompactionFor runs on every Codex turn (handle,
codexBackend), so each decision would have skipped a key. plannedCarrier
reads perKeyBarred without weighing. Doc sentence in
docs/subsystems/gateway-routing.md.
Run (worktree at
|
||
|
|
45b8c725cf |
gateway: a legacy /responses/compact carrying another account's native compaction goes to that account, or is refused saying why (#2727, ggbdpq)
codexBackend's /responses/compact relayed to Codex's sign-in (or, with the sign-in paused, compactOn's account) before any seal check, so a compact whose input carries a compaction magpie recorded another account as the writer of reached an account that can't read it, and Codex got the backend's bare 400. Now sealedCompact judges it, as /responses already is (codexSealedFor -> serve, #2642): the writer on in magpie answers it, signed as the writer (codexUpstreamOn); a writer gone (signed out, lapsed, paused, switched off, kept from the model) is refused 400 with checkpointError's reason; the sign-in's own seal, a key's seal, a request naming its own chatgpt-account-id, and a sign-in state magpie can't read relay as before. Two Team seats of one email still read as one (the record holds the email). Review fix on top of ggbdpq's 781381f4: a gateway key held to some accounts (#905) was checked (compactSigninHeld) against the sign-in before the compact was handed to the writer, so a key held to me@ spent the writer biz@ (acct-2 asked, 200), and a key held to biz@ was refused 403 "goes through the account Codex is signed in to" though the compact would go to biz@. The hold is now asked of the account the compact goes to; a writer the key may not use gets 403 sealedCompactHeldError naming the writer, with nothing asked. The test's fake backend now records under a lock. Reviewed and run (reviewer, at this commit with the #2739 commit under it, on 89521b03d; rebased after onto origin/main, see the last line): - Each fix broken by hand, TestNativeCompactionCompactJudgesItsWriter: M0 codex_backend.go as on main: 3 subtests red (writer answers, gone refused, compactOn gone). M1 the key '#' skip dropped: "a seal a key wrote is not judged" red (400). M2 the chatgpt-account-id skip dropped: its subtest red (400). M3 the writer never relayed to: the healthy-writer subtest red (backend saw ""). M4 gone never refused: 2 red. M5 judged after compactOn's relay: the compactOn subtest red (backend saw acct-2). Each green with the code restored. - TestNativeCompactionCompactKeepsTheKeysAccounts (new) on ggbdpq's 781381f4: red both ways ("200, the backend saw acct-2" for a key held to me@; 403 "goes through the account Codex is signed in to" for a key held to biz@). Red again with the hold put back on the sign-in; green with this change. TestGatewayKeyAccountsHoldCodexCompact and TestGatewayKeyCompactOnCodexAPIKey still pass. - -race -count=3 on both tests: ok. - gofmt -l clean; go vet ./... and -tags nogui (darwin), GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean; go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok. - Full suite, set -o pipefail, go test -tags nogui -count=1 -timeout 45m ./... at 519bcc843 (both changes, on |
||
|
|
717b69f78a |
routing: a conversation held to its native compaction's account says so, not "the only account on" (#2639)
A turn carrying a native compaction goes only to the account that
sealed it, so the route's order has one account, and Routing's first
line read "{who} is the only account on for {model}". On #2639 that
read as the other account not serving the model. The route now names
the sealer (Route.Compaction, compactionWho), and Routing says the
conversation stays on it because only it can read the compaction, and
that a new conversation uses the others. Translated in zh, zh-TW, ja
and de.
Run on origin/main
|
||
|
|
bf931f82c3 |
gateway: a Codex conversation compacted natively is held to its account only when native compaction is on, and told why when it can't go there (#2642, #2582)
ScarfQian (#2642, still on v0.1.1279): after a native compaction by one Codex account, routing to another answered 400 "only that key or account can read the compaction it sealed ... switched off, removed, or no longer serves". Three causes, one fix each: - #2582 (Dony2050, ump45nose's patch): one of Codex's own models asked on the backend path through magpie's accounts (codexAccounts) kept the compaction_trigger whatever the codex provider's native compaction setting, so every compaction was sealed by and recorded to one account. It is now decided as a magpie model's is: codexInputAs with nativeCompactionFor("codex/<model>"); off (the default) gives codexCompact's magpie1: summary, which any account reads, and records no writer. Unlike ump45nose's branch, /responses/compact and Codex's own single sign-in relay are left as they were: the legacy endpoint's body has no trigger for codexCompact to answer, and a lone sign-in has no other account to move to. - ggbdpq's fix (0ab41eba0, e1646488d, ported as is): a writer whose own model list has since dropped the model sat in planned.left, out of the candidates, so checkpointReaders never found it and refused although it was on. It is now taken back from planned.unlisted (plan, planLevel and the nested weighted plan), its row moved from left to order. sealedReaders, run before it for a sealed subagent task, narrows unlisted too (sibling). - A request carrying a recorded seal while only Codex's own sign-in is on was relayed as it came (codexAccounts false), so with the writer switched off the one account left was sent it. codexSealedFor routes it through serve, where checkpointReaders holds it to the writer. - checkpointError now says the reason magpie's settings give (checkpointGone: provider removed, account signed out, sign-in lapsed, paused while others are on, switched off, kept from the model in Names & levels, key off or gone, model disabled, or the model/group asked for not routing to it), the fix for that reason, and whether native compaction is on for the writer's provider now. The old catch-all sentence is gone. The seal is still treated as readable only by the account that wrote it, as #1099 and #2271 found; chestnutLeeeee's report that another account read one in a direct canary was not tried here (no real accounts). Tests (fake ChatGPT backend, sandbox HOME, nothing on the network): TestCodexOwnModelCompactionHonoursTheToggle (off: summary, no trigger upstream, no writer; on: native seal kept, writer recorded), TestNativeCompactionWriterGoneSaysWhy (spare switched off, own paused, Names & levels, signed out), ggbdpq's TestNativeCompactionWriterWhoseListLacksTheModel and ...ThroughAGroupWhoseListLacksTheModel. All four are red on |
||
|
|
440f66701f |
gateway: a 429 for native compaction's one account says the compaction pinned it, not that every account is capped (#2517)
When a conversation was compacted natively, only the key or account that sealed the compaction can read it (#1099), so checkpointReaders keeps the candidates to that one. When that account was at its usage cap, the 429 and the call record said "every account that serves X is held at the usage cap", although the other accounts were never candidates. That sent lm0711 looking at routing modes, which can't change it. checkpointHeld tells this case apart: the plan held only the sealer's account(s), and others were left out for the checkpoint. The error then names the account and its window, says the compaction it sealed is what keeps the conversation there, that routing mode and stays don't change that, and to raise the cap / spend credits or start a new conversation. The record reads "native compaction's account at its usage cap" (or its credits / both variants). cappedError and cappedRecord are unchanged for every other 429; their text is split into heldReasons and heldAdvice so both share it. docs/subsystems/gateway-routing.md says so. Test: TestNativeCompactionWriterAtItsCap seals a checkpoint on one account, caps it, and checks the 429 body and the record. Broken by hand (checkpointHeld returning nil), it fails with the old "every account" text. Run on origin/main |
||
|
|
4ad929fd4d |
gateway: a native compaction a fallback seals is recorded to it, and its next turn goes there with the compaction, not answered 200 without it (#2271, JasonBuildAI)
With native compaction on for a provider, Codex's compaction_trigger
goes to any candidate whose wire carries it, a fallback included. The
compaction watcher recorded the writer only when the candidate that
answered had native compaction on itself (`if s.compactsNatively(...)
{ sealedBy = &c }`), so a fallback's seal went unrecorded. The next turn
carrying it then either went to another provider, which refused the
foreign item, and magpie dropped it (withoutCompaction, guarded only by
`checkpoint == nil`) and answered 200 without the compacted history; or
went to the fallback translated, since keepsCompaction kept a sealed
compaction only for a provider set to compact natively, and the
translation left the item out.
Fix:
- the writer is recorded whoever answered: the watcher exists only when
the trigger was kept, so whoever answered sealed it;
- keepsCompaction also relays a sealed compaction to the provider
recorded as its writer (checkpointOf), whatever its own setting;
- checkpointError no longer says "native compaction is on for <writer>",
which isn't so for a fallback;
- docs/subsystems/gateway-routing.md says so.
Test: TestNativeCompactionFallbackSealStaysWithItsWriter (fa native,
falls back to fb, native off, which seals; a third provider). Broken by
hand, each part fails it:
- recording only native writers: the other provider answers 200 with
the seal dropped;
- keepsCompaction ignoring the record: the writer's next turn (Codex's
shape, offering web_search) goes translated without the seal;
- the old wording: the error says native compaction is on.
Run on the rebased head (origin/main plus #2274 and this):
go test ./internal/gateway/ -count=1, gofmt -l, go vet -tags nogui for
GOOS=darwin/linux/windows ./internal/gateway: see the ready note; all
green before this was handed over.
Full suite: SUITE_LINE
|
||
|
|
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 |