Skip to content

The agent that grows with you

fix(desktop): group-chat member failure row names the error's first line (#117366)

teknium1d90c3ad40a0b
diff --git a/apps/desktop/e2e/group-member-backend-failure.spec.ts b/apps/desktop/e2e/group-member-backend-failure.spec.ts
index 8f68d2003ea..9d03acf1ed7 100644
--- a/apps/desktop/e2e/group-member-backend-failure.spec.ts
+++ b/apps/desktop/e2e/group-member-backend-failure.spec.ts
@@ -92,6 +92,9 @@ test('a member whose backend fails the turn is reported at once, not read as bus
await expect(activity).toContainText('Programmer hit an error', { timeout: 5_000 })
}).toPass({ timeout: 120_000 })
+ // #117366: the row names the cause, not just the fact — the raw error's
+ // first line rides along so a stopped backend and a provider refusal differ.
+ await expect(activity).toContainText(/Programmer hit an error — \S+/)
await expect(page.getByRole('button', { name: 'Stop', exact: true })).toHaveCount(0, { timeout: 30_000 })
const room = await page.evaluate(name => {
diff --git a/apps/desktop/src/plugins/hermes-bots/group-activity.test.ts b/apps/desktop/src/plugins/hermes-bots/group-activity.test.ts
index ce3670ce758..421e8c9067e 100644
--- a/apps/desktop/src/plugins/hermes-bots/group-activity.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/group-activity.test.ts
@@ -159,11 +159,17 @@ describe('turn arc', () => {
expect(Object.values(room.data.$botAttention.get())[0]?.reason).toBe('provider_auth_or_access')
})
- it('an untyped failed member turn keeps the message-classification fallback', async () => {
+ // #117366: an untyped failure used to collapse to a bare "builder hit an
+ // error" — no cause, nothing to act on. The row now keeps the error's first
+ // line (secret spans redacted) and the badge still classifies from it.
+ it('an untyped failed member turn surfaces the error first line, redacted, and keeps the badge fallback', async () => {
const room = await loadRoom({
turn: ({ profile }) => {
if (profile === 'builder') {
- throw new Error('No LLM provider configured')
+ throw new Error(
+ 'No LLM provider configured for https://api.example.test/v1?api_key=sk-live-0123456789abcdef\n' +
+ ' at runMemberTurn (group-turns.ts:1)'
+ )
}
return '(pass)'
@@ -174,8 +180,11 @@ describe('turn arc', () => {
await drain(() => Boolean(room.chat.$groupChats.get()['Untyped failure']?.running))
const failed = feed(room, 'Untyped failure').find(event => event.kind === 'failed' && event.member === 'builder')
+ const label = room.activity.groupActivityLabel(failed!, 'Untyped failure')
- expect(failed?.reason).toBeUndefined()
+ expect(label.startsWith('builder hit an error — No LLM provider configured for ')).toBe(true)
+ expect(label).not.toContain('sk-live-0123456789abcdef')
+ expect(label).not.toContain('runMemberTurn')
expect(Object.values(room.data.$botAttention.get())[0]?.reason).toBe('missing_config')
})
diff --git a/apps/desktop/src/plugins/hermes-bots/group-activity.ts b/apps/desktop/src/plugins/hermes-bots/group-activity.ts
index 2f6f5d39615..31efdf7d7ee 100644
--- a/apps/desktop/src/plugins/hermes-bots/group-activity.ts
+++ b/apps/desktop/src/plugins/hermes-bots/group-activity.ts
@@ -86,8 +86,11 @@ export function isGroupSlotWaitTimeoutText(text: unknown): boolean {
/** Typed failure cause for a member-turn error: the gateway's
* `data.reason` when present, else the normalized slot-wait cause when the
- * message carries the coordinator phrase, else ''. Single home for the
- * classification so the turn catch and the stranded harvest cannot drift. */
+ * message carries the coordinator phrase, else the error's own first line.
+ * Single home for the classification so the turn catch and the stranded
+ * harvest cannot drift. #117366: a bare "X hit an error" row gave the user
+ * nothing to act on (a stopped backend, a dead IPC bridge and a provider
+ * refusal all read the same), so an unclassified failure keeps its message. */
export function groupFailureReason(error: unknown): string {
const typed = typeof (error as { data?: { reason?: unknown } })?.data?.reason === 'string'
? String((error as { data: { reason: string } }).data.reason).trim()
@@ -99,7 +102,32 @@ export function groupFailureReason(error: unknown): string {
const message = error instanceof Error ? error.message : typeof error === 'string' ? error : ''
- return isGroupSlotWaitTimeoutText(message) ? GROUP_SLOT_WAIT_REASON : ''
+ return isGroupSlotWaitTimeoutText(message) ? GROUP_SLOT_WAIT_REASON : groupFailureDetail(message)
+}
+
+const GROUP_FAILURE_DETAIL_LIMIT = 200
+
+// Secret-shaped spans an error line can carry (a bearer header, a `?token=`
+// URL, a vendor API key, `user@host:password`). The plugin fence keeps the
+// Electron-side `redactSecrets` out of reach, so the same shapes live here.
+const GROUP_FAILURE_REDACTIONS: Array<[RegExp, string]> = [
+ [/(authorization["']?\s*[:=]\s*["']?bearer\s+)(\S+)/gi, '$1<redacted>'],
+ [/([?&](?:token|ticket|api_?key|key|access_token|secret)=)([^\s&"']+)/gi, '$1<redacted>'],
+ [/\b(sk-[A-Za-z0-9_-]{8,}|ghp_[A-Za-z0-9]{8,}|xox[abprs]-[A-Za-z0-9-]{8,})\b/g, '<redacted>'],
+ [/(\S+@[^\s:/]+):(?!\d+\b)[^\s:/]+/g, '$1:<redacted>']
+]
+
+/** The first non-empty line of a raw error message, trimmed, secret spans
+ * redacted, capped — the room row is a summary, the log keeps the rest. */
+export function groupFailureDetail(message: unknown): string {
+ const line = String(message || '')
+ .split(/\r?\n/)
+ .map(part => part.trim())
+ .find(Boolean) || ''
+
+ const redacted = GROUP_FAILURE_REDACTIONS.reduce((text, [re, repl]) => text.replace(re, repl), line)
+
+ return redacted.length > GROUP_FAILURE_DETAIL_LIMIT ? `${redacted.slice(0, GROUP_FAILURE_DETAIL_LIMIT - 1)}…` : redacted
}
/** Human label for one activity event, used by the collapsed summary and
diff --git a/apps/desktop/src/plugins/hermes-bots/types.ts b/apps/desktop/src/plugins/hermes-bots/types.ts
index ec0061dc1cb..3659ed92b58 100644
--- a/apps/desktop/src/plugins/hermes-bots/types.ts
+++ b/apps/desktop/src/plugins/hermes-bots/types.ts
@@ -289,8 +289,9 @@ export interface GroupActivityEvent {
kind: GroupActivityKind
member?: string
preview?: string
- /** Typed failure cause (gateway `data.reason` or the normalized
- * `slot_wait_timeout`); absent on non-failures and untyped failures. */
+ /** Failure cause: the gateway's typed `data.reason`, the normalized
+ * `slot_wait_timeout`, or the error's redacted first line (#117366);
+ * absent on non-failures. */
reason?: string
}
diff --git a/website/docs/user-guide/bot-mode.md b/website/docs/user-guide/bot-mode.md
index 08a5b8562c8..12807a26614 100644
--- a/website/docs/user-guide/bot-mode.md
+++ b/website/docs/user-guide/bot-mode.md
@@ -118,7 +118,9 @@ observation window does not extend the turn itself.
Unresolved member failures remain visible in the collapsed Activity summary after
the room settles — including a turn the member's backend itself failed (bad
credentials, provider errors), which is reported the moment the gateway
-reports it instead of looking like twenty minutes of thinking. Expand Activity for the turn sequence; re-address the member to
+reports it instead of looking like twenty minutes of thinking. A failure row names its cause: `builder hit an error — <first line of
+the error>` (secret-shaped tokens redacted, long lines truncated), or `builder couldn't start — too many bots running` when the local
+backend pool had no free slot. Expand Activity for the turn sequence; re-address the member to
try again. An ambiguous submit failure is not automatically resubmitted.