惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
博客园 - 【当耐特】
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
B
Blog RSS Feed
腾讯CDC
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
The Cloudflare Blog
V
V2EX
S
SegmentFault 最新的问题

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: align model auth display with workspace evidence · o...
shakkernerd · 2026-04-30 · via Recent Commits to openclaw:main

@@ -1,4 +1,8 @@

1+

import fs from "node:fs/promises";

2+

import os from "node:os";

3+

import path from "node:path";

14

import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

5+

import { withEnvAsync } from "../test-utils/env.js";

2637

let modelsListCommand: typeof import("./models/list.list-command.js").modelsListCommand;

48

let loadModelRegistry: typeof import("./models/list.registry.js").loadModelRegistry;

@@ -333,6 +337,35 @@ describe("models list/status", () => {

333337

modelRegistryState.available = available ? [ZAI_MODEL, OPENAI_MODEL] : [];

334338

}

335339340+

async function writeWorkspaceAuthEvidencePlugin(workspaceDir: string) {

341+

const pluginDir = path.join(workspaceDir, ".openclaw", "extensions", "workspace-cloud");

342+

await fs.mkdir(pluginDir, { recursive: true });

343+

await fs.writeFile(path.join(pluginDir, "index.ts"), "export default {}\n", "utf8");

344+

await fs.writeFile(

345+

path.join(pluginDir, "openclaw.plugin.json"),

346+

JSON.stringify({

347+

id: "workspace-cloud",

348+

configSchema: { type: "object" },

349+

setup: {

350+

providers: [

351+

{

352+

id: "workspace-cloud",

353+

authEvidence: [

354+

{

355+

type: "local-file-with-env",

356+

fileEnvVar: "WORKSPACE_CLOUD_CREDENTIALS",

357+

credentialMarker: "workspace-cloud-local-credentials",

358+

source: "workspace cloud credentials",

359+

},

360+

],

361+

},

362+

],

363+

},

364+

}),

365+

"utf8",

366+

);

367+

}

368+336369

beforeAll(async () => {

337370

({ modelsListCommand } = await import("./models/list.list-command.js"));

338371

({ loadModelRegistry, toModelRow } = await import("./models/list.registry.js"));

@@ -410,6 +443,67 @@ describe("models list/status", () => {

410443

expect(payload.models[0]?.available).toBe(false);

411444

});

412445446+

it("models list uses trusted workspace plugin auth evidence for configured rows", async () => {

447+

const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-models-list-auth-"));

448+

const workspaceDir = path.join(tempRoot, "workspace");

449+

const bundledDir = path.join(tempRoot, "bundled");

450+

const stateDir = path.join(tempRoot, "state");

451+

const credentialsPath = path.join(tempRoot, "credentials.json");

452+

await fs.mkdir(bundledDir, { recursive: true });

453+

await fs.mkdir(stateDir, { recursive: true });

454+

await fs.writeFile(credentialsPath, "{}", "utf8");

455+

await writeWorkspaceAuthEvidencePlugin(workspaceDir);

456+

getRuntimeConfig.mockReturnValue({

457+

agents: {

458+

defaults: {

459+

workspace: workspaceDir,

460+

model: "workspace-cloud/model-a",

461+

},

462+

},

463+

plugins: { allow: ["workspace-cloud"] },

464+

models: {

465+

providers: {

466+

"workspace-cloud": {

467+

baseUrl: "https://workspace-cloud.example/v1",

468+

api: "openai-responses",

469+

models: [

470+

{

471+

id: "model-a",

472+

name: "Workspace Cloud Model A",

473+

input: ["text"],

474+

contextWindow: 8192,

475+

maxTokens: 4096,

476+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

477+

},

478+

],

479+

},

480+

},

481+

},

482+

});

483+

const runtime = makeRuntime();

484+485+

try {

486+

await withEnvAsync(

487+

{

488+

OPENCLAW_BUNDLED_PLUGINS_DIR: bundledDir,

489+

OPENCLAW_STATE_DIR: stateDir,

490+

WORKSPACE_CLOUD_CREDENTIALS: credentialsPath,

491+

},

492+

() => modelsListCommand({ all: true, provider: "workspace-cloud", json: true }, runtime),

493+

);

494+

} finally {

495+

await fs.rm(tempRoot, { recursive: true, force: true });

496+

}

497+498+

const payload = parseJsonLog(runtime);

499+

expect(payload.models).toEqual([

500+

expect.objectContaining({

501+

key: "workspace-cloud/model-a",

502+

available: true,

503+

}),

504+

]);

505+

});

506+413507

it("models list all includes unauthenticated provider catalog rows", async () => {

414508

setDefaultZaiRegistry({ available: false });

415509

hasProviderStaticCatalogForFilter.mockResolvedValueOnce(true);