fix(frontend): render CANCELLED run status instead of crashing the detail page#199
Open
tomny-dev wants to merge 2 commits into
Open
fix(frontend): render CANCELLED run status instead of crashing the detail page#199tomny-dev wants to merge 2 commits into
tomny-dev wants to merge 2 commits into
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Root cause
The backend
AutomationRunStatusenum includesCANCELLED(openhands/automation/models.py), but the frontend was out of sync:frontend/src/types/automation.ts—AutomationRunStatuswas missingCANCELLED.RunStatusBadge—statusConfighad noCANCELLEDentry.So for a cancelled run,
RunStatusBadgeevaluates:Because
statusis cast from the API response without runtime validation, the exhaustiveRecord<AutomationRunStatus, ...>type couldn't catch this frontend/backend drift at compile time.Fix
CANCELLEDto the frontendAutomationRunStatusenum so it matches the backend.CANCELLEDbadge config (neutral style) and icon (reuses thex-circleicon alongsideFAILED).AUTOMATIONS$DETAIL$CANCELLEDi18n strings for all locales.RunStatusBadgetest for the cancelled status.The generated
src/i18n/declaration.ts(gitignored, produced bymake-i18n) picks up the new key automatically duringprelint/build.Testing
node scripts/make-i18n-translations.cjsregeneratesdeclaration.tswithAUTOMATIONS$DETAIL$CANCELLED.<RunStatusBadge status={AutomationRunStatus.CANCELLED} />without throwing.