Skip to content

Conversation

@mlhiter
Copy link
Member

@mlhiter mlhiter commented Dec 30, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 30, 2025 04:08
@mlhiter mlhiter requested a review from a team as a code owner December 30, 2025 04:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where devboxes could have an undefined status when devbox.status.phase doesn't match any key in the devboxStatusMap. The fix adds a fallback to devboxStatusMap.Error using the nullish coalescing operator.

Key changes:

  • Added fallback status handling in adaptDevboxListItemV2 function
  • Added fallback status handling in adaptDevboxDetailV2 function

template,
remark: devbox.metadata?.annotations?.[devboxRemarkKey] || '',
status: devboxStatusMap[devbox.status.phase], // use devbox.status.phase to get status
status: devboxStatusMap[devbox.status.phase] || devboxStatusMap.Error, // use devbox.status.phase to get status
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent fallback status handling: This code defaults to devboxStatusMap.Error when the phase is unknown, but in frontend/providers/devbox/app/api/v1/getDevboxDetail/route.ts (lines 55-57), a similar pattern defaults to devboxStatusMap.Pending. Since devboxStatusMap.Error is actually mapped to display as "Pending" in the UI (see constants/devbox.ts line 132), consider using devboxStatusMap.Pending directly for consistency across the codebase, or document why different fallbacks are needed in different contexts.

Suggested change
status: devboxStatusMap[devbox.status.phase] || devboxStatusMap.Error, // use devbox.status.phase to get status
status: devboxStatusMap[devbox.status.phase] || devboxStatusMap.Pending, // use devbox.status.phase to get status

Copilot uses AI. Check for mistakes.
@zjy365 zjy365 added this to the v5.2 milestone Dec 30, 2025
@zjy365 zjy365 merged commit b2b345c into labring:main Dec 30, 2025
20 checks passed
@mlhiter mlhiter deleted the fix/status-bug branch December 30, 2025 06:25
mlhiter added a commit to mlhiter/sealos that referenced this pull request Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants