Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Drop the update note when the removal is refused

Fei2411984baf22467a
diff --git a/ds-bot/src/host/update.js b/ds-bot/src/host/update.js
index 108956c3..0b7c619f 100644
--- a/ds-bot/src/host/update.js
+++ b/ds-bot/src/host/update.js
@@ -248,6 +248,8 @@ export function install(rt) {
}))
} catch { /* a note that cannot be written just is not there */ }
}
+ // A refused removal leaves this version running, with nothing for a later start to report.
+ const unmark = () => { if (markerPath !== null) try { unlinkSync(markerPath) } catch { /* already gone */ } }
void Promise.resolve(service.installBundle(chosen.spec, options))
.then(async (result) => {
if (result?.error?.code !== 'already-installed') return result
@@ -255,8 +257,11 @@ export function install(rt) {
// depends on: remove the bundle (which unloads this host) and install it again.
if (typeof service.removeBundle !== 'function') return { error: { code: 'not-removable' } }
mark()
- const removed = await service.removeBundle(PKG.name)
- if (removed?.error) return { error: removed.error }
+ const removed = await Promise.resolve(service.removeBundle(PKG.name)).catch((error) => { unmark(); throw error })
+ if (removed?.error) {
+ unmark()
+ return { error: removed.error }
+ }
try {
const again = await service.installBundle(chosen.spec, options)
if (again?.error) mark(again.error.diagnostic ?? again.error.code ?? 'install failed')
diff --git a/ds-bot/test/update.test.js b/ds-bot/test/update.test.js
index ca711729..89b6f06d 100644
--- a/ds-bot/test/update.test.js
+++ b/ds-bot/test/update.test.js
@@ -313,6 +313,7 @@ test('a failed removal fails the update without a second install', async () => {
const view = await rt.updateCheck()
assert.equal(view.phase, 'failed')
assert.equal(view.error, 'bundle-in-use')
+ assert.equal(existsSync(join(home, 'update.json')), false)
rmSync(home, { recursive: true, force: true, maxRetries: 5 })
})