refactor(agent): runAgent uses Agent upstreams only; deprecate legacy settings.pi fields
pi.provider / baseUrl / model / thinkingLevel / apiKeySecretRef are now DEPRECATED_SETTINGS_FIELDS: kept in the schema for stored JSON, dropped from PATCH /settings and from the settings sections, never read by the server. runAgent fails with a clear message when no upstream is set. The agent demo gate checks the default upstream provider; e2e seeds a fake upstream as default. OpenAPI summaries say Agent upstream. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fb7727cf66
commit
3e37ac8ae7
15 files changed
+122
-115
No files matched your search
@@ -13,7 +13,7 @@ import { ensureSetupToken } from "../../src/modules/auth-settings/auth-service.t
|
||||
import { createSecretStore, createSettingsReader } from "../../src/modules/auth-settings/provided.ts";
|
||||
import { createPiModule } from "../../src/modules/pi/index.ts";
|
||||
import { refreshPiTokens } from "../../src/modules/pi/refresh.ts";
|
||||
import { dbCredentialStore } from "../../src/modules/pi/store.ts";
|
||||
import { dbCredentialStore, setDefaultUpstream } from "../../src/modules/pi/store.ts";
|
||||
import type { ServerContext } from "../../src/modules/types.ts";
|
||||
import {
|
||||
Browser,
|
||||
@@ -383,5 +383,13 @@ describe.skipIf(!hasPg)("Pi 上游(真实 PG)", () => {
|
||||
const d3 = await drive(env, h.ctx.capabilities, r3, new AbortController().signal);
|
||||
expect(d3).toMatchObject({ status: "failed" });
|
||||
expect(d3.message).toMatch(/已停用/);
|
||||
|
||||
// 没有默认上游:旧 settings.pi 字段不再兜底,直接失败
|
||||
await setDefaultUpstream(h.ctx, null);
|
||||
const r4 = await newRun(null);
|
||||
const d4 = await drive(env, h.ctx.capabilities, r4, new AbortController().signal);
|
||||
expect(d4).toMatchObject({ status: "failed" });
|
||||
expect(d4.message).toMatch(/未配置 Agent 上游/);
|
||||
await setDefaultUpstream(h.ctx, fake.id);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user