test(bus): chat-fail pickup-launch: the fixture runs its Claude model on claude-code, since a legacy Claude entry counts as OAuth and runs there only; the host launcher's env carries a stand-in session login, because claude-code's preflight needs one and this launcher boots with no proxy, and a stand-in adapter path skips only the binary check, so each launch still stops at the model gate with model-provider-unavailable and no assertion changed (#1873, lane chat-fail)
This commit is contained in:
1 parent
07eca4a670
commit
5a07f9e1f9
1 file changed
+11
-4
@@ -80,7 +80,9 @@ function instance(t) {
|
|||||||
// A real organization bus on the instance, started with no proxy unless `binding.proxy` gives one.
|
// A real organization bus on the instance, started with no proxy unless `binding.proxy` gives one.
|
||||||
async function orgBus(t, f, id, { providers = ['cliproxy'], binding = {} } = {}) {
|
async function orgBus(t, f, id, { providers = ['cliproxy'], binding = {} } = {}) {
|
||||||
const doc = businessDoc(f.root, id);
|
const doc = businessDoc(f.root, id);
|
||||||
doc.plugins = { harness: ['pi'], 'model-provider': providers };
|
// The coder's model is a Claude model on a legacy entry, which counts as OAuth and runs on
|
||||||
|
// claude-code only, so the organization enables claude-code.
|
||||||
|
doc.plugins = { harness: ['claude-code'], 'model-provider': providers };
|
||||||
writeJson(join(f.configDir, 'businesses', `${id}.json`), doc);
|
writeJson(join(f.configDir, 'businesses', `${id}.json`), doc);
|
||||||
const business = loadBusiness(id, { dir: f.configDir, rolesDir: f.rolesDir }), resolved = {};
|
const business = loadBusiness(id, { dir: f.configDir, rolesDir: f.rolesDir }), resolved = {};
|
||||||
for (const name of Object.keys(business.roles)) resolved[name] = resolveInstance({ system: f.system, business, instance: name });
|
for (const name of Object.keys(business.roles)) resolved[name] = resolveInstance({ system: f.system, business, instance: name });
|
||||||
@@ -113,7 +115,7 @@ async function pickModel(o) {
|
|||||||
const view = await o.ask('routes');
|
const view = await o.ask('routes');
|
||||||
assert.equal(view.catalogue.status, 'ready');
|
assert.equal(view.catalogue.status, 'ready');
|
||||||
assert.ok(view.catalogue.models.some(m => m.key === MODEL));
|
assert.ok(view.catalogue.models.some(m => m.key === MODEL));
|
||||||
await o.ask('routes.set', { revision: view.revision, routes: { coder: { harness: 'pi', model: MODEL, thinking: 'low', fallback: null } } });
|
await o.ask('routes.set', { revision: view.revision, routes: { coder: { harness: 'claude-code', model: MODEL, thinking: 'low', fallback: null } } });
|
||||||
}
|
}
|
||||||
|
|
||||||
// The host launcher as cli.mjs builds it for a bus that booted with no proxy.json: its system has
|
// The host launcher as cli.mjs builds it for a bus that booted with no proxy.json: its system has
|
||||||
@@ -123,7 +125,10 @@ async function hostLauncher(t, f, o, { system = {} } = {}) {
|
|||||||
initializeControl(o.dataRoot);
|
initializeControl(o.dataRoot);
|
||||||
// A launch whose role names a skill that is not enabled refuses before the model gate.
|
// A launch whose role names a skill that is not enabled refuses before the model gate.
|
||||||
if (!fs.existsSync(join(f.dataRoot, 'skills-enabled'))) fs.cpSync(REPO_SKILLS, join(f.dataRoot, 'skills-enabled'), { recursive: true });
|
if (!fs.existsSync(join(f.dataRoot, 'skills-enabled'))) fs.cpSync(REPO_SKILLS, join(f.dataRoot, 'skills-enabled'), { recursive: true });
|
||||||
const env = withoutHostCredentials(humanEnv({ MOSAIC_CONFIG: join(f.configDir, 'config.json'), MOSAIC_ROLES_DIR: f.rolesDir }), { piKey: true });
|
// claude-code's preflight needs a session login or a proxy key, and this launcher boots with no
|
||||||
|
// proxy, so the env carries a stand-in login (as launcher.test.mjs does). No adapter ever runs.
|
||||||
|
const env = withoutHostCredentials(humanEnv({ MOSAIC_CONFIG: join(f.configDir, 'config.json'), MOSAIC_ROLES_DIR: f.rolesDir }));
|
||||||
|
env.CLAUDE_CODE_OAUTH_TOKEN = 'stand-in';
|
||||||
const answers = [], ops = [];
|
const answers = [], ops = [];
|
||||||
const host = { business: o.id, beforeClose: () => {}, op: async m => {
|
const host = { business: o.id, beforeClose: () => {}, op: async m => {
|
||||||
ops.push(m.op);
|
ops.push(m.op);
|
||||||
@@ -134,7 +139,9 @@ async function hostLauncher(t, f, o, { system = {} } = {}) {
|
|||||||
return {};
|
return {};
|
||||||
} };
|
} };
|
||||||
const cliproxy = JSON.stringify(pathToFileURL(new URL('../../plugins/model-provider/cliproxy/index.mjs', import.meta.url).pathname).href);
|
const cliproxy = JSON.stringify(pathToFileURL(new URL('../../plugins/model-provider/cliproxy/index.mjs', import.meta.url).pathname).href);
|
||||||
const makeLoader = await fakeHarnesses(t, { pi: null }, write => write('model-provider', 'cliproxy', `export * from ${cliproxy};\n`));
|
// The stand-in adapter path skips only the binary check; the launch stops at the model gate or
|
||||||
|
// authorizeLaunch, before any adapter runs.
|
||||||
|
const makeLoader = await fakeHarnesses(t, { 'claude-code': '/fixture-unused' }, write => write('model-provider', 'cliproxy', `export * from ${cliproxy};\n`));
|
||||||
// The validated system config shape (mosaic-config.mjs), as cli.mjs passes it with the org root.
|
// The validated system config shape (mosaic-config.mjs), as cli.mjs passes it with the org root.
|
||||||
const config = { configVersion: 1, environment: 'development', dataRoot: o.dataRoot, instanceRoot: f.dataRoot,
|
const config = { configVersion: 1, environment: 'development', dataRoot: o.dataRoot, instanceRoot: f.dataRoot,
|
||||||
execution: { backend: 'docker', provider: 'zai', model: 'glm-5.3-flash', adapter: 'mock' }, ...system };
|
execution: { backend: 'docker', provider: 'zai', model: 'glm-5.3-flash', adapter: 'mock' }, ...system };
|
||||||
|
|||||||
Reference in new issue
Block a user