Skip to content

The agent that grows with you

fix(desktop): a failed turn's "request not processed" line is a Hermes notice, not the model speaking

teknium1224e7b673e7e
diff --git a/apps/desktop/src/lib/chat-messages.test.ts b/apps/desktop/src/lib/chat-messages.test.ts
index 80951435ad5..d9c18c09234 100644
--- a/apps/desktop/src/lib/chat-messages.test.ts
+++ b/apps/desktop/src/lib/chat-messages.test.ts
@@ -450,6 +450,18 @@ describe('toChatMessages', () => {
])
})
+ // Hermes closes a failed turn with an assistant-role row (agent/turn_failure_copy.py);
+ // painted as the model's reply it read as the assistant refusing the request.
+ it('renders the failed-turn boundary as a Hermes notice, not a model reply', () => {
+ const messages = toChatMessages([
+ { role: 'user', content: 'do the thing', timestamp: 1 },
+ { role: 'assistant', content: 'Your request was not processed.', display_kind: 'failed_turn', timestamp: 2 }
+ ])
+
+ expect(messages.map(message => message.role)).toEqual(['user', 'system'])
+ expect(chatMessageText(messages[1])).toBe('Your request was not processed.')
+ })
+
// A backend older than this app serves display_metadata as unparsed JSON
// text. Indexing into that string used to throw and fail the whole resume.
it.each([
diff --git a/apps/desktop/src/lib/chat-messages/hydration.ts b/apps/desktop/src/lib/chat-messages/hydration.ts
index aa21ce40e09..ecf79177ed0 100644
--- a/apps/desktop/src/lib/chat-messages/hydration.ts
+++ b/apps/desktop/src/lib/chat-messages/hydration.ts
@@ -346,7 +346,9 @@ export function toChatMessages(messages: SessionMessage[]): ChatMessage[] {
message.display_kind === 'async_delegation_complete' ||
message.display_kind === 'process_complete' ||
message.display_kind === 'auto_continue' ||
- message.display_kind === 'personality_switch'
+ message.display_kind === 'personality_switch' ||
+ // Hermes closing a failed turn, not the model speaking.
+ message.display_kind === 'failed_turn'
? 'system'
: message.role
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index 50ccd9d3572..efc0cde6df6 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -636,6 +636,7 @@ export interface SessionMessage {
display_kind?:
| 'async_delegation_complete'
| 'auto_continue'
+ | 'failed_turn'
| 'hidden'
| 'model_switch'
| 'personality_switch'