Skip to content

fix(frontend): render CANCELLED run status instead of crashing the detail page#199

Open
tomny-dev wants to merge 2 commits into
OpenHands:mainfrom
tomny-dev:fix/cancelled-run-status-badge
Open

fix(frontend): render CANCELLED run status instead of crashing the detail page#199
tomny-dev wants to merge 2 commits into
OpenHands:mainfrom
tomny-dev:fix/cancelled-run-status-badge

Conversation

@tomny-dev

@tomny-dev tomny-dev commented Jun 19, 2026

Copy link
Copy Markdown

Summary

The automation detail page crashes with Cannot read properties of undefined (reading 'style') whenever an automation has a cancelled run. The automations list page works; only the detail view breaks.

image

Root cause

The backend AutomationRunStatus enum includes CANCELLED (openhands/automation/models.py), but the frontend was out of sync:

  • frontend/src/types/automation.tsAutomationRunStatus was missing CANCELLED.
  • RunStatusBadgestatusConfig had no CANCELLED entry.

So for a cancelled run, RunStatusBadge evaluates:

const config = statusConfig[status]; // statusConfig["CANCELLED"] -> undefined
// ...
className={`... ${config.style}`}    // undefined.style -> throws, gives error screen

Because status is cast from the API response without runtime validation, the exhaustive Record<AutomationRunStatus, ...> type couldn't catch this frontend/backend drift at compile time.

Fix

  • Add CANCELLED to the frontend AutomationRunStatus enum so it matches the backend.
  • Add a CANCELLED badge config (neutral style) and icon (reuses the x-circle icon alongside FAILED).
  • Add the AUTOMATIONS$DETAIL$CANCELLED i18n strings for all locales.
  • Add a RunStatusBadge test for the cancelled status.

The generated src/i18n/declaration.ts (gitignored, produced by make-i18n) picks up the new key automatically during prelint/build.

Testing

  • node scripts/make-i18n-translations.cjs regenerates declaration.ts with AUTOMATIONS$DETAIL$CANCELLED.
  • Added unit test renders <RunStatusBadge status={AutomationRunStatus.CANCELLED} /> without throwing.

… page

The backend AutomationRunStatus enum includes CANCELLED, but the frontend
enum and the RunStatusBadge statusConfig did not. Rendering a cancelled run
on the automation detail page therefore evaluated statusConfig["CANCELLED"]
to undefined and then read `.style` on it, throwing "Cannot read properties
of undefined (reading 'style')" and white-screening the whole page.

Add CANCELLED to the frontend AutomationRunStatus enum so it matches the
backend, give it a badge entry (neutral style + x-circle icon) and i18n
strings, and add a test. The Record<AutomationRunStatus, ...> type now keeps
the badge config exhaustive with the enum.

Signed-off-by: tomny <20028678+tomny-dev@users.noreply.github.com>
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.

1 participant