From 967025f7497bbe9917365c7c12923f34776ab46b Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Wed, 11 Nov 2026 13:04:50 -0600 Subject: [PATCH 1/2] fix(routes): fixture routes, thinking and limits save without a model catalogue (P0-4) A fixture-only organization reads a ready catalogue with no model proxy client: the catalogue asks the proxy only when a module calls it. A thinking-only change, and a limits patch that keeps harness, model and entry, no longer asks the catalogue. A change that truly needs it still refuses, and the WebUI names the next step: keep the model and change thinking, or press Disable model proxy catalogue. The Routing switch follows whether cliproxy is listed and removes or adds only cliproxy. --- packages/bus/src/model-catalogue.mjs | 7 +- .../tests/fixture-routes-no-proxy.test.mjs | 119 ++++++++++++++++++ packages/organization/src/launch-settings.mjs | 17 ++- .../tests/launch-settings.test.mjs | 19 +++ packages/webui/src/public/bus.js | 13 +- packages/webui/src/serve.mjs | 6 + packages/webui/tests/routes-browser.test.mjs | 34 +++++ packages/webui/tests/routes.test.mjs | 16 +++ 8 files changed, 221 insertions(+), 10 deletions(-) create mode 100644 packages/bus/tests/fixture-routes-no-proxy.test.mjs diff --git a/packages/bus/src/model-catalogue.mjs b/packages/bus/src/model-catalogue.mjs index cc6635bbe..ca36ade55 100644 --- a/packages/bus/src/model-catalogue.mjs +++ b/packages/bus/src/model-catalogue.mjs @@ -22,9 +22,12 @@ export function createModelCatalogue({ client, settings, pluginDataRoot = null, const loader = makeLoader({ log: () => {}, dataRoot:pluginDataRoot }); const result = await loader.load({ 'model-provider': names }); if (result.refused.length || loader.snapshot('model-provider').length !== names.length) throw Error(); - const c = client(); if (!c) throw Error(); + // A module that needs no model proxy (fixture) answers without one; a module + // that asks the proxy while none is configured gets a refusal and reads unavailable. + const c = client(); + const proxy = method => async (...args) => { if (!c) throw Error('model proxy not configured'); return c[method](...args); }; const answers = await Promise.all(loader.snapshot('model-provider').map(async ({ name, module }) => { - const answer = await module.catalogue({ listAccounts: () => c.getCredentials(), listModels: name => c.getCredentialModels(name), listGroups: () => c.getUpstreamGroups(), now: () => new Date(now()).toISOString() }); + const answer = await module.catalogue({ listAccounts: proxy('getCredentials'), listModels: proxy('getCredentialModels'), listGroups: proxy('getUpstreamGroups'), now: () => new Date(now()).toISOString() }); if (answer?.status === 'unavailable' && answer.reason === 'model-key-collision') throw Object.assign(Error(), { code: 'model-key-collision' }); if (answer?.status !== 'ready' || !Array.isArray(answer.models) || answer.models.length > 10000 || !Array.isArray(answer.notices) || answer.notices.length > 100) throw Error(); for (const m of answer.models) { diff --git a/packages/bus/tests/fixture-routes-no-proxy.test.mjs b/packages/bus/tests/fixture-routes-no-proxy.test.mjs new file mode 100644 index 000000000..a9caba3ec --- /dev/null +++ b/packages/bus/tests/fixture-routes-no-proxy.test.mjs @@ -0,0 +1,119 @@ +// D3 (P0-4, readiness-1111): an organization on the fixture model provider, with no model proxy +// configured, changes routes and thinking, takes limits.set and starts a hire. The real catalogue +// service runs here (no modelCatalogue stand-in), so a fixture-only organization reads ready +// without a proxy client. A thinking-only change saves while the catalogue is unavailable, a +// change that needs the proxy still refuses, and removing cliproxy (the Routing page's Disable) +// makes the next save apply. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdirSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { busOrganization } from '../src/organization-context.mjs'; +import { startBroker } from '../src/runtime.mjs'; +import { createModelCatalogue } from '../src/model-catalogue.mjs'; +import { loadBusiness } from '../../organization/src/organization-config.mjs'; +import { resolveInstance } from '../../organization/src/resolve.mjs'; +import { businessDoc, rolesCopy, systemFor, writeJson } from '../../organization/tests/helpers.mjs'; +import { FIXTURE_ENTRY, FIXTURE_KEY_NAME } from '../../plugins/model-provider/fixture/index.mjs'; +import { approveTemplateHire } from './hire-fixtures.mjs'; + +function busForm(root, rolesDir, id = 'demo') { + const b = loadBusiness(id, { dir: root, rolesDir }); + const resolved = {}; + for (const instance of Object.keys(b.roles)) resolved[instance] = resolveInstance({ system: systemFor(root), business: b, instance }); + return busOrganization(b, resolved); +} + +async function setup(t, providers = ['fixture']) { + const root = mkdtempSync(join(tmpdir(), 'd3-fixture-')); + t.after(() => rmSync(root, { recursive: true, force: true })); + const rolesDir = rolesCopy(root); + const doc = businessDoc(root, 'demo'); + doc.plugins = { harness: ['pi'], 'model-provider': providers }; + doc.launch.models[FIXTURE_KEY_NAME] = { ...FIXTURE_ENTRY }; + doc.roles.coder.vars = { harness: 'pi', model: FIXTURE_KEY_NAME, thinking: 'off', 'limits.network': 'none' }; + // The audit's instance: the assistant on the fixture route. + doc.roles.assistant = { definition: 'assistant', vars: { harness: 'pi', model: FIXTURE_KEY_NAME, thinking: 'off' } }; + const file = writeJson(join(root, 'businesses/demo.json'), doc); + mkdirSync(join(root, 'data'), { mode: 0o700 }); + // No proxy option: the runtime has no model proxy client and no proxy lock. + const bus = await startBroker({ dataRoot: join(root, 'data'), businesses: { demo: busForm(root, rolesDir) }, organization: { dir: root, rolesDir, system: systemFor(root) } }); + t.after(() => bus.close()); + const human = bus.broker.bindHuman({ business: 'demo', human: 'jason', via: 'cli', outsideAgent: true }); + const ask = (verb, args) => Promise.resolve().then(() => bus.broker.request(human, { verb, args })); + const saved = () => JSON.parse(readFileSync(file, 'utf8')); + return { root, rolesDir, file, bus, ask, saved }; +} +const route = (thinking, model = FIXTURE_KEY_NAME) => ({ harness: 'pi', model, thinking, fallback: null }); +// readiness-1111 evidence patch-low.json: `mosaic limits set --file patch-low.json`. +const patch = (revision, thinking) => ({ revision, assistants: { assistant: { definition: 'assistant', vars: { harness: 'pi', model: FIXTURE_KEY_NAME, thinking }, tracker: null } } }); + +test('D3 a fixture-only organization with no model proxy reads a ready catalogue and saves a thinking change and a fixture route', async t => { + const f = await setup(t); + const view = await f.ask('routes'); + assert.equal(view.catalogue.status, 'ready'); + assert.deepEqual(view.catalogue.models.map(m => m.key), [FIXTURE_KEY_NAME]); + const thinking = await f.ask('routes.set', { revision: view.revision, routes: { coder: route('low') } }); + assert.ok(thinking.transaction); + assert.equal(f.saved().roles.coder.vars.thinking, 'low'); + // A fixture route change: the reviewer moves onto the fixture model. + const moved = await f.ask('routes.set', { revision: thinking.revision, routes: { reviewer: route('off') } }); + assert.ok(moved.transaction); + assert.equal(f.saved().roles.reviewer.vars.model, FIXTURE_KEY_NAME); +}); + +test('D3 limits.set takes the audit thinking patch on a fixture-only organization with no model proxy', async t => { + const f = await setup(t); + const { revision } = await f.ask('limits'); + const result = await f.ask('limits.set', patch(revision, 'low')); + assert.ok(result.transaction); + assert.equal(f.saved().roles.assistant.vars.thinking, 'low'); +}); + +test('D3 hire start on a fixture-only organization with no model proxy writes the hire', async t => { + const f = await setup(t); + const hired = await approveTemplateHire(f.bus.broker, f.rolesDir, { name: 'sec-1', definition: 'chief-information-security-officer', model: FIXTURE_KEY_NAME }); + assert.ok(hired.transaction); + assert.equal(f.saved().roles['sec-1'].vars.model, FIXTURE_KEY_NAME); +}); + +test('D3 with cliproxy enabled and no model proxy, a thinking change saves, a proxy model refuses, and removing cliproxy lets a route change save', async t => { + const f = await setup(t, ['fixture', 'cliproxy']); + let view = await f.ask('routes'); + assert.equal(view.catalogue.status, 'unavailable'); + // Thinking only: same harness, model key and entry, so no catalogue is asked. + const thinking = await f.ask('routes.set', { revision: view.revision, routes: { coder: route('low') } }); + assert.equal(f.saved().roles.coder.vars.thinking, 'low'); + const limits = await f.ask('limits'); + await f.ask('limits.set', patch(limits.revision, 'medium')); + assert.equal(f.saved().roles.assistant.vars.thinking, 'medium'); + // A route change truly needs the catalogue, which the absent proxy makes unavailable. + const before = readFileSync(f.file, 'utf8'); + view = await f.ask('routes'); + await assert.rejects(f.ask('routes.set', { revision: view.revision, routes: { reviewer: route('off') } }), { code: 'model-catalogue-unavailable' }); + await assert.rejects(f.ask('routes.set', { revision: view.revision, routes: { reviewer: route('off', 'zai-not-offered') } }), { code: 'model-catalogue-unavailable' }); + assert.equal(readFileSync(f.file, 'utf8'), before); + assert.ok(thinking.transaction); + // Disable model proxy catalogue: plugins.set without cliproxy. + const settings = await f.ask('plugins'); + await f.ask('plugins.set', { revision: settings.revision, plugins: { 'model-provider': ['fixture'] } }); + view = await f.ask('routes'); + assert.equal(view.catalogue.status, 'ready'); + await f.ask('routes.set', { revision: view.revision, routes: { reviewer: route('off') } }); + assert.equal(f.saved().roles.reviewer.vars.model, FIXTURE_KEY_NAME); +}); + +test('D3 the catalogue asks a module that needs no proxy even with no proxy client, and a module that asks the proxy reads unavailable', async () => { + let names = ['fixture']; + const service = createModelCatalogue({ client: () => null, settings: () => ({ 'model-provider': names }) }); + const ready = await service.read('demo', { fresh: true }); + assert.equal(ready.status, 'ready'); + assert.deepEqual(ready.models.map(m => [m.key, m.available]), [[FIXTURE_KEY_NAME, true]]); + names = ['cliproxy']; + assert.equal((await service.read('demo', { fresh: true })).status, 'unavailable'); + names = ['fixture', 'cliproxy']; + const both = await service.read('demo', { fresh: true }); + assert.equal(both.status, 'unavailable'); + assert.ok(both.models.every(m => m.available === false)); +}); diff --git a/packages/organization/src/launch-settings.mjs b/packages/organization/src/launch-settings.mjs index bba60a9c0..e137417e4 100644 --- a/packages/organization/src/launch-settings.mjs +++ b/packages/organization/src/launch-settings.mjs @@ -132,15 +132,18 @@ export function checkRoutes({ proposed, old = null, levels, catalogue = null }) } const currentEntry = proposed.launch?.models?.[vars[model]]; const previousEntry = old?.launch?.models?.[before[model]]; - const changed = [harness, model, thinking].some(field => vars[field] !== before[field]) || canonicalJson(currentEntry ?? null) !== canonicalJson(previousEntry ?? null); - if (changed && previousEntry?.module && !currentEntry?.module && vars[model] === before[model]) throw new OrganizationError('model-provider-unavailable'); - if (changed && currentEntry?.module) { + // D3 (P0-4): the catalogue answers which harness a model runs on, not its thinking level, so + // a change that keeps the harness, the model key and its entry needs no catalogue; the + // harness checks below still run on the new thinking level. + const routeChanged = [harness, model].some(field => vars[field] !== before[field]) || canonicalJson(currentEntry ?? null) !== canonicalJson(previousEntry ?? null); + if (routeChanged && previousEntry?.module && !currentEntry?.module && vars[model] === before[model]) throw new OrganizationError('model-provider-unavailable'); + if (routeChanged && currentEntry?.module) { if (catalogue?.status !== 'ready') throw new OrganizationError('model-provider-unavailable'); const offered = catalogue.models?.find(m => m.key === vars[model]); if (!offered || !offered.available || !proposed.plugins?.['model-provider']?.includes(currentEntry.module) || canonicalJson(currentEntry) !== canonicalJson({ provider: offered.provider, model: offered.model, module: offered.module, upstream: offered.upstream })) throw new OrganizationError('model-provider-unavailable'); if (!offered.harnesses.includes(vars[harness])) throw new OrganizationError('model-harness-incompatible'); } - if (changed && currentEntry && !currentEntry.module && proposed.plugins?.['model-provider']?.length) { + if (routeChanged && currentEntry && !currentEntry.module && proposed.plugins?.['model-provider']?.length) { if (catalogue?.status !== 'ready') throw new OrganizationError('model-provider-unavailable'); const mapping = catalogue.resolveLegacy ? catalogue.resolveLegacy(currentEntry) : catalogue.legacy?.[vars[model]]; const offered = mapping && catalogue.models?.find(m => m.module === mapping.module && m.upstream === mapping.upstream && m.model === currentEntry.model); @@ -369,6 +372,10 @@ export function launchSettings({ dir, rolesDir, system, sessions = () => [], now for (const [choice, prefix] of [[route, ''], [fallback, 'fallback.']]) { if (!choice) continue; const unchanged = ROUTE_FIELDS.every(field => priorVars[prefix + field] === choice[field]); + // D3 (P0-4): a choice that keeps the harness and model key needs no catalogue, as in + // checkRoutes; only its thinking level may differ. A key the catalogue offers as a + // different model still refuses model-key-collision below on any change. + const sameRoute = ['harness', 'model'].every(field => priorVars[prefix + field] === choice[field]); const offered = catalogue?.models?.find(m => m.key === choice.model); const existing = next.launch.models[choice.model]; const entry = offered ? { provider: offered.provider, model: offered.model, module: offered.module, upstream: offered.upstream } : null; @@ -377,7 +384,7 @@ export function launchSettings({ dir, rolesDir, system, sessions = () => [], now if (!existing && !offered) throw new OrganizationError('unknown-model', `${instance} variable ${prefix}model isn't a launch.models key`); if (existing && offered && canonicalJson(existing) !== canonicalJson(entry) && !unchanged) throw new OrganizationError('model-key-collision'); if (!existing || existing.module) { - if (unchanged) continue; + if (sameRoute) continue; if (catalogue?.status !== 'ready') throw new OrganizationError('model-catalogue-unavailable'); if (!offered || !offered.available || !Array.isArray(next.plugins?.['model-provider']) || !next.plugins['model-provider'].includes(offered.module)) throw new OrganizationError('model-provider-unavailable'); if (!offered.harnesses.includes(choice.harness)) throw new OrganizationError('model-harness-incompatible'); diff --git a/packages/organization/tests/launch-settings.test.mjs b/packages/organization/tests/launch-settings.test.mjs index fac64c659..cd7b4bc05 100644 --- a/packages/organization/tests/launch-settings.test.mjs +++ b/packages/organization/tests/launch-settings.test.mjs @@ -267,3 +267,22 @@ test('a role can add a legacy model when the model-provider module is off', asyn const saved=settings.set('acme',{revision:view.revision,models,instances:{coder:'legacy-new'}},'chief-of-staff.chief'); assert.equal(saved.instances.coder.modelKey,'legacy-new'); }); + +test('D3 P0-4: a thinking-only change on a provider model saves with no catalogue, and a model or harness change still refuses', async () => { + const f=fixture();const {settings}=await routeSettings(f);const doc=JSON.parse(readFileSync(f.file,'utf8')); + doc.plugins['model-provider']=['fixture','cliproxy'];doc.launch.models['fixture-deterministic']={provider:'proxy',model:'fixture-deterministic',module:'fixture',upstream:'fixture'}; + doc.roles.coder.vars={...doc.roles.coder.vars,harness:'pi',model:'fixture-deterministic',thinking:'off'};writeJson(f.file,doc); + const pick=(thinking,extra={})=>({coder:{harness:'pi',model:'fixture-deterministic',thinking,fallback:null,...extra}}); + for(const catalogue of [null,{status:'unavailable',models:[],notices:[]}]){ + const view=settings.routes('acme'),next=view.instances.coder.thinking==='low'?'high':'low'; + settings.setRoutes('acme',{revision:view.revision,routes:pick(next)},'jason',catalogue); + assert.equal(JSON.parse(readFileSync(f.file,'utf8')).roles.coder.vars.thinking,next); + } + // A level the harness doesn't apply still refuses on a thinking-only change. + assert.throws(()=>settings.setRoutes('acme',{revision:settings.routes('acme').revision,routes:pick('medium')},'jason',null),code('thinking-unsupported')); + // A harness or model change truly needs the catalogue. + const rev=settings.routes('acme').revision,before=readFileSync(f.file,'utf8'); + assert.throws(()=>settings.setRoutes('acme',{revision:rev,routes:pick('low',{harness:'claude-code'})},'jason',{status:'unavailable',models:[],notices:[]}),code('model-catalogue-unavailable')); + assert.throws(()=>settings.set('acme',{revision:rev,instances:{reviewer:'fixture-deterministic'}},'jason',{status:'unavailable',models:[],notices:[]}),code('model-provider-unavailable')); + assert.equal(readFileSync(f.file,'utf8'),before); +}); diff --git a/packages/webui/src/public/bus.js b/packages/webui/src/public/bus.js index e2f0f6f0a..4a461985d 100644 --- a/packages/webui/src/public/bus.js +++ b/packages/webui/src/public/bus.js @@ -1190,8 +1190,13 @@ return select(name,key,[...new Set([...legacy,...offered.map(m=>m.key)])],c[key],(v.providerModels?.[c[key]]||enabled&&v.models.includes(c[key]))?'unavailable':'not in the model table',labels);}; const thinking=(key,h)=>select(name,key,levelsOf(c[h]),c[key],c[h]?`not applied by ${c[h]}`:'no harness'); return `${txt(name)}${instanceInfo?.instances?.[name]?.definition?`${txt(instanceInfo.instances[name].definition)}`:''}${harness('harness')}${model('model')}${thinking('thinking','harness')}${harness('fallback.harness')}${model('fallback.model')}${thinking('fallback.thinking','fallback.harness')}`;}).join(''); - const catalogueInfo=v.catalogue?.status==='ready'?`

Model proxy catalogue, observed ${txt(window.MosaicLocalTime(v.catalogue.observedAt))}.

${(v.catalogue.notices??[]).map(n=>`

${txt(n)}

`).join('')}`:v.catalogue?.status==='unavailable'?'

Model catalogue unavailable.

':'

Model catalogue not enabled.

'; - const providerControl=canSend&&!isTester?`

`:''; + // D3 (P0-4): the switch adds or removes the cliproxy module only, so its label follows that + // module in the organization's model-provider list, not the whole catalogue's status (a + // fixture-only catalogue is ready with no model proxy). Before the setting is read it falls + // back to the catalogue status, as before. + const proxyOn=harnessSettings?(Array.isArray(harnessSettings.plugins?.['model-provider'])?harnessSettings.plugins['model-provider']:[]).includes('cliproxy'):v.catalogue?.status!=='disabled'; + const catalogueInfo=v.catalogue?.status==='ready'?`

Model catalogue, observed ${txt(window.MosaicLocalTime(v.catalogue.observedAt))}.

${(v.catalogue.notices??[]).map(n=>`

${txt(n)}

`).join('')}`:v.catalogue?.status==='unavailable'?`

Model catalogue unavailable. A change to thinking alone still saves.${proxyOn&&canSend&&!isTester?' A new model needs the catalogue: set up the model proxy, or, when this organization has none, press Disable model proxy catalogue.':''}

`:'

Model catalogue not enabled.

'; + const providerControl=canSend&&!isTester?`

`:''; const harnessControl=canSend&&!isTester?`
Harnesses${harnessSettings ? [...new Set([...harnessSettings.available.harness,...(harnessSettings.plugins.harness??[])])].map(name=>``).join('')+` ` : '

Harnesses unavailable.

'}

${txt(harnessReceipt)}

`:''; const off=v.harnesses.length?'':'

No harness is switched on in the business file\'s plugins.harness, so every launch refuses harness-off and a save that changes a harness refuses too. Switch one on under Harnesses.

'; return `
${title}${catalogueInfo}${providerControl}${harnessControl}${off}
${ROUTE_CELLS.map(([,l])=>``).join('')}${rows}
AgentPrimaryFallback
${l.replace('Fallback ','')}

${canSend || isTester?'Changes are checked and logged with your identity.':'Saving requires signed-in send mode.'}

${txt(routesReceipt)}

${routesApplyMarkup()}
`; @@ -1230,7 +1235,9 @@ const button=e.target,status=$('provider-switch-status');if(routesDraft){status.textContent='Save or discard the route draft first.';return;}button.disabled=true; try {const read=await fetch('/api/proxy/plugins',{cache:'no-store'});const settings=await read.json();if(!read.ok||!/^[a-f0-9]{64}$/.test(settings.revision??''))throw Error('Could not read provider settings.'); const names=Array.isArray(settings.plugins?.['model-provider'])?settings.plugins['model-provider']:[]; - const next=button.dataset.enabled==='true'?names.filter(n=>n!=='cliproxy'):[...new Set([...names,'cliproxy'])]; + // The fresh read decides: a stale label never turns the proxy module on when it meant off. + const on=names.includes('cliproxy');if(String(on)!==button.dataset.enabled){button.dataset.enabled=String(on);button.textContent=`${on?'Disable':'Enable'} model proxy catalogue`;button.disabled=false;status.textContent='The provider setting changed. Check the switch and press it again.';return;} + const next=on?names.filter(n=>n!=='cliproxy'):[...names,'cliproxy']; const response=await fetch('/api/proxy/plugins/set',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({revision:settings.revision,plugins:{'model-provider':next}}),cache:'no-store',redirect:'manual'}); if(!response.ok)throw Error('Provider setting was refused.');harnessSettings=null;routesView=null;last.delete('routes');render(true); }catch(error){status.textContent=error.message;button.disabled=false;} diff --git a/packages/webui/src/serve.mjs b/packages/webui/src/serve.mjs index c3775e1f5..8ae511280 100644 --- a/packages/webui/src/serve.mjs +++ b/packages/webui/src/serve.mjs @@ -583,6 +583,12 @@ const ROUTE_REASONS = { 'organization-unknown-instance': ['400', 'the business has no such instance'], 'organization-no-change': ['400', 'the business file already says that'], 'revision-conflict': ['409', 'the business file changed since you read it. Read the routes again'], + // D3 (P0-4): the model refusals name the step on this page that makes the save apply. Status + // stays the bus status these codes already had (502). + 'model-catalogue-unavailable': ['502', 'the model catalogue is unavailable, so a model it supplies can\'t be checked. Keep each instance\'s model and change only thinking, or press Disable model proxy catalogue on this page when this organization has no model proxy, then save again'], + 'model-provider-unavailable': ['502', 'the model provider doesn\'t offer that model now. Keep each instance\'s model and change only thinking, pick a model the catalogue lists, or press Disable model proxy catalogue on this page when this organization has no model proxy, then save again'], + 'model-harness-incompatible': ['502', 'that model doesn\'t run on that harness. Pick a harness the model lists, or another model'], + 'model-key-collision': ['502', 'that model key already names a different model in the model table. Pick the table\'s entry or another key'], }; const routeObject = o => o && typeof o === 'object' && !Array.isArray(o); const routesAnswer = v => /^[a-f0-9]{64}$/.test(v?.revision ?? '') && Array.isArray(v.harnesses) && Array.isArray(v.models) && routeObject(v.levels) && routeObject(v.instances); diff --git a/packages/webui/tests/routes-browser.test.mjs b/packages/webui/tests/routes-browser.test.mjs index b9f16d02a..0710b0f4e 100644 --- a/packages/webui/tests/routes-browser.test.mjs +++ b/packages/webui/tests/routes-browser.test.mjs @@ -264,3 +264,37 @@ test('quick fallback edits survive the harness redraw', {timeout:60000}, async t await b.evaluate('new Promise(r=>setTimeout(r,500))'); assert.deepEqual(await b.evaluate(`[${cell('fallback.harness')}.value,${cell('fallback.model')}.value,${cell('fallback.thinking')}.value]`),['claude-code','second','high']); }); + +// D3 (P0-4): an organization on the fixture provider with cliproxy listed and no model proxy reads +// an unavailable catalogue. The page says a thinking change still saves, the switch reads Disable +// from the cliproxy module itself, and pressing it removes cliproxy only. A fixture-only +// organization's catalogue is ready with no proxy, and its switch reads Enable. +test('D3 Routing: with cliproxy listed and no model proxy the switch reads Disable and removes cliproxy only; a fixture-only org reads Enable', {timeout:90000}, async t => { + for (const [providers, label, line, next] of [ + [['fixture','cliproxy'], 'Disable', /Model catalogue unavailable\. A change to thinking alone still saves\. A new model needs the catalogue: set up the model proxy, or, when this organization has none, press Disable model proxy catalogue\./, ['fixture']], + [['fixture'], 'Enable', /^Model catalogue, observed /, ['fixture','cliproxy']], + ]) { + const root=tmp(t,'d3-switch-'), f=fixture(root,'acme',doc=>{doc.plugins['model-provider']=providers;return doc;}); + const dir=join(root,'config'),file=join(dir,'businesses','acme.json'); + // No modelCatalogue stand-in and no proxy: the broker's own catalogue service answers. + const host=await startBroker({dataRoot:f.dataRoot,businesses:{acme:{id:'acme',human:'jason',arbiters:{technical:'chief',delivery:'chief'},roles:{chief: { definition: 'chief-of-staff', authority: { withinRole: ['decision.resolve.technical', 'decision.resolve.delivery'], crossRole: [] } }, coder:{authority:{withinRole:[],crossRole:[]}}}}},organization:{dir,rolesDir:f.roles,system:systemFor(root)}});t.after(()=>host.close()); + const human=host.broker.bindHuman({business:'acme',human:'jason',via:'cli',outsideAgent:true}); + const call=async(verb,args)=>structuredClone(await host.broker.request(human,{verb,args})); + const bus={messages:async()=>({messages:[],unread:0}),usage:async()=>{throw Error('no usage');},routes:()=>call('routes')}; + const web=await startServer({port:0,board:'http://127.0.0.1:9',bus,reads:{settings:()=>({business:'acme',release:'fixture',notifier:{}})},log:()=>{}});t.after(()=>close(web)); + const b=await browser();t.after(()=>b.close()); + const settings=await call('plugins'); + await b.call('Page.addScriptToEvaluateOnNewDocument',{source:`const original=window.fetch;window.posts=[];window.fetch=async(url,options={})=>{if(url==='/api/config')return new Response(JSON.stringify({send:true}));if(url==='/api/proxy/plugins')return new Response(JSON.stringify(${JSON.stringify(settings)}));if(url==='/api/proxy/plugins/set'){posts.push(JSON.parse(options.body));return new Promise(r=>window.answer=(status,body)=>r(new Response(JSON.stringify(body),{status})));}return original(url,options);};`}); + await b.navigate(`http://127.0.0.1:${web.address().port}/#/settings/routing`); + const wait=expr=>b.evaluate(`(async()=>{for(let n=0;n<200;n++){if(${expr})return true;await new Promise(r=>setTimeout(r,30));}throw Error('wait failed');})()`); + await wait(`document.querySelector("#provider-switch")?.textContent.startsWith(${JSON.stringify(label)})&&!!document.querySelector('[data-harness]')`); + const info=await b.evaluate('document.querySelector(".routing-panel > p.small")?.textContent'); + assert.match(info,line,providers.join(',')); + await b.evaluate('document.querySelector("#provider-switch").click();true'); + await wait('posts.length===1');const payload=await b.evaluate('posts[0]'); + assert.deepEqual(payload.plugins,{'model-provider':next},providers.join(',')); + const result=await call('plugins.set',payload);await b.evaluate(`window.answer(200,${JSON.stringify(result)});true`); + assert.deepEqual(JSON.parse(readFileSync(file,'utf8')).plugins['model-provider'],next); + await b.close(); + } +}); diff --git a/packages/webui/tests/routes.test.mjs b/packages/webui/tests/routes.test.mjs index eacef8d40..d03b7e162 100644 --- a/packages/webui/tests/routes.test.mjs +++ b/packages/webui/tests/routes.test.mjs @@ -173,3 +173,19 @@ test('row 65 Console: the routes read takes no arguments, needs a bus and refuse const refused = await setup(t, { bus: { routes: async () => { throw new BusReadError('human-required'); } } }); assert.equal((await get(refused, '/api/bus/routes')).status, 403); }); + +test('D3 P0-4: a model refusal keeps its status and names the step on the Routing page that makes the save apply', async t => { + for (const [code, step] of [ + ['model-catalogue-unavailable', /change only thinking, or press Disable model proxy catalogue on this page/], + ['model-provider-unavailable', /change only thinking, pick a model the catalogue lists, or press Disable model proxy catalogue on this page/], + ['model-harness-incompatible', /Pick a harness the model lists, or another model/], + ['model-key-collision', /Pick the table's entry or another key/], + ]) { + const s = await setup(t, { write: async () => { throw new BusReadError(code); } }); + const r = await send(s, '/api/routes', { revision: REV, routes: { coder: ROUTE } }); + assert.deepEqual([r.status, r.body.error, r.body.sent], [502, code, false], code); + assert.match(r.body.message, new RegExp(`^${code}: .*Nothing changed\\.$`), code); + assert.match(r.body.message, step, code); + assert.doesNotMatch(r.body.message, /refused by the bus/, code); + } +}); -- 2.54.0 From b1fc96f4aec70c86c58404e028753b0f88398d33 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Wed, 11 Nov 2026 13:34:02 -0600 Subject: [PATCH 2/2] fix(routes): name Disable only when it makes the save apply (P0-4 review) The catalogue refusals no longer tell every user to press Disable model proxy catalogue. The server text names the proxy setup step. The Routing page adds the Disable step only when cliproxy is listed and every moved model comes from another listed provider, and sends a tester to the owner. The switch mismatch message no longer claims a setting changed. Tests: a fallback thinking-only change saves with no catalogue; a move between model-proxy models refuses before and after cliproxy is removed. --- .../tests/fixture-routes-no-proxy.test.mjs | 26 ++++++++++++- .../tests/launch-settings.test.mjs | 13 +++++++ packages/webui/src/public/bus.js | 17 +++++++- packages/webui/src/serve.mjs | 9 +++-- packages/webui/tests/routes-browser.test.mjs | 39 +++++++++++++++++++ packages/webui/tests/routes.test.mjs | 10 +++-- 6 files changed, 103 insertions(+), 11 deletions(-) diff --git a/packages/bus/tests/fixture-routes-no-proxy.test.mjs b/packages/bus/tests/fixture-routes-no-proxy.test.mjs index a9caba3ec..546c507e5 100644 --- a/packages/bus/tests/fixture-routes-no-proxy.test.mjs +++ b/packages/bus/tests/fixture-routes-no-proxy.test.mjs @@ -25,7 +25,7 @@ function busForm(root, rolesDir, id = 'demo') { return busOrganization(b, resolved); } -async function setup(t, providers = ['fixture']) { +async function setup(t, providers = ['fixture'], edit = () => {}) { const root = mkdtempSync(join(tmpdir(), 'd3-fixture-')); t.after(() => rmSync(root, { recursive: true, force: true })); const rolesDir = rolesCopy(root); @@ -35,6 +35,7 @@ async function setup(t, providers = ['fixture']) { doc.roles.coder.vars = { harness: 'pi', model: FIXTURE_KEY_NAME, thinking: 'off', 'limits.network': 'none' }; // The audit's instance: the assistant on the fixture route. doc.roles.assistant = { definition: 'assistant', vars: { harness: 'pi', model: FIXTURE_KEY_NAME, thinking: 'off' } }; + edit(doc); const file = writeJson(join(root, 'businesses/demo.json'), doc); mkdirSync(join(root, 'data'), { mode: 0o700 }); // No proxy option: the runtime has no model proxy client and no proxy lock. @@ -117,3 +118,26 @@ test('D3 the catalogue asks a module that needs no proxy even with no proxy clie assert.equal(both.status, 'unavailable'); assert.ok(both.models.every(m => m.available === false)); }); + +// D3 review (finding 1): Disable can't make a move between two model-proxy models apply, which is +// why the Routing page names Disable only for a move onto a model from another listed module. +test('D3 a move between model-proxy models refuses before and after cliproxy is removed, and writes nothing', async t => { + const proxyEntry = model => ({ provider: 'proxy', model, module: 'cliproxy', upstream: 'claude' }); + const f = await setup(t, ['fixture', 'cliproxy'], doc => { + doc.launch.models['claude-a'] = proxyEntry('claude-a'); + doc.launch.models['claude-b'] = proxyEntry('claude-b'); + doc.roles.reviewer.vars = { ...doc.roles.reviewer.vars, harness: 'pi', model: 'claude-a', thinking: 'off' }; + }); + const before = readFileSync(f.file, 'utf8'); + let view = await f.ask('routes'); + await assert.rejects(f.ask('routes.set', { revision: view.revision, routes: { reviewer: route('off', 'claude-b') } }), { code: 'model-catalogue-unavailable' }); + assert.equal(readFileSync(f.file, 'utf8'), before); + const settings = await f.ask('plugins'); + await f.ask('plugins.set', { revision: settings.revision, plugins: { 'model-provider': ['fixture'] } }); + const disabled = readFileSync(f.file, 'utf8'); + view = await f.ask('routes'); + assert.equal(view.catalogue.status, 'ready'); + await assert.rejects(f.ask('routes.set', { revision: view.revision, routes: { reviewer: route('off', 'claude-b') } }), { code: 'model-provider-unavailable' }); + assert.equal(readFileSync(f.file, 'utf8'), disabled); + assert.notEqual(disabled, before); +}); diff --git a/packages/organization/tests/launch-settings.test.mjs b/packages/organization/tests/launch-settings.test.mjs index cd7b4bc05..a152567c9 100644 --- a/packages/organization/tests/launch-settings.test.mjs +++ b/packages/organization/tests/launch-settings.test.mjs @@ -286,3 +286,16 @@ test('D3 P0-4: a thinking-only change on a provider model saves with no catalogu assert.throws(()=>settings.set('acme',{revision:rev,instances:{reviewer:'fixture-deterministic'}},'jason',{status:'unavailable',models:[],notices:[]}),code('model-provider-unavailable')); assert.equal(readFileSync(f.file,'utf8'),before); }); + +test('D3 review: a fallback thinking-only change on a provider model saves with no catalogue, and a fallback harness change still refuses', async () => { + const f=fixture();const {settings}=await routeSettings(f);const doc=JSON.parse(readFileSync(f.file,'utf8')); + doc.plugins['model-provider']=['fixture','cliproxy'];doc.launch.models['fixture-deterministic']={provider:'proxy',model:'fixture-deterministic',module:'fixture',upstream:'fixture'}; + doc.roles.coder.vars={...doc.roles.coder.vars,harness:'pi',model:'fixture-deterministic',thinking:'off','fallback.harness':'pi','fallback.model':'fixture-deterministic','fallback.thinking':'off'};writeJson(f.file,doc); + const unavailable={status:'unavailable',models:[],notices:[]}; + const pick=fallback=>({coder:{harness:'pi',model:'fixture-deterministic',thinking:'off',fallback:{harness:'pi',model:'fixture-deterministic',...fallback}}}); + settings.setRoutes('acme',{revision:settings.routes('acme').revision,routes:pick({thinking:'low'})},'jason',unavailable); + assert.equal(JSON.parse(readFileSync(f.file,'utf8')).roles.coder.vars['fallback.thinking'],'low'); + const before=readFileSync(f.file,'utf8'); + assert.throws(()=>settings.setRoutes('acme',{revision:settings.routes('acme').revision,routes:pick({harness:'claude-code',thinking:'low'})},'jason',unavailable),code('model-catalogue-unavailable')); + assert.equal(readFileSync(f.file,'utf8'),before); +}); diff --git a/packages/webui/src/public/bus.js b/packages/webui/src/public/bus.js index 4a461985d..a33d29deb 100644 --- a/packages/webui/src/public/bus.js +++ b/packages/webui/src/public/bus.js @@ -1213,6 +1213,19 @@ return {revision:routesView.revision,routes}; } const unknownRoutes='Outcome unknown. Read the routes again before trying. Draft kept.'; + // D3 (P0-4): after a catalogue refusal, Disable is named only when it can make this save apply: + // cliproxy is listed and every model the change moves to comes from another listed module. + // A viewer without the switch is sent to the owner. + function catalogueStep(code,routes){ + if(!['model-catalogue-unavailable','model-provider-unavailable'].includes(code))return ''; + if(!canSend||isTester)return ' Ask the organization\'s owner to set up the model proxy, or to disable the model proxy catalogue when the change needs no proxy.'; + const names=Array.isArray(harnessSettings?.plugins?.['model-provider'])?harnessSettings.plugins['model-provider']:[]; + if(!names.includes('cliproxy'))return ''; + const moved=Object.entries(routes).flatMap(([name,r])=>{const was=routesView?.instances?.[name]??{}; + return [[r.harness,r.model,was.harness,was.model],[r.fallback?.harness,r.fallback?.model,was.fallback?.harness,was.fallback?.model]].filter(([h,m,wh,wm])=>m&&(h!==wh||m!==wm)).map(([,m])=>m);}); + const module=key=>routesView?.providerModels?.[key]?.module; + return moved.length&&moved.every(key=>module(key)&&module(key)!=='cliproxy'&&names.includes(module(key)))?' This change needs no model proxy: press Disable model proxy catalogue, then save again.':''; + } const routesAnswer=r=>/^[a-f0-9]{64}$/.test(r?.revision??'')&&Array.isArray(r.harnesses)&&Array.isArray(r.models)&&[r.levels,r.instances].every(o=>o&&typeof o==='object'&&!Array.isArray(o)); for(const kind of ['input','change'])document.addEventListener(kind,e=>{const form=e.target?.closest?.('#routes-form');if(!form||!routesView)return;routesDraft=routesFields(form);routesEditVersion++;markSettingsDraft('routing',true);form.querySelector('.settings-actions')?.classList.add('has-draft');const discard=$('routes-reload');if(discard){discard.hidden=false;discard.disabled=false;} // A harness change redraws the row so its thinking cell offers that harness's levels. @@ -1236,7 +1249,7 @@ try {const read=await fetch('/api/proxy/plugins',{cache:'no-store'});const settings=await read.json();if(!read.ok||!/^[a-f0-9]{64}$/.test(settings.revision??''))throw Error('Could not read provider settings.'); const names=Array.isArray(settings.plugins?.['model-provider'])?settings.plugins['model-provider']:[]; // The fresh read decides: a stale label never turns the proxy module on when it meant off. - const on=names.includes('cliproxy');if(String(on)!==button.dataset.enabled){button.dataset.enabled=String(on);button.textContent=`${on?'Disable':'Enable'} model proxy catalogue`;button.disabled=false;status.textContent='The provider setting changed. Check the switch and press it again.';return;} + const on=names.includes('cliproxy');if(String(on)!==button.dataset.enabled){button.dataset.enabled=String(on);button.textContent=`${on?'Disable':'Enable'} model proxy catalogue`;button.disabled=false;status.textContent='The switch now shows the current setting. Press it again to change it.';return;} const next=on?names.filter(n=>n!=='cliproxy'):[...names,'cliproxy']; const response=await fetch('/api/proxy/plugins/set',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({revision:settings.revision,plugins:{'model-provider':next}}),cache:'no-store',redirect:'manual'}); if(!response.ok)throw Error('Provider setting was refused.');harnessSettings=null;routesView=null;last.delete('routes');render(true); @@ -1250,7 +1263,7 @@ routesBusy=true;routesReceipt='';routesApply=null;render(false); try{const response=await fetch('/api/routes',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(payload),cache:'no-store',redirect:'manual'});if(response.type==='opaqueredirect'){routesReceipt='Sign in again. Draft kept.';signOut();}else{const result=await response.json(); if(response.ok&&routesAnswer(result)){routesDraft=null;routesView=result;harnessSettings=null;const prior=last.get('routes');if(prior)last.set('routes',{...prior,rows:[result]});routesReceipt=`Routes saved for ${Object.keys(payload.routes).join(', ')}. The next launch of each uses the new route.`;routesApply=await routesApplyRead(Object.keys(payload.routes));} - else routesReceipt=response.ok||result?.sent==='unknown'?unknownRoutes:`${result?.message||'Refused.'} Draft kept.`;}} + else routesReceipt=response.ok||result?.sent==='unknown'?unknownRoutes:`${result?.message||'Refused.'}${catalogueStep(result?.error,payload.routes)} Draft kept.`;}} catch{routesReceipt=unknownRoutes;}finally{routesBusy=false;if(!out())render(false);} }); // Row 194 (#1692, D7): the Agents section lives in agents.js (window.MosaicAgents) and draws from diff --git a/packages/webui/src/serve.mjs b/packages/webui/src/serve.mjs index 8ae511280..961affc3a 100644 --- a/packages/webui/src/serve.mjs +++ b/packages/webui/src/serve.mjs @@ -583,10 +583,11 @@ const ROUTE_REASONS = { 'organization-unknown-instance': ['400', 'the business has no such instance'], 'organization-no-change': ['400', 'the business file already says that'], 'revision-conflict': ['409', 'the business file changed since you read it. Read the routes again'], - // D3 (P0-4): the model refusals name the step on this page that makes the save apply. Status - // stays the bus status these codes already had (502). - 'model-catalogue-unavailable': ['502', 'the model catalogue is unavailable, so a model it supplies can\'t be checked. Keep each instance\'s model and change only thinking, or press Disable model proxy catalogue on this page when this organization has no model proxy, then save again'], - 'model-provider-unavailable': ['502', 'the model provider doesn\'t offer that model now. Keep each instance\'s model and change only thinking, pick a model the catalogue lists, or press Disable model proxy catalogue on this page when this organization has no model proxy, then save again'], + // D3 (P0-4): the model refusals name the next step. Status stays the bus status these codes + // already had (502). The Routing page adds Disable model proxy catalogue only when that switch + // can make the save apply (bus.js catalogueStep). + 'model-catalogue-unavailable': ['502', 'the model catalogue is unavailable, so a model it supplies can\'t be checked. A change to thinking alone still saves; a model from the model proxy needs the proxy set up first'], + 'model-provider-unavailable': ['502', 'the model provider doesn\'t offer that model now. A change to thinking alone still saves; otherwise pick a model the catalogue lists, or set up the model proxy when the model comes from it'], 'model-harness-incompatible': ['502', 'that model doesn\'t run on that harness. Pick a harness the model lists, or another model'], 'model-key-collision': ['502', 'that model key already names a different model in the model table. Pick the table\'s entry or another key'], }; diff --git a/packages/webui/tests/routes-browser.test.mjs b/packages/webui/tests/routes-browser.test.mjs index 0710b0f4e..6080b67f9 100644 --- a/packages/webui/tests/routes-browser.test.mjs +++ b/packages/webui/tests/routes-browser.test.mjs @@ -298,3 +298,42 @@ test('D3 Routing: with cliproxy listed and no model proxy the switch reads Disab await b.close(); } }); + +// D3 review (finding 1, 3): after a catalogue refusal the receipt names Disable model proxy +// catalogue only when pressing it can make the save apply: cliproxy is listed and the model the +// change moves to comes from another listed module. A model from the proxy, or a list without +// cliproxy (Disable already pressed), gets no Disable step; a tester is sent to the owner. +test('D3 Routing: a catalogue refusal names Disable only when it can make the save apply, and sends a tester to the owner', {timeout:90000}, async t => { + const refusal=code=>({error:code,message:`${code}: the reason. Nothing changed.`,sent:false}); + for (const [providers, tester, instance, code, expect] of [ + [['fixture','cliproxy'], false, 'coder', 'model-catalogue-unavailable', /Nothing changed\. This change needs no model proxy: press Disable model proxy catalogue, then save again\. Draft kept\.$/], + [['fixture','cliproxy'], false, 'reviewer', 'model-catalogue-unavailable', /Nothing changed\. Draft kept\.$/], + [['fixture'], false, 'reviewer', 'model-provider-unavailable', /Nothing changed\. Draft kept\.$/], + [['fixture','cliproxy'], true, 'coder', 'model-catalogue-unavailable', /Nothing changed\. Ask the organization's owner to set up the model proxy, or to disable the model proxy catalogue when the change needs no proxy\. Draft kept\.$/], + ]) { + const label=`${providers.join(',')} tester=${tester} ${instance}`; + const view={business:'acme',revision:'a'.repeat(64),harnesses:['pi','claude-code'],models:['fixture-deterministic','proxy-x'], + providerModels:{'fixture-deterministic':{module:'fixture',upstream:'fixture',model:'fixture-deterministic'},'proxy-x':{module:'cliproxy',upstream:'u',model:'x'}}, + levels:{pi:['off','low'],'claude-code':['off','low']}, + instances:{coder:{harness:'pi',model:'fixture-deterministic',thinking:'off',fallback:null},reviewer:{harness:'pi',model:'proxy-x',thinking:'off',fallback:null}}, + catalogue:{status:'unavailable',models:[],notices:[]}}; + const plugins={revision:'b'.repeat(64),plugins:{harness:['pi','claude-code'],'model-provider':providers},available:{harness:['pi','claude-code']}}; + const web=await startServer({port:0,board:'http://127.0.0.1:9',bus:{messages:async()=>({messages:[],unread:0}),usage:async()=>{throw Error('fixture')},routes:async()=>view},reads:{settings:()=>({business:'acme',release:'fixture',notifier:{}})},log:()=>{}});t.after(()=>close(web)); + const b=await browser();t.after(()=>b.close()); + await b.call('Page.addScriptToEvaluateOnNewDocument',{source:`const original=window.fetch;window.posts=[];window.fetch=async(url,options={})=>{if(url==='/api/config')return new Response(JSON.stringify({send:${!tester},tester:${tester}}));if(url==='/api/proxy/plugins')return new Response(JSON.stringify(${JSON.stringify(plugins)}));if(url==='/api/routes'&&options.method==='POST'){posts.push(JSON.parse(options.body));return new Response(JSON.stringify(${JSON.stringify(refusal(code))}),{status:502});}return original(url,options);};`}); + await b.navigate(`http://127.0.0.1:${web.address().port}/#/settings/routing`); + const wait=expr=>b.evaluate(`(async()=>{for(let n=0;n<200;n++){if(${expr})return true;await new Promise(r=>setTimeout(r,30));}throw Error('wait failed: '+${JSON.stringify(expr)});})()`); + const cell=key=>`document.querySelector(${JSON.stringify(`[data-route='${JSON.stringify([instance,key])}']`)})`; + await wait(`${cell('harness')}&&!document.querySelector('#routes-form button[type=submit]').disabled${tester?'':"&&!!document.querySelector('[data-harness]')"}`); + // The harness change moves the instance's route, so the bus would ask the catalogue. + await b.evaluate(`{const e=${cell('harness')};e.value='claude-code';e.dispatchEvent(new Event('change',{bubbles:true}));}true`); + await wait(`${cell('harness')}.value==='claude-code'`); + await b.evaluate(`document.querySelector('#routes-form').requestSubmit();true`); + await wait('posts.length===1&&document.querySelector("#routes-receipt").textContent.includes("Draft kept")'); + assert.deepEqual(await b.evaluate('posts[0].routes'),{[instance]:{harness:'claude-code',model:view.instances[instance].model,thinking:'off',fallback:null}},label); + const text=await b.evaluate('document.querySelector("#routes-receipt").textContent'); + assert.match(text,new RegExp(`^${code}: the reason\\. `),label); + assert.match(text,expect,label); + await b.close();await close(web); + } +}); diff --git a/packages/webui/tests/routes.test.mjs b/packages/webui/tests/routes.test.mjs index d03b7e162..5a7ec0977 100644 --- a/packages/webui/tests/routes.test.mjs +++ b/packages/webui/tests/routes.test.mjs @@ -174,10 +174,12 @@ test('row 65 Console: the routes read takes no arguments, needs a bus and refuse assert.equal((await get(refused, '/api/bus/routes')).status, 403); }); -test('D3 P0-4: a model refusal keeps its status and names the step on the Routing page that makes the save apply', async t => { +// The Disable step is the Routing page's to add (bus.js catalogueStep), since only the page knows +// whether pressing it can help; the server text never names it. +test('D3 P0-4: a model refusal keeps its status and names the next step that makes the save apply', async t => { for (const [code, step] of [ - ['model-catalogue-unavailable', /change only thinking, or press Disable model proxy catalogue on this page/], - ['model-provider-unavailable', /change only thinking, pick a model the catalogue lists, or press Disable model proxy catalogue on this page/], + ['model-catalogue-unavailable', /A change to thinking alone still saves; a model from the model proxy needs the proxy set up first\. Nothing changed\.$/], + ['model-provider-unavailable', /A change to thinking alone still saves; otherwise pick a model the catalogue lists, or set up the model proxy when the model comes from it\. Nothing changed\.$/], ['model-harness-incompatible', /Pick a harness the model lists, or another model/], ['model-key-collision', /Pick the table's entry or another key/], ]) { @@ -186,6 +188,6 @@ test('D3 P0-4: a model refusal keeps its status and names the step on the Routin assert.deepEqual([r.status, r.body.error, r.body.sent], [502, code, false], code); assert.match(r.body.message, new RegExp(`^${code}: .*Nothing changed\\.$`), code); assert.match(r.body.message, step, code); - assert.doesNotMatch(r.body.message, /refused by the bus/, code); + assert.doesNotMatch(r.body.message, /refused by the bus|Disable/, code); } }); -- 2.54.0