ac4af582301a4e8a29245dbba767eba31334ddf9
12
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ce8b67de37 |
gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called page.goto with no timeout of its own, so Playwright held the first load of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a busy box (a whole-suite run at load 130-160) that load took longer and goto timed out. The same pattern is in 988 GUI test files (1174 pages): every one of them now also sets setDefaultNavigationTimeout(60000) on the same page, right after its default, so goto, reload and waitForURL wait on the load itself with room, while clicks and waits keep their short bar. group-from-model-add's own 20s navigation bar is raised to the same minute. claude-switch-only also gives its first provider row (drawn from the page's first reads) a minute before clicking it. nav-timeout.test.cjs (no browser) reads every GUI test file and names each page given a default under a minute without a navigation timeout of at least a minute, so a new file can't bring the pattern back. What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from other sessions): - node --check on every file in internal/gui/tests: all parse. - nav-timeout.test.cjs against origin/main's test files: red (names the 1174 pages); against this tree: its only reds were my own probe copies of the old files, since removed. - By hand: claude-switch-only with app.js served 7s late (a busy box's first load), --test-name-pattern "1100 en": origin/main's file 4 of 4 red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green. - claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420: 32 of 32. group-from-model-add, usage-access-key-card and i18n-keys: green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red on a 5s waitForFunction at line 115 (a wait after load, not the navigation), at load ~230. Not tried: the whole GUI suite (about 1000 files; the change is one mechanical line per page), Windows or mote (mote's browsers, #4125). |
||
|
|
995f84a0f9 |
codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in settings.json (minutes, 15 to 1440). Unset, out of range or unreadable reads as 30m, never 0, and magpie never writes it unless the user does. - settings: CodexResetLead and Settings.ResetLead(); the menu's values are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h. - provider: the spend (expiringResetSpent) and routing (Allowance.Restarts, through nextResetLook) read the same resetLead(), so they still agree (#717, #718). The "near" look cadence follows it: lead + 30m, at least 1h, so a look lands inside a long lead. - GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex: how early before one expires" with an app menu (no <select>), and the sub text says spending earlier loses what the windows have left. The four "before it expires" strings say the chosen lead. POST /api/settings/codex-reset-lead; the general save keeps the field. en, zh, zh-TW, ja, de. - CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default]. - app.js budget: the auto-use rows moved out to lazy autoresetown.js (painted in the same draw once loaded), so app.js and the core script stay under their budgets with no raise. The button sizes to its widest label (a grid of every label), so picking one never rewraps the row. Run (all on mote through mote-run): - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build. - go test -tags nogui -timeout 45m ./... at 3955adccf (this change before the paint and sizer fixes, which touch only GUI assets): 81 ok. go test ./internal/gui at this head: ok. - GUI, Chromium: codex-reset-lead, codex-auto-reset, codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62. WebKit: every case of those files failed at browserType.launch (180s timeout) before a page loaded, both runs; mote's browser launches hang under #4125 (load ~26), so WebKit is not run. - Rebased onto |
||
|
|
0e2739743b |
codex: a reset set to go when the week runs out is spent before the credits
tongzhenbao on X: a Codex Pro account with "when its week runs out" on,
its week at 0% left, one reset held until 11-06 (after the week's own
reset on 11-03) and Use credits on. Overnight ~10k credits went and the
reset stayed; the card said "not auto-used" beside the switch on.
Cause: the week's auto-use ran only on a vendor refusal. autoReset in
routing needs a 429 usage_limit_reached on the last candidate, and the
relay's autoResetSignedIn the same on its 429. An account let spend its
credits is never refused for its week: ChatGPT answers on the credits,
and routing never benches it (full() and onCredits). So the week's reset
could only ever be spent with credits off.
Decision (product call delegated): a reset is free, credits cost money,
so a reset the user set to go when the week runs out goes before any
credits. resetBeforeCredits runs before a try is sent to a Codex account
on its credits whose last reading has its week used up, with the week's
switch on; AutoUseCodexReset reads the week again and keeps one a week
at most, so a second time in the same week goes on the credits. Hooked
in the routing loop and in codexUpstreamOn (the relay, signed-in or an
account). With no reset held, or the week's switch off, nothing changes.
The card's summary: with only the week's switch on it now says "auto-used
when the week runs out" (zh 周额度用完时自动使用), not "not auto-used",
with its title in all five languages. CLI help and auto-reset messages
say "or before its credits are spent". gateway-routing.md names it.
Siblings: the expiring switch already spends regardless of credits
(usedUp ignores them); the credits-off path (planned.held) is unchanged.
Run (mote, through mote-run, at this tree):
- go test ./internal/gateway -run 'TestCodexResetBeforeCredits|TestCodexAutoReset|TestCodexCredits|TestCodexNoCredits': ok
- broken by hand: gateway.go and codex_backend.go at origin/main:
TestCodexResetBeforeCredits/relayed and /routed red (200, spent ""),
the two negative cases green
- node --test codex-auto-reset, i18n-keys, codex-auto-reset-settings,
codex-resets-used, panel-options-fold, quota-curve: 96/96 (chromium +
webkit, en/zh/zh-TW/ja/de); codex-auto-reset red with origin/main's
app.js ("· not auto-used")
- full suite, before the rebase onto
|
||
|
|
35467e2a32 |
gui tests: codex-auto-reset flips the panel's switches after the tab's own read has drawn them, not on the cards that read replaces (#2360)
codex-auto-reset was red about once a run in Chromium, one 420px case in
a different language each time: "locator.scrollIntoViewIfNeeded: Element
is not attached to the DOM" in flip(), at the panel's first switch.
Opening the panel's Allowances tab calls quotasOpened(), an asked read
(usage/quotas?asked=1); when it answers, loadQuotas' finally calls
renderQuotas() -> renderPanelQuota(), which builds every card anew. The
cards drawn at boot are already there, so waitFor(psel) passed on them,
and when the asked answer came a few ms later than usual it landed
between flip's locate and its scroll. Instrumented on main (Chromium, en,
420): boot draw at 3ms, the tab's asked read at 76ms, its redraw at
105ms, the first flip after it. codex-credits met the same thing in
#1622 (
|
||
|
|
00afcf97a1 |
provider, gui, cli: a Codex account's auto-use of its resets is two switches, its week used up and one about to expire (#2078, alanwalk)
alanwalk asked for "自动使用重置卡" to be split: they want a reset that is
about to expire used rather than lost, but a used-up week waited out rather
than spending a reset on it (and the other way round for others).
What changed:
- settings: codexAutoResetOnly narrows an account in codexAutoReset to
"week" or "expiring". An account with no entry keeps both, so every
existing config means what it meant: nothing to migrate, and no user
value is rewritten. Load drops entries for accounts not in the list or
with an unknown value.
- provider: CodexAutoResetWhen(user) reads both times. AutoUseCodexReset
(the week used up, called from the gateway's autoReset and
autoResetSignedIn through AutoResetsWeek) only acts when the week is on;
SpendExpiringCodexResets and routing's resetRunsOut only count on the
expiring reset when that is on. SetCodexAutoResetCase(user, when, on)
sets one time and keeps the other; SetCodexAutoReset still sets both.
Both off removes the account.
- gateway: POST /api/settings/codex-auto-reset takes an optional "when";
POST /api/settings keeps codexAutoResetOnly, which the page doesn't send.
- GUI: the account's card (Usage page and the menu bar panel) says
"Auto-use resets:" with each time on its own line and its own switch;
the brief account's one switch still sets both, its title naming each
time; Settings › Usage gives each account an Off/On per time. The status
line says which times are on now. "· auto-used before it expires" on
the resets held follows the expiring switch alone. Strings in zh, zh-TW,
ja and de.
- CLI/TUI: `magpie quota auto-reset <account> week|expiring on|off`; the
quota and accounts tables and the TUI say "auto", "auto when the week
runs out" or "auto before one expires".
What was run (worktree on origin/main
|
||
|
|
61838f7c94 |
gui tests: codex-auto-reset clicks its account group's Show more, not the panel's Arrange, which 490d2ea3 made a .pq-more too (strict-mode violation on .pq-more since the panel's Allowances tab got Arrange at its foot)
Passes in Chromium and WebKit. |
||
|
|
5f5f745fff | usage: a Codex account in brief has its Auto-use switch beside its name, not only words (#801, ezdemo: 更新最新版后,似乎自动使用重置卡的开关的入口找不到了) — with several Codex accounts the one shown in full is the one last served, so the account whose week ran out, the one holding resets, is in brief, and in brief it only said "↺ 2 · Auto-use: off": the switch was a fold away, and nothing said so. Its brief row now reads "↺ 2 · Auto-use" (zh 自动用卡, ja 自動使用, de Automatisch) with the same small switch as the full card's (role=switch, aria-label Auto-use resets, posts settings/codex-auto-reset); the full card's row is unchanged. codex-auto-reset.test.cjs (WebKit, en and zh) turns it on from the brief row, sees it on in full, turns it off there and sees it off back in brief; it fails on the old code. Looked at in light (zh) and dark (en). go vet, builds and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
da46cd21f1 | provider: a Codex reset about to run out is spent half an hour before it does, not three hours, and at once only when the account is held up past then (#718, thedavidweng: account A, held up for its five hours until 17:09 with 32% of its week used, spent a reset expiring that afternoon at 15:20 — within resetExpiryLead (3h) and its windows used — losing the 68% of its week it could have used between 17:09 and the reset running out). Spending a reset starts the windows again and loses what they have left at that moment, while the fresh windows are the same whenever it is spent, so check now spends it as late as is safe: resetExpiryLead is 30 minutes; an account holding a reset that runs out is looked at every 30 minutes (resetExpiryWatch), never past the start of the reset's last hour, and every 5 minutes within it (resetExpiryClose, nextResetLook), a failed read (by the reset last read, kept per account) or spend there tried again in 5, not 30; the loop goes over the accounts every 5 minutes (each read only when due), and check compares wall-clock times (Round(0)), so a Mac asleep past the lead spends it on the first pass awake. It is spent at once when the account is held up now (usedUp: a window that stops it at 100%) and won't be free again (BackAt; not known counts as not) before the reset would be spent: waiting can use nothing more, and spending it frees the account — any held reset that runs out, however far off. Windows not used still spend nothing; the week-used-up AutoUseCodexReset path is as before. expiringResetSpent takes whether the account is stopped and when it is back, and routing's Allowance.Restarts passes the same from its limits (heldUp), so Weekly pace's and Smart's deadline (dueRestart) is when check spends it. The GUI's tooltips (en, zh: 到期前约半小时, 若账号正被限流、要到那之后才解封,则立即用掉), quota auto-reset's help and settings' comment say so. TestResetSpentAsLateAsSafe walks the report's afternoon in 5-minute passes (reset running out 18:15: five hours free at 17:09 or 17:40 → spent 17:45; free at 17:50, after it runs out, not saying when, or the week used up past it → spent 15:20; not held up → 17:45; nothing used → never; at most 20 reads), TestResetExpiryLastHour (look cadence, a failed read and spend retried in 5 minutes, spent after sleeping past the lead) and TestRestartsWhenHeldUp fail on the old code; the existing tables move from 3h to the new times. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (TestDevinSignedInOnlyInMagpie failed once under load, passes alone and in the package rerun); codex-auto-reset and routing-reset-deadline pass in webkit. Not tried with the reporter's accounts. The spend reads the account again under autoReset's lock (stillExpiring, spendExpiringNow) and spends nothing if the week's used-up spend has started its windows again since the look, so a held-up account isn't given two resets; TestExpiringSpendReadAgain. | ||
|
|
0df1798b7d | gui: a Codex account's Auto-use of its banked resets is a standing setting on its card, held resets or not, and says both times it uses one (#719, thedavidweng: the Usage card's Auto-use only showed with resets held, said only "when the week is used up" while the use before a reset expires (#624) was in the tooltip alone, was hidden in the multi-account brief rows, and zh called both the window's 额度重置 and the credit 重置) — every named Codex (ChatGPT) account's full card, on the Usage page and in the menu bar panel, now has a row of its own under its windows: "Auto-use resets: when the week runs out, or before one expires" (zh 「自动使用重置卡: 周额度用完时 · 重置卡到期前」) with a switch (lib-switch, role=switch, aria-checked) that posts settings/codex-auto-reset as the old toggle did, so codexAutoReset in settings keeps every existing user's on/off; it shows with 0 resets, so it can be set ahead of one. Holding resets, the row of them keeps "Use a reset" / "Use one…" and says after the nearest expiry whether that one is protected: "· auto-used before it expires" (zh 「· 到期前自动使用」, accent) or "· not auto-used" (「· 不会自动使用」), its tooltip saying how (about 3 hours before, if the account's windows have been used) or that it is lost unless used by hand. An account in brief says it beside its name: "↺ 2 · Auto-use: on" / "Auto-use: off" (zh 「自动用卡:开/关」), its full say in the title. The switch's tooltips name both triggers, one a week at most and the five hours never using one; the status after turning it on is "{who} uses a reset by itself when its week runs out, or before one expires". zh: the credit is 重置卡 throughout (1 张重置卡, 用一张重置卡, 用一张…, 用一张 Codex 重置卡?, the routing notes, outcomes and the GLM team's 5 小时/每周重置卡), the window's renewal stays 重置. A GLM team's resets, a plugin's and an account with no name get no switch, as before. magpie quota auto-reset's help and its on/status lines say the expiry use too. codex-auto-reset.test.cjs is rewritten (window and panel, en and zh: the say's visible words with both triggers, the switch for an account holding no reset, the quick switch with resets and the kept/not kept words turning, the brief rows' off/on and resets held, posts per account, no scroll, no left border, no native select, every string's zh, the credit 张/重置卡 in zh) and fails on the old code; routing-auto-reset and zcode-site expect the new zh words; quota-curve expects the Auto-use row between the curve and the next account. go vet, builds (darwin, GOOS=linux -tags nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass; codex-auto-reset, routing-auto-reset, quota-curve, usage-fold, click-scroll, account-mask, agent-models and routing-served pass in webkit; the rest of internal/gui/tests fails only where a clean checkout fails too, or passes alone; zcode-site and old-webkit fail before and after the change the same way (zcode-site times out at its sign-in step before reaching the reset words). Not tried with real Codex accounts. | ||
|
|
7f29f1ba14 | provider: a Codex reset about to run out unused is spent shortly before it does (#624, jyuuroku16: 快到重置卡到期时间前,自动使用重置卡) — Auto-use only spent a reset once the account's week was used up and no other account could answer, so a reset the account never got that far for ran out unused. For the accounts with Auto-use on, the gateway now goes over them every 10 minutes (KeepResetsFromRunningOut): within 3 hours of the soonest reset running out (the credits' expires_at, already read for the card), if any of the account's windows has been used, it spends that reset — UseCodexReset spends the one that runs out first, so a longer-lasting one is kept. Nothing used means nothing to start again, and it is left to run out. An account is read only when there may be something to do: at most every 6 hours, at 3 hours before a reset runs out, every 10 minutes inside those 3 hours, 30 minutes after a failure. It doesn't count against the week's one reset (a reset lost anyway takes none of it) and spends under the same lock. Auto-use's tooltips (en, zh) say so. TestResetSpentBeforeItRunsOut, TestResetExpiryRetriesLater, TestSpendExpiringCodexResets (a fake ChatGPT: off → never read; on → the soon one spent, not the later one; the next pass doesn't read again); dropping the windows-used or the lead check fails them. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass but for the known flakes (each passes alone). | ||
|
|
a999770531 | plugins: a plugin's subscription does what a built-in's does, in seven places it didn't (the user: 要保证插件订阅 provider 跟内置的订阅 provider所有逻辑都要一模一样) — an installed plugin's provider id is kept for it signed in or not, as a built-in's is: a provider of the user's own isn't saved on it, renamed onto it or imported as it (freeID gives id-2). A plugin's account whose plan lacks the model is tried after the ones that list it, as a Codex Free account behind a Plus, by the list the plugin told for it. Cursor's plugin has fast mode where the built-in Cursor has it: a model with a -fast one is saved :fast in a group and sent service_tier "priority", one without is refused. Removing a plugin's provider hides it as a built-in's is, its accounts kept and shown again from Hidden or by signing in, rather than signing every account out ("stays signed in" said so already). magpie accounts lists, adds, switches and forgets a plugin's accounts by its provider's id or name. Grok's plugin beside the built-in Grok (grok-plugin) searches by itself as Grok does. A plugin's plan is named as its built-in's ("Cursor Pro", "SuperGrok"), and a plugin's resets are shown but have no Use button or Auto-use, which spent Codex's reset of the same user. TestPluginIDReservedSignedOut, TestPluginAccountLackingTheModelGoesLast, TestCursorPluginGroupFast, TestAccountsOfAPlugin, TestGrokPluginSearchesItself, plugin-plan and codex-auto-reset fail without the change; TestPluginSignIn and TestPluginAccounts now expect a removed plugin hidden. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeSignedOut failed once under load, passes alone); the gateway, provider and plugin suites and TestAccountsOfAPlugin pass on Windows, the plugin tests on Linux. | ||
|
|
d1ec1cdf62 | usage: a Codex account can spend one of its rate-limit resets by itself once its week is used up (StringKe on Discord: 账号里有 Bank Reset 的重置次数,可以自动使用 — 七天全部用完的时候重置) — off by default, turned on per account with Auto-use beside Use a reset (Usage page, panel) or magpie quota auto-reset <account> on. It fires only when every other account a request could go to is resting, fresh usage shows the weekly window used up (the 5 hours' being full never counts: a reset starts both, and five hours pass on their own), the account holds one, and none was spent by itself this week (kept in codex-autoreset.json across restarts); it spends the one expiring first, lifts the rest and asks once more, and on nothing_to_reset/no_credit/error ChatGPT's own 429 goes to the agent. Both the pooled accounts and Codex's own sign-in are covered; each use shows on the Routing page and in the request log. TestCodexAutoResetOneAccount, TestCodexAutoResetAfterEveryAccount, TestCodexAutoResetNot, TestWeekUsedUp, TestAutoResetKeptPastRestart, codex-auto-reset.test.cjs and routing-auto-reset.test.cjs are new; the gateway and GUI ones fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; click-scroll, old-webkit, tray-usages pass. |