Skip to content

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

Keep a failed group turn in the group's log and say how to go on

Fei2411c4420029b1d2
diff --git a/ds-bot/client.js b/ds-bot/client.js
index e6269f70..8f6d5414 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -1203,7 +1203,7 @@ var ZH = {
Clear: "清空",
"Settings → Feedback has the details.": "详情见 设置 → 反馈。",
"Could not reach DSH. Check that it is still running.": "连不上 DSH,请确认它还在运行。",
- "{name} could not answer: {reason}": "{name} 没能回答:{reason}",
+ "{name} stopped: {reason}. Switch its model or ask it to go on.": "{name} 停下了:{reason}。换个模型,或让它继续。",
"Unknown error": "未知错误",
"The model has no API key": "模型还没有 API Key",
"The API key is not in the right format": "API Key 格式不对",
@@ -13968,7 +13968,7 @@ function RelayEvent({ reply, bot, sessionId, actions }) {
return (0, import_react31.createElement)(
"div",
{ className: "bt-event bt-event-error", role: "status", title: [reply.code, reply.status, reply.text].filter(Boolean).join(" · ") },
- t("{name} could not answer: {reason}", { name: bot.name, reason: failureLabel(reply.code, reply.text) })
+ t("{name} stopped: {reason}. Switch its model or ask it to go on.", { name: bot.name, reason: failureLabel(reply.code, reply.text) })
);
}
if (reply.kind === "lookup") {
diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.js
index 13642d5e..3c43fea9 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -915,7 +915,7 @@ function useLiveNote(actions, sessionId, id, entry) {
function RelayEvent({ reply, bot, sessionId, actions }) {
if (reply.kind === 'failed') {
return h('div', { className: 'bt-event bt-event-error', role: 'status', title: [reply.code, reply.status, reply.text].filter(Boolean).join(' · ') },
- t('{name} could not answer: {reason}', { name: bot.name, reason: failureLabel(reply.code, reply.text) }))
+ t('{name} stopped: {reason}. Switch its model or ask it to go on.', { name: bot.name, reason: failureLabel(reply.code, reply.text) }))
}
if (reply.kind === 'lookup') {
return h('div', { className: 'bt-event' },
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index 3d05df88..be78e5c3 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -1156,7 +1156,7 @@ const ZH = {
Clear: '清空',
'Settings → Feedback has the details.': '详情见 设置 → 反馈。',
'Could not reach DSH. Check that it is still running.': '连不上 DSH,请确认它还在运行。',
- '{name} could not answer: {reason}': '{name} 没能回答:{reason}',
+ '{name} stopped: {reason}. Switch its model or ask it to go on.': '{name} 停下了:{reason}。换个模型,或让它继续。',
'Unknown error': '未知错误',
'The model has no API key': '模型还没有 API Key',
'The API key is not in the right format': 'API Key 格式不对',
diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.js
index 68fb182f..19a619f3 100644
--- a/ds-bot/src/host/groups.js
+++ b/ds-bot/src/host/groups.js
@@ -92,6 +92,7 @@ const noticeText = (line) => {
if (line.reason === 'admin-passed') return `${(line.names ?? []).join(' and ') || 'The admin'} did not answer or call anyone; call a member with @Name.`
if (line.reason === 'folder') return `The group's folder ${line.path} is gone, so its members work in the team workspace; set the group's folder again in the group's settings.`
if (line.reason === 'goal') return goalNotice(line)
+ if (line.reason === 'failed') return `${(line.names ?? []).join(' and ')} stopped: its model call failed (${line.detail}). What it was doing here is not finished; the user can switch its model in its settings or ask it to go on.`
return line.text ?? ''
}
// `text` is what to show of a message line, by default what the log keeps of it.
@@ -257,6 +258,14 @@ export function install(rt) {
// The folder a group was set to work in is gone: its members' Sessions move on in
// the team workspace (parts.js), and the group is told once per folder, so a later
// round does not say it again. Changing the folder clears the mark (updateRoom).
+ // A failed turn stays in the log, so the admin and the other members read on their
+ // next turn that the work stopped there and why (#974); the round's row is gone once
+ // the round is.
+ const noteFailure = (room, name, failure) => {
+ ensureRoomLog(room)
+ appendRoom(room, { who: 'DS Bot', kind: 'notice', reason: 'failed', names: [name], detail: failureLine(failure) })
+ }
+
async function roomFolderNotice(roomId, folder) {
const room = rt.roomOf(roomId)
if (room === undefined || folder === undefined || room.workDir !== folder || room.folderNotice === folder) return
@@ -783,7 +792,9 @@ export function install(rt) {
slot.status = 'failed'
dropMemberFromBatch(room, member.id)
round.failed.push(member.name)
- round.replies.push({ kind: 'failed', botId: member.id, name: member.name, color: member.color, code: 'SESSION', text: String(error?.message ?? error).slice(0, 300), time: Date.now() })
+ const failure = { code: 'SESSION', message: String(error?.message ?? error).slice(0, 300) }
+ round.replies.push({ kind: 'failed', botId: member.id, name: member.name, color: member.color, code: failure.code, text: failure.message, time: Date.now() })
+ noteFailure(room, member.name, failure)
return
}
if (session === undefined) {
@@ -818,6 +829,7 @@ export function install(rt) {
round.failed.push(member.name)
const { code, status, message } = reply.failure
round.replies.push({ kind: 'failed', botId: member.id, name: member.name, color: member.color, code, ...(status ? { status } : {}), text: message, time: Date.now() })
+ noteFailure(room, member.name, reply.failure)
} else if (reply?.approval) {
// The member's turn goes on in the background and posts when it ends.
slot.status = 'waiting-approval'
@@ -1400,6 +1412,7 @@ export function install(rt) {
const wakeCaller = batch !== undefined && batch.pending.size === 0 && batch.done.length > 0 && !batch.answered ? batch.by : undefined
const { code, status, message } = failure
rt.goalTaskReset?.(room.id, member.id, 'Could not finish: its model call failed')
+ noteFailure(room, member.name, failure)
await postToRoom(room, member, `Could not finish: its model call failed (${failureLine(failure)}).`, {
late: true,
...(wakeCaller ? { askedBy: wakeCaller } : { quiet: true }),
diff --git a/ds-bot/test/rounds.test.js b/ds-bot/test/rounds.test.js
index 9fe8ae1b..b5d6f622 100644
--- a/ds-bot/test/rounds.test.js
+++ b/ds-bot/test/rounds.test.js
@@ -453,6 +453,28 @@ test('a member turn that fails before it takes the call fails that member in the
assert.deepEqual(result.replies.map(reply => [reply.kind ?? 'reply', reply.name]), [['failed', 'Chief'], ['reply', 'Writer']])
})
+// #974: a turn that ends on a quota error stops the work it was doing. The round's red row
+// goes with the round, so the group log keeps a line that the admin and the members read.
+test('a member turn that runs out of quota leaves a lasting line in the group log', async (t) => {
+ const { call, emit, userMessage, relay, answer, stop, sent, rt } = start()
+ t.after(stop)
+ const room = await team(call, sent)
+ await emit(room.id, userMessage('Deploy it'))
+ const running = relay(room.id, 'relay')
+ const first = await turnFor(sent)
+ await emit(first.sessionId, { type: 'turn/start', data: { turn: 1 } })
+ await emit(first.sessionId, { type: 'turn/end', data: { reason: { kind: 'error', error: { message: 'coding plan quota used up', code: 'QUOTA', status: 402 } } } })
+ const second = await turnFor(sent, first)
+ await answer(second.sessionId, second.message.source.exchangeId, 'Writer here.', 1)
+ await running
+ const failed = rt.roomOf(room.id).log.filter(line => line.kind === 'notice' && line.reason === 'failed')
+ assert.equal(failed.length, 1)
+ assert.deepEqual(failed[0].names, ['Chief'])
+ assert.match(failed[0].detail, /^QUOTA/)
+ const { lineText } = await import('../src/host/groups.js')
+ assert.match(lineText(failed[0]), /^\[Chief stopped: its model call failed \(QUOTA.*\)\. What it was doing here is not finished; the user can switch its model in its settings or ask it to go on\.\]$/)
+})
+
// A member deleted while its group Session is made sits the round out; the Session it was
// getting belongs to no one, so it is archived instead of left over.
test('a member deleted while its group Session is made is left out, and the Session is not kept', async (t) => {