A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Restore the old bundle for every reinstall result the update rejects
Fei2411c212cceaf49d
diff --git a/ds-bot/src/host/update.js b/ds-bot/src/host/update.jsindex a4c7f534..eb23a898 100644--- a/ds-bot/src/host/update.js+++ b/ds-bot/src/host/update.js@@ -279,7 +279,10 @@ export function install(rt) {}try {const again = await service.installBundle(chosen.spec, options)- if (again?.error) mark(await restore(again.error.diagnostic ?? again.error.code ?? 'install failed'))+ // A failure also arrives as an application state with no error; the+ // result check below rejects every one of those, so restore sees the+ // same failures it does.+ if (again?.error || !['applied', 'restart-required'].includes(again?.application)) mark(await restore(again?.error?.diagnostic ?? again?.error?.code ?? `install ${again?.application ?? 'failed'}`))return again} catch (error) {mark(await restore(error?.message ?? String(error)))diff --git a/ds-bot/test/update.test.js b/ds-bot/test/update.test.jsindex cb096822..c551400c 100644--- a/ds-bot/test/update.test.js+++ b/ds-bot/test/update.test.js@@ -336,6 +336,26 @@ test('a failed reinstall writes its reason into the note', async () => {rmSync(home, { recursive: true, force: true, maxRetries: 5 })})+test('a reinstall refused by an application state also puts the old version back', async () => {+ const home = newHome()+ const { rt, installs } = start({+ source: `${PKG.name}@^${PKG.version}`,+ config: { updateRegistry: 'https://registry.example' },+ answers: { [`https://registry.example/${PKG.name}/latest`]: { version: '9.0.0' } },+ result: count => (count === 1 ? { error: { code: 'already-installed' } } : count === 2 ? { application: 'failed' } : { application: 'applied', version: PKG.version }),+ home,+ })+ await rt.updateCheck()+ rt.updateStart()+ await flush()+ assert.equal(installs.length, 3)+ assert.equal(installs[2][0], `${PKG.name}@${PKG.version}`)+ const note = noteIn(home)+ assert.equal(note.error, `install failed; ${PKG.name}@${PKG.version} was reinstalled`)+ assert.equal((await rt.updateCheck()).phase, 'failed')+ rmSync(home, { recursive: true, force: true, maxRetries: 5 })+})+test('the note for the version now running shows the update once and is consumed', async () => {const home = newHome()writeFileSync(join(home, 'update.json'), JSON.stringify({ from: '0.2.0', to: PKG.version, spec: `${PKG.name}@${PKG.version}`, startedAt: new Date().toISOString() }))