Skip to content

fix(site): delink agent health from script failures#26124

Draft
matifali wants to merge 2 commits into
coder:mainfrom
matifali:fix/delink-agent-health-from-scripts
Draft

fix(site): delink agent health from script failures#26124
matifali wants to merge 2 commits into
coder:mainfrom
matifali:fix/delink-agent-health-from-scripts

Conversation

@matifali
Copy link
Copy Markdown
Member

@matifali matifali commented Jun 6, 2026

Summary

Agent connectivity status should be separate from script execution failures.

Previously, when any startup or shutdown scripts failed, the entire agent panel would show warning badges and border colors, incorrectly suggesting agent connectivity issues.

Fixes #26025
Closes DEVEX-437

Changes

site/src/modules/workspaces/health.ts

  • Added getAgentConnectivityIssues() returning only connection-related issues (disconnected, timeout, shutting down, connecting)
  • Added getAgentScriptIssues() returning only script-related issues (exit failure, timed out, pipes left open)
  • Refactored getAgentHealthIssues() to combine both for backward compatibility

site/src/modules/resources/AgentRow.tsx

  • Updated panel border color, warning badge, and alert rendering to use connectivity issues only
  • Script failures remain visible in their dedicated log tabs with error indicators

site/src/modules/workspaces/health.test.ts

  • Added tests for getAgentConnectivityIssues and getAgentScriptIssues
  • Verified separation: connectivity function excludes scripts, script function excludes connectivity
  • Maintained existing getAgentHealthIssues tests

Behavior after fix

Scenario Agent Border Warning Badge Auto-Open Logs Alerts
Connected, script fails Normal (green) None Yes (starts on All Logs, then jumps to first failed script tab) None (tabs show error)
Agent timeout Warning Yes Yes Yes
Agent disconnected Warning Yes Yes Yes
Connected, all scripts OK Normal (green) None Yes (All Logs tab) None
Implementation details

The core change splits getAgentHealthIssues() into two focused functions:

  • getAgentConnectivityIssues() for agent panel border/badge/alert decisions
  • getAgentScriptIssues() for script tab error indicators

getAgentHealthIssues() remains as a composition of both for any callers needing the full picture.

Logs auto-open whenever lifecycle_state !== "ready" (including start_error). The default tab is "All Logs"; a separate effect auto-selects the first failed script tab once its output is available.

Generated by Coder Agents

Agent connectivity status should be separate from script execution failures.

Previously, when any startup or shutdown scripts failed, the entire agent panel
would show warning badges and colors, incorrectly suggesting agent connectivity issues.

This change:
- Adds getAgentConnectivityIssues() to return only connection-related issues
- Adds getAgentScriptIssues() to return only script-related issues
- Updates getAgentHealthIssues() to combine both types for complete visibility
- Updates AgentRow to use connectivity issues only for panel styling and warnings
- Script failures remain visible in their dedicated script tabs with error indicators

Fixes coder#26025
- Remove unused healthIssues variable and getAgentHealthIssues import from AgentRow
- Replace remaining hasAgentIssues reference with hasConnectivityIssues
- Update AgentStatus to show ready dot for start_error and start_timeout
- Remove unused StartTimeoutLifecycle and StartErrorLifecycle components
- Update border classes to show success for start_error and start_timeout
- Fix comment in AgentRow.stories.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent health should not show unhealthy and warning when the problem is with only scripts

1 participant