Skip to content

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

Merge remote-tracking branch 'origin/dev' into fix/513-external-state-edit

Fei2411be68507035f7
diff --cc ds-bot/src/host/store.js
index d1b6868c,145f7ab1..d28fe88c
--- a/ds-bot/src/host/store.js
+++ b/ds-bot/src/host/store.js
@@@ -264,20 -266,10 +266,20 @@@ export function install(rt)
claimLock()
if (lockBroken) return
if (holder === undefined) {
- // The lock was free: still the writer, but the file may carry changes
- // written while no host held it.
warnedReadOnly = false
+ // The lock was free and is this host's again. A hand-over and an outside edit look
+ // the same here, so the file on disk is adopted either way; when it is not what this
+ // host last saw, this host's own state is kept aside first.
+ if (stamp() !== seen) {
+ const aside = `${statePath}.replaced-${Date.now()}`
+ try {
+ await writeFile(aside, JSON.stringify(state))
+ warn('ds-bot: %s changed while no host held the team; it is adopted and this host\'s state is kept as %s', statePath, aside)
+ } catch (error) {
+ warn('ds-bot: %s changed while no host held the team; it is adopted, and this host\'s state is lost because it could not be kept aside: %s', statePath, error)
+ }
+ }
- adopt(await readFileState())
+ adopt(readFileState())
return
}
warn('ds-bot: %s', readOnly())