From 42fa637325051c424b1c2ff24d3924b391060415 Mon Sep 17 00:00:00 2001 From: Logan Johnson Date: Wed, 11 Mar 2026 13:49:00 -0400 Subject: [PATCH 1/3] fix(penpal): prevent agent restart loop and UI vibration on comment When the agent process starts but crashes quickly, the frontend's auto-start logic would immediately restart it, creating a rapid loop that toggled the agent indicator and working dots on/off causing the UI to visibly vibrate. Server: track "quick exits" (agent ran <15s) and block restarts for 30s after a quick exit. Return cooldown status in the agent API. Frontend: respect server cooldown flag and add a 30s client-side rate limit on auto-start attempts. Always render agent indicator and working dots in the DOM using visibility:hidden when inactive so toggling never causes layout shifts. Co-Authored-By: Claude Opus 4.6 --- .../frontend/src/components/CommentsPanel.tsx | 60 +++++++++--------- apps/penpal/frontend/src/index.css | 2 + apps/penpal/frontend/src/pages/FilePage.tsx | 8 ++- apps/penpal/frontend/src/types.ts | 1 + apps/penpal/internal/agents/manager.go | 63 +++++++++++++++---- 5 files changed, 88 insertions(+), 46 deletions(-) diff --git a/apps/penpal/frontend/src/components/CommentsPanel.tsx b/apps/penpal/frontend/src/components/CommentsPanel.tsx index 4ab90328..5573a7f6 100644 --- a/apps/penpal/frontend/src/components/CommentsPanel.tsx +++ b/apps/penpal/frontend/src/components/CommentsPanel.tsx @@ -98,28 +98,26 @@ export default function CommentsPanel({ Comments {openCount > 0 && {openCount}} - {agentStatus?.running && ( - - - Agent - {agentStatus.contextPercent !== undefined && ( - - {Math.round(agentStatus.contextPercent)}% - - )} - - - )} + {Math.round(agentStatus.contextPercent)}% + + )} + + {resolvedThreads.length > 0 && (