agy-cli: a saved or outdated model offer is asked again, so Ultra lists Gemini 4 (0.1.91)
shenggxhz (X, 11-17) moved from a Pro account to Ultra, and the agy
provider still listed no Gemini 4 Carbon. What agy acp offered the Pro
account was kept in models.json and loaded at start as the offer, and
probeOfferedOnce never asked agy again while an offer was known. Only a
request opening a session replaced it, so Ultra's fresh `agy models`
listing (Carbon in it) was filtered down to the Pro account's offer.
With main's index.mjs the new test lists exactly the reporter's
screenshot: claude-sonnet-4-6, gemini-3.8-flash, gpt-oss-120b.
Now an offer read from models.json, or one learnt before `agy models`
listed something else (the account or plan changed outside magpie), is
served while agy acp is asked again (offeredStale), and a session's
answer makes it current. Costs one short agy acp session per run after
a restart, and one per listing change.
Tests (test/catalog.mjs): a restart after the switch lists Carbon and
probes once; a listing change mid-run probes again, an unchanged one
doesn't; #1086's restart now also expects that one probe (its timeout
raised to 15s for the 1.5s slow session). With main's index.mjs the
three are red. Run on mica: root `HOME=$(mktemp -d) bun test` and
`bun scripts/check.mjs`, results below.
Not tried: a real Pro-to-Ultra switch (no Ultra account here).
mica, at this tree (parent 34edf938): root bun test 9041 pass, 0 fail
(9061 tests, 634 files); bun scripts/check.mjs exit 0.
This commit is contained in:
@@ -231,7 +231,8 @@ test("#1064 慢 agy:第一次 models() 给静态目录,后台热身后的第
|
||||
})
|
||||
|
||||
// #1086(yinbing-666):重启后在 agy 再次回答前,也该列出上次的完整目录,而不是只有 Gemini。
|
||||
test("#1086 重启后第一次 models() 就给上次 agy 列出并开放的目录,坏文件和别的 agy 仍给静态目录", async () => {
|
||||
// 重启后 agy 回答了也要再探测一次保存的开放型号(shenggxhz),多一次 1.5s 的慢会话,所以给 15s。
|
||||
test("#1086 重启后第一次 models() 就给上次 agy 列出并开放的目录,坏文件和别的 agy 仍给静态目录", { timeout: 15_000 }, async () => {
|
||||
const shared = fs.mkdtempSync(path.join(os.tmpdir(), "agy-catalog-saved-"))
|
||||
try {
|
||||
const agy = path.join(shared, process.platform === "win32" ? "agy.exe" : "agy")
|
||||
@@ -254,6 +255,7 @@ test("#1086 重启后第一次 models() 就给上次 agy 列出并开放的目
|
||||
assert.equal(kit.acpSpawns.length, 0, "agy models 回答前不该起探测会话")
|
||||
assert.equal(kit.modelsSpawns.length, 1, "保存的目录也要再问一次 agy")
|
||||
await warmed(kit)
|
||||
assert.equal(kit.acpSpawns.length, 1, "agy 回答后,保存的开放型号也要再探测一次")
|
||||
})
|
||||
|
||||
// 另一个 agy 可执行文件不用这份目录。
|
||||
@@ -760,3 +762,64 @@ test("#1229 每个账号列自己开放的型号,互不覆盖", async () => {
|
||||
assert.ok(kit.acpSpawns.some(spawn => /otheracct1$/.test(spawn.env?.HOME ?? "")), "另一个账号该在自己的 HOME 里探测")
|
||||
})
|
||||
})
|
||||
|
||||
// shenggxhz (X, 11-17): moved from a Pro account to Ultra, and the agy
|
||||
// provider still listed no Gemini 4. What agy acp offered the Pro account
|
||||
// was saved in models.json and believed until a request opened a session,
|
||||
// so Ultra's fresh `agy models` (Carbon in it) was filtered down to the Pro
|
||||
// account's offer. A saved offer is asked again once agy answers, and a
|
||||
// listing that changes asks again too.
|
||||
const PRO_ROWS = [
|
||||
["gemini-3.8-flash-high", "Gemini 3.8 Flash (High)"], ["gemini-3.8-flash-low", "Gemini 3.8 Flash (Low)"],
|
||||
["claude-sonnet-4-6", "Claude Sonnet 4.6"], ["gpt-oss-120b-medium", "GPT-OSS 120B (Medium)"],
|
||||
]
|
||||
const PRO_OFFERED = [["gemini-3.8-flash", "Gemini 3.8 Flash"], ["claude-sonnet-4-6", "Claude Sonnet 4.6"], ["gpt-oss-120b-medium", "GPT-OSS 120B (Medium)"]]
|
||||
const ULTRA_ROWS = [["gemini-4-carbon-high", "Gemini 4 Carbon (High)"], ["gemini-4-carbon-low", "Gemini 4 Carbon (Low)"], ...PRO_ROWS]
|
||||
const ULTRA_OFFERED = [["gemini-4-carbon-high", "Gemini 4 Carbon (High)"], ["gemini-4-carbon-low", "Gemini 4 Carbon (Low)"], ...PRO_OFFERED]
|
||||
|
||||
test("shenggxhz 换到 Ultra 账号后重启:保存的旧开放型号不挡住 Gemini 4,agy 回答后重新探测", async () => {
|
||||
const shared = fs.mkdtempSync(path.join(os.tmpdir(), "agy-catalog-ultra-"))
|
||||
try {
|
||||
const agy = path.join(shared, process.platform === "win32" ? "agy.exe" : "agy")
|
||||
fs.writeFileSync(agy, "#!/bin/sh\nexit 99\n", { mode: 0o755 })
|
||||
const env = { XDG_STATE_HOME: path.join(shared, "state") }
|
||||
await withKit({ agyPath: agy, env, modelsBehavior: { stdout: modelsOutput(PRO_ROWS) }, offeredModels: PRO_OFFERED }, async (kit) => {
|
||||
await kit.models()
|
||||
await warmed(kit)
|
||||
const pro = await kit.models()
|
||||
assert.ok(pro["claude-sonnet-4-6"])
|
||||
assert.equal(pro["gemini-4-carbon"], undefined)
|
||||
})
|
||||
await withKit({ agyPath: agy, env, modelsBehavior: { stdout: modelsOutput(ULTRA_ROWS) }, offeredModels: ULTRA_OFFERED }, async (kit) => {
|
||||
await kit.models()
|
||||
await warmed(kit)
|
||||
const ultra = await kit.models()
|
||||
assert.ok(ultra["gemini-4-carbon"], `Ultra 的 Gemini 4 Carbon 没列出:${ids(ultra).join(", ")}`)
|
||||
assert.equal(kit.acpSpawns.length, 1, "保存的开放型号要在这次运行里再问一次 agy acp")
|
||||
})
|
||||
} finally {
|
||||
fs.rmSync(shared, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
test("shenggxhz 运行中换了账号:agy models 列表变了就重新探测开放型号", async () => {
|
||||
await withKit({ modelsBehavior: { stdout: modelsOutput(PRO_ROWS) }, offeredModels: PRO_OFFERED }, async (kit) => {
|
||||
await kit.models()
|
||||
await warmed(kit)
|
||||
assert.equal((await kit.models())["gemini-4-carbon"], undefined)
|
||||
assert.equal(kit.acpSpawns.length, 1)
|
||||
kit.modelsBehavior = { stdout: modelsOutput(ULTRA_ROWS) }
|
||||
kit.offeredModels = ULTRA_OFFERED
|
||||
kit.clock.advance(CATALOG_TTL_MS)
|
||||
await kit.models()
|
||||
await warmed(kit)
|
||||
const after = await kit.models()
|
||||
assert.ok(after["gemini-4-carbon"], `换账号后 Gemini 4 Carbon 没列出:${ids(after).join(", ")}`)
|
||||
assert.equal(kit.acpSpawns.length, 2, "列表变了该再探测一次")
|
||||
// 列表没变时不再探测
|
||||
kit.clock.advance(CATALOG_TTL_MS)
|
||||
await kit.models()
|
||||
await warmed(kit)
|
||||
assert.equal(kit.acpSpawns.length, 2, "列表没变不该再起探测会话")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user