fix(bus): review round: the restart notice shows only on a ready catalogue, since a fenced, colliding or down proxy still refuses after a restart (#1873, lane pickup-launch)
A bus booted with the proxy on a fenced instance reads the same unavailable catalogue, so the notice sent the owner to a restart that stops running agents and starts none. The test proves that and shows the notice again once the fence is gone. The disabled check goes away with it; the disabled test now says the routes verb answers disabled itself.
This commit was merged in pull request #1998.
This commit is contained in:
1 parent
f7c0e4f46c
commit
196505e6ef
2 files changed
+16
-6
No files matched your search
@@ -889,12 +889,13 @@ export async function startBroker({
|
|||||||
// Unavailable with no client: the catalogue names the cause instead of a bare unavailable.
|
// Unavailable with no client: the catalogue names the cause instead of a bare unavailable.
|
||||||
// pickup-launch: a late client serves accounts and the catalogue, but a launch on it needs what
|
// pickup-launch: a late client serves accounts and the catalogue, but a launch on it needs what
|
||||||
// only the start path builds (ModelKeys here, the proxy in the host launcher's boot system), so
|
// only the start path builds (ModelKeys here, the proxy in the host launcher's boot system), so
|
||||||
// while this bus holds one its catalogue says plainly that a restart is needed.
|
// while this bus holds one a ready catalogue says plainly that a restart is needed. Not on an
|
||||||
|
// unavailable one: a fence, a collision or a down proxy still refuses after a restart.
|
||||||
const RESTART_TO_LAUNCH = 'Restart this organization to start agents on these models.';
|
const RESTART_TO_LAUNCH = 'Restart this organization to start agents on these models.';
|
||||||
const explainCatalogue = value => {
|
const explainCatalogue = value => {
|
||||||
if (value?.status === 'unavailable' && value.reason === undefined && !modelProxyClient && proxyCause)
|
if (value?.status === 'unavailable' && value.reason === undefined && !modelProxyClient && proxyCause)
|
||||||
return { ...value, reason: 'proxy-not-configured', notices: [proxyCause] };
|
return { ...value, reason: 'proxy-not-configured', notices: [proxyCause] };
|
||||||
if (lateProxy && value?.status !== 'disabled')
|
if (lateProxy && value?.status === 'ready')
|
||||||
return { ...value, notices: [...(value?.notices ?? []), RESTART_TO_LAUNCH] };
|
return { ...value, notices: [...(value?.notices ?? []), RESTART_TO_LAUNCH] };
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ test('a bus started with the proxy shows no restart notice', async t => {
|
|||||||
assert.deepEqual(view.catalogue.notices, []);
|
assert.deepEqual(view.catalogue.notices, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('an organization with no model provider shows a disabled catalogue with no restart notice', async t => {
|
test('an organization with no model provider shows a disabled catalogue with no restart notice (the routes verb answers disabled itself)', async t => {
|
||||||
const f = instance(t);
|
const f = instance(t);
|
||||||
const a = await orgBus(t, f, 'alpha'), b = await orgBus(t, f, 'beta', { providers: [] });
|
const a = await orgBus(t, f, 'alpha'), b = await orgBus(t, f, 'beta', { providers: [] });
|
||||||
await initThroughA(t, f, a);
|
await initThroughA(t, f, a);
|
||||||
@@ -208,16 +208,25 @@ test('an organization with no model provider shows a disabled catalogue with no
|
|||||||
assert.deepEqual(view.catalogue.notices, []);
|
assert.deepEqual(view.catalogue.notices, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('a fenced catalogue on a picked-up client reads unavailable and still says a restart is needed', async t => {
|
test('a fenced catalogue on a picked-up client reads unavailable with no restart notice, since a restart would not help', async t => {
|
||||||
const f = instance(t);
|
const f = instance(t);
|
||||||
const a = await orgBus(t, f, 'alpha'), b = await orgBus(t, f, 'beta');
|
const a = await orgBus(t, f, 'alpha'), b = await orgBus(t, f, 'beta');
|
||||||
const { proxy } = await initThroughA(t, f, a);
|
const { proxy } = await initThroughA(t, f, a);
|
||||||
assert.equal((await b.ask('routes')).catalogue.status, 'ready');
|
assert.equal(restartNotices(await b.ask('routes')), 1);
|
||||||
createProxyLock({ stateDir: join(f.dataRoot, 'proxy'), identity: `${f.configDir}:${proxy.port}` }).fence({ org: 'alpha' });
|
createProxyLock({ stateDir: join(f.dataRoot, 'proxy'), identity: `${f.configDir}:${proxy.port}` }).fence({ org: 'alpha' });
|
||||||
const view = await b.ask('routes');
|
const view = await b.ask('routes');
|
||||||
assert.equal(view.catalogue.status, 'unavailable');
|
assert.equal(view.catalogue.status, 'unavailable');
|
||||||
assert.ok(b.bus.modelProxy);
|
assert.ok(b.bus.modelProxy);
|
||||||
assert.equal(restartNotices(view), 1);
|
assert.equal(restartNotices(view), 0);
|
||||||
|
// A bus that booted with the proxy on the same fenced instance, which is what a restart gives,
|
||||||
|
// reads the same unavailable catalogue: the restart notice would have sent the owner nowhere.
|
||||||
|
const c = await orgBus(t, f, 'gamma', { binding: { proxy: loadProxy(f.configDir, f.dataRoot) } });
|
||||||
|
assert.equal((await c.ask('routes')).catalogue.status, 'unavailable');
|
||||||
|
// Once the fence is gone, the ready catalogue says again that a restart is needed.
|
||||||
|
fs.rmSync(join(f.dataRoot, 'proxy', 'mosaic-keys.uncertain'));
|
||||||
|
const after = await b.ask('routes');
|
||||||
|
assert.equal(after.catalogue.status, 'ready', JSON.stringify(after.catalogue));
|
||||||
|
assert.equal(restartNotices(after), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('refused settings still refuse the launch and name their cause, not the restart notice', async t => {
|
test('refused settings still refuse the launch and name their cause, not the restart notice', async t => {
|
||||||
|
|||||||
Reference in new issue
Block a user