Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop): label tool-call limit and context length errors

Alfredo Lopezca34baa481b7
diff --git a/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx b/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx
index d8acc55c7..5b531830d 100644
--- a/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx
+++ b/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx
@@ -89,6 +89,47 @@ describe('ChatThread semantic renderer compatibility', () => {
})
})
+describe('ChatThread error code labels', () => {
+ function renderErrorLabel(errorCode: string) {
+ messages = [
+ {
+ id: `error-${errorCode}`,
+ role: 'assistant',
+ content: 'The agent stopped.',
+ timestamp: 1,
+ isError: true,
+ errorCode,
+ },
+ ]
+ const { container } = render(<ChatThread />)
+ const response = screen.getByTestId('agent-response')
+ // Liveness witness: the message rendered as an error bubble.
+ expect(response.classList.contains('chat-bubble--error')).toBe(true)
+ return {
+ label: container.querySelector('.error-bubble-label')?.textContent,
+ text: response.textContent,
+ }
+ }
+
+ it('labels a tool-call limit as "Too Many Tool Calls", not "Model Overloaded"', () => {
+ const { label, text } = renderErrorLabel('LLM_TOOL_CALL_LIMIT_EXCEEDED')
+ expect(label).toBe('Too Many Tool Calls')
+ expect(text).not.toContain('Model Overloaded')
+ })
+
+ it('labels a context length error as "Conversation Too Long"', () => {
+ expect(renderErrorLabel('LLM_CONTEXT_LENGTH_EXCEEDED').label).toBe('Conversation Too Long')
+ })
+
+ it('still labels an overload as "Model Overloaded"', () => {
+ expect(renderErrorLabel('LLM_MODEL_OVERLOADED').label).toBe('Model Overloaded')
+ })
+
+ it('keeps the generic "Error" label for an unknown code', () => {
+ expect(renderErrorLabel('LLM_SOMETHING_UNMAPPED').label).toBe('Error')
+ })
+})
+
it('keeps generated files visible and downloadable on an interrupted error message', () => {
messages = [
{
diff --git a/desktop-app/ui/src/constants/agents.ts b/desktop-app/ui/src/constants/agents.ts
index 61eeda483..4563d195f 100644
--- a/desktop-app/ui/src/constants/agents.ts
+++ b/desktop-app/ui/src/constants/agents.ts
@@ -14,4 +14,6 @@ export const AGENT_ERROR_CODE_LABELS: Record<string, string> = {
LLM_MODEL_NOT_AVAILABLE: 'Model Not Available',
LLM_CONTENT_FILTERED: 'Content Filtered',
LLM_API_CALL_FAILED: 'Connection Error',
+ LLM_TOOL_CALL_LIMIT_EXCEEDED: 'Too Many Tool Calls',
+ LLM_CONTEXT_LENGTH_EXCEEDED: 'Conversation Too Long',
}