Skip to content

fix(app): allow door to open when releasing latch and home gantry axes when launching ER for stacker #19153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions api/src/opentrons/protocol_engine/state/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import enum
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, Union, Tuple
from typing_extensions import assert_never

from opentrons_shared_data.errors import EnumeratedError, ErrorCodes, PythonException
Expand All @@ -21,6 +21,12 @@
from opentrons.protocol_engine.commands.unsafe.unsafe_ungrip_labware import (
UnsafeUngripLabwareCommandType,
)
from opentrons.protocol_engine.commands.unsafe.unsafe_stacker_close_latch import (
UnsafeFlexStackerCloseLatchCommandType,
)
from opentrons.protocol_engine.commands.unsafe.unsafe_stacker_open_latch import (
UnsafeFlexStackerOpenLatchCommandType,
)
from opentrons.protocol_engine.error_recovery_policy import (
ErrorRecoveryPolicy,
ErrorRecoveryType,
Expand Down Expand Up @@ -1137,8 +1143,16 @@ def _may_run_with_door_open(
# is probably a mistake in the caller's logic.
assert fixit_command.intent == CommandIntent.FIXIT

# This type annotation is to make sure the string constant stays in sync and isn't typo'd.
required_command_type: UnsafeUngripLabwareCommandType = "unsafe/ungripLabware"
# These type annotations are to make sure the string constants stay in sync and aren't typo'd.
allowed_command_types: Tuple[
UnsafeUngripLabwareCommandType,
UnsafeFlexStackerCloseLatchCommandType,
UnsafeFlexStackerOpenLatchCommandType,
] = (
"unsafe/ungripLabware",
"unsafe/flexStacker/closeLatch",
"unsafe/flexStacker/openLatch",
)
# todo(mm, 2024-10-04): Instead of allowlisting command types, maybe we should
# add a `mayRunWithDoorOpen: bool` field to command requests.
return fixit_command.commandType == required_command_type
return fixit_command.commandType in allowed_command_types
10 changes: 8 additions & 2 deletions app/src/atoms/SoftwareKeyboard/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
padding: 5px;
border-radius: 5px;
background-color: #ececec;
font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue,
Helvetica, Arial, Lucida Grande, sans-serif;
font-family:
HelveticaNeue-Light,
Helvetica Neue Light,
Helvetica Neue,
Helvetica,
Arial,
Lucida Grande,
sans-serif;
touch-action: manipulation;
-webkit-user-select: none;
-moz-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export function ErrorRecoveryContent(props: RecoveryContentProps): JSX.Element {
case RECOVERY_MAP.ROBOT_PICKING_UP_TIPS.ROUTE:
case RECOVERY_MAP.ROBOT_SKIPPING_STEP.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE:
case RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE:
return buildRecoveryInProgress()
case RECOVERY_MAP.ROBOT_DOOR_OPEN.ROUTE:
return buildManuallyRouteToDoorOpen()
Expand Down
6 changes: 3 additions & 3 deletions app/src/organisms/ErrorRecoveryFlows/RecoveryDoorOpen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function RecoveryDoorOpen({
case RECOVERY_MAP.STACKER_STALLED_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE:
case RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE:
return t('stacker_door_open_robot_home')
default:
return t('close_the_robot_door')
Expand All @@ -80,7 +80,7 @@ export function RecoveryDoorOpen({
case RECOVERY_MAP.STACKER_STALLED_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE:
case RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE:
return t('close_robot_and_stacker_door')
default:
return t('robot_door_is_open')
Expand All @@ -96,7 +96,7 @@ export function RecoveryDoorOpen({
case RECOVERY_MAP.STACKER_STALLED_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.ROUTE:
case RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE:
case RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE:
return t('continue')
default:
return t('resume')
Expand Down
23 changes: 7 additions & 16 deletions app/src/organisms/ErrorRecoveryFlows/RecoveryInProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function RecoveryInProgress({
ROBOT_PICKING_UP_TIPS,
ROBOT_SKIPPING_STEP,
ROBOT_RELEASING_LABWARE,
ROBOT_RELEASING_LABWARE_LATCH,
STACKER_RELEASING_LABWARE_LATCH,
} = RECOVERY_MAP
const { t } = useTranslation('error_recovery')
const { route } = recoveryMap
Expand Down Expand Up @@ -68,7 +68,7 @@ export function RecoveryInProgress({
return t('gripper_releasing_labware')
}
}
case ROBOT_RELEASING_LABWARE_LATCH.ROUTE: {
case STACKER_RELEASING_LABWARE_LATCH.ROUTE: {
if (releaseCountdown > 0) {
return t('latch_will_release_in_s', {
seconds: releaseCountdown,
Expand Down Expand Up @@ -189,7 +189,7 @@ export function useReleaseLabware({
let intervalId: NodeJS.Timeout | null = null
switch (recoveryMap.route) {
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE.ROUTE:
case RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE:
case RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE:
intervalId = setInterval(() => {
setCountdown(prevCountdown => {
const updatedCountdown = prevCountdown - 1
Expand All @@ -200,21 +200,12 @@ export function useReleaseLabware({
}
if (
recoveryMap.route ===
RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE
RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE
) {
void releaseLabwareLatch().then(() => {
if (isDoorOpen) {
return handleMotionRouting(false).then(() => {
proceedToDoorStep()
})
}

return handleMotionRouting(true)
.then(() => homeExceptPlungers())
.then(() => handleMotionRouting(false))
.then(() => {
proceedToValidNextStep()
})
return handleMotionRouting(false).then(() => {
proceedToValidNextStep()
})
})
} else {
void releaseGripperJaws().then(() => {
Expand Down
15 changes: 13 additions & 2 deletions app/src/organisms/ErrorRecoveryFlows/RecoverySplash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
BANNER_TEXT_CONTAINER_STYLE,
BANNER_TEXT_CONTENT_STYLE,
RECOVERY_MAP,
STACKER_ERROR_KINDS,
} from './constants'
import { useErrorName } from './hooks'
import { RecoveryInterventionModal, StepInfo } from './shared'
Expand Down Expand Up @@ -94,6 +95,8 @@ export function RecoverySplash(props: RecoverySplashProps): JSX.Element | null {
const { proceedToRouteAndStep, handleMotionRouting } = routeUpdateActions
const { reportErrorEvent } = analytics

const isStackerError = STACKER_ERROR_KINDS.includes(errorKind)

const buildTitleHeadingDesktop = (): JSX.Element => {
return (
<StyledText desktopStyle="bodyLargeSemiBold">
Expand Down Expand Up @@ -148,8 +151,16 @@ export function RecoverySplash(props: RecoverySplashProps): JSX.Element | null {
)
})
.then(() => handleMotionRouting(true))
.then(() => recoveryCommands.homePipetteZAxes())
.finally(() => handleMotionRouting(false))
.then(() => {
if (isStackerError) {
return recoveryCommands.homeExceptPlungers()
} else {
return recoveryCommands.homePipetteZAxes()
}
})
.finally(() => {
void handleMotionRouting(false)
})
}
handleConditionalClick(onClick)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('RecoveryDoorOpen', () => {
RECOVERY_MAP.STACKER_STALLED_SKIP.ROUTE,
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.ROUTE,
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.ROUTE,
RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE,
]

// Routes that should return the door open text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('RecoveryInProgress', () => {
ROBOT_PICKING_UP_TIPS,
ROBOT_SKIPPING_STEP,
ROBOT_RELEASING_LABWARE,
ROBOT_RELEASING_LABWARE_LATCH,
STACKER_RELEASING_LABWARE_LATCH,
} = RECOVERY_MAP
let props: ComponentProps<typeof RecoveryInProgress>

Expand Down Expand Up @@ -137,12 +137,12 @@ describe('RecoveryInProgress', () => {
screen.getByText('Gripper will release labware in 3 seconds')
})

it(`renders appropriate copy when the route is ${ROBOT_RELEASING_LABWARE_LATCH.ROUTE}`, () => {
it(`renders appropriate copy when the route is ${STACKER_RELEASING_LABWARE_LATCH.ROUTE}`, () => {
props = {
...props,
recoveryMap: {
route: ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
step: ROBOT_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
route: STACKER_RELEASING_LABWARE_LATCH.ROUTE,
step: STACKER_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
},
}
render(props)
Expand Down Expand Up @@ -181,8 +181,8 @@ describe('RecoveryInProgress', () => {
props = {
...props,
recoveryMap: {
route: ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
step: ROBOT_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
route: STACKER_RELEASING_LABWARE_LATCH.ROUTE,
step: STACKER_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
},
}
render(props)
Expand Down Expand Up @@ -266,12 +266,12 @@ describe('useReleaseLabware', () => {
},
{
recoveryOption: RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.ROUTE,
currentRoute: RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
currentRoute: RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE,
nextStep: RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.STEPS.REENGAGE_LATCH,
},
{
recoveryOption: RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.ROUTE,
currentRoute: RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
currentRoute: RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE,
nextStep: RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.STEPS.REENGAGE_LATCH,
},
])(
Expand Down Expand Up @@ -312,11 +312,11 @@ describe('useReleaseLabware', () => {
break
default:
expect(releaseGripperJaws).toHaveBeenCalledTimes(1)
expect(handleMotionRouting).toHaveBeenNthCalledWith(1, true)
expect(homeExceptPlungers).toHaveBeenCalledTimes(1)
expect(handleMotionRouting).toHaveBeenNthCalledWith(2, false)
break
}
expect(handleMotionRouting).toHaveBeenNthCalledWith(1, true)
expect(homeExceptPlungers).toHaveBeenCalledTimes(1)
expect(handleMotionRouting).toHaveBeenNthCalledWith(2, false)
expect(proceedToRouteAndStep).toHaveBeenCalledWith(
recoveryOption,
nextStep
Expand Down
23 changes: 13 additions & 10 deletions app/src/organisms/ErrorRecoveryFlows/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export const RECOVERY_MAP = {
RELEASING_LABWARE: 'releasing-labware',
},
},
ROBOT_RELEASING_LABWARE_LATCH: {
ROUTE: 'robot-releasing-labware-latch',
STACKER_RELEASING_LABWARE_LATCH: {
ROUTE: 'stacker-releasing-labware-latch',
STEPS: {
RELEASING_LABWARE_LATCH: 'releasing-labware-latch',
},
Expand Down Expand Up @@ -327,7 +327,7 @@ const {
ROBOT_CANCELING,
ROBOT_PICKING_UP_TIPS,
ROBOT_RELEASING_LABWARE,
ROBOT_RELEASING_LABWARE_LATCH,
STACKER_RELEASING_LABWARE_LATCH,
ROBOT_RESUMING,
ROBOT_IN_MOTION,
ROBOT_RETRYING_STEP,
Expand Down Expand Up @@ -381,8 +381,8 @@ export const STEP_ORDER: StepOrder = {
[ROBOT_RELEASING_LABWARE.ROUTE]: [
ROBOT_RELEASING_LABWARE.STEPS.RELEASING_LABWARE,
],
[ROBOT_RELEASING_LABWARE_LATCH.ROUTE]: [
ROBOT_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
[STACKER_RELEASING_LABWARE_LATCH.ROUTE]: [
STACKER_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
],
[ROBOT_RESUMING.ROUTE]: [ROBOT_RESUMING.STEPS.RESUMING],
[ROBOT_RETRYING_STEP.ROUTE]: [ROBOT_RETRYING_STEP.STEPS.RETRYING],
Expand Down Expand Up @@ -541,9 +541,9 @@ export const RECOVERY_MAP_METADATA: RecoveryRouteStepMetadata = {
[ROBOT_RELEASING_LABWARE.ROUTE]: {
[ROBOT_RELEASING_LABWARE.STEPS.RELEASING_LABWARE]: { allowDoorOpen: false },
},
[ROBOT_RELEASING_LABWARE_LATCH.ROUTE]: {
[ROBOT_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH]: {
allowDoorOpen: false,
[STACKER_RELEASING_LABWARE_LATCH.ROUTE]: {
[STACKER_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH]: {
allowDoorOpen: true,
},
},
[ROBOT_RESUMING.ROUTE]: {
Expand Down Expand Up @@ -717,7 +717,7 @@ export const RECOVERY_MAP_METADATA: RecoveryRouteStepMetadata = {
allowDoorOpen: true,
},
[STACKER_SHUTTLE_EMPTY_RETRY.STEPS.PREPARE_TRACK_FOR_HOMING]: {
allowDoorOpen: true,
allowDoorOpen: false,
},
[STACKER_SHUTTLE_EMPTY_RETRY.STEPS.CONFIRM_LABWARE_IN_LATCH]: {
allowDoorOpen: true,
Expand Down Expand Up @@ -809,9 +809,12 @@ export const GRIPPER_MOVE_STEPS: RouteStep[] = [
RECOVERY_MAP.MANUAL_REPLACE_AND_RETRY.STEPS.MANUAL_REPLACE,
]

export const REENGAGE_LATCH_ROUTES: RouteStep[] = [
export const STACKER_LATCH_STEPS: RouteStep[] = [
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.STEPS.RELEASE_FROM_LATCH,
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_SKIP.STEPS.REENGAGE_LATCH,
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.STEPS.RELEASE_FROM_LATCH,
RECOVERY_MAP.STACKER_SHUTTLE_EMPTY_RETRY.STEPS.REENGAGE_LATCH,
STACKER_RELEASING_LABWARE_LATCH.STEPS.RELEASING_LABWARE_LATCH,
]

export const INVALID = 'INVALID' as const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ describe('handleRecoveryOptionAction', () => {
RECOVERY_MAP.ROBOT_DOOR_OPEN.ROUTE,
RECOVERY_MAP.ROBOT_DOOR_OPEN_SPECIAL.ROUTE,
RECOVERY_MAP.OPTION_SELECTION.ROUTE,
RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE,
RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE,
]

it.each(NEXT_STEP_ROUTES)('should return nextStepReturnVal for %s', route => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
GRIPPER_MOVE_STEPS,
INVALID,
RECOVERY_MAP,
STACKER_LATCH_STEPS,
STEP_ORDER,
} from '../constants'

Expand Down Expand Up @@ -109,10 +110,14 @@ export function useRouteUpdateActions(
)

// If the door is permitted on the current step, but the robot is about to move, we need to manually redirect users
// to the door modal unless the step is specifically a gripper jaw release step.
// to the door modal unless the step is specifically a gripper jaw/stacker latch release step.
const checkDoorStatus = useCallback((): Promise<void> => {
return new Promise((resolve, reject) => {
if (isDoorOpen && !GRIPPER_MOVE_STEPS.includes(currentStep)) {
if (
isDoorOpen &&
!GRIPPER_MOVE_STEPS.includes(currentStep) &&
!STACKER_LATCH_STEPS.includes(currentStep)
) {
stashedMapRef.current = { route: currentRoute, step: currentStep }

setRecoveryMap({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function ReleaseLabware({
case STACKER_SHUTTLE_EMPTY_SKIP.ROUTE:
void handleMotionRouting(
true,
RECOVERY_MAP.ROBOT_RELEASING_LABWARE_LATCH.ROUTE
RECOVERY_MAP.STACKER_RELEASING_LABWARE_LATCH.ROUTE
)
break
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next'
import ReengageLatch from '/app/assets/images/flex_stacker_reengage_latch.png'
import { DescriptionContent, TwoColumn } from '/app/molecules/InterventionModal'

import { RECOVERY_MAP } from '../constants'
import { RecoverySingleColumnContentWrapper } from './RecoveryContentWrapper'
import { RecoveryFooterButtons } from './RecoveryFooterButtons'

Expand All @@ -13,19 +12,12 @@ export function StackerReengageLatch(props: RecoveryContentProps): JSX.Element {
const { t } = useTranslation('error_recovery')

const { routeUpdateActions, recoveryCommands } = props
const {
proceedNextStep,
goBackPrevStep,
handleMotionRouting,
} = routeUpdateActions
const { proceedNextStep, goBackPrevStep } = routeUpdateActions
const { closeLabwareLatch } = recoveryCommands
const { ROBOT_IN_MOTION } = RECOVERY_MAP

const primaryOnClick = (): void => {
void handleMotionRouting(true, ROBOT_IN_MOTION.ROUTE).then(() => {
void closeLabwareLatch().then(() => {
void proceedNextStep()
})
void closeLabwareLatch().then(() => {
void proceedNextStep()
})
}

Expand Down
Loading
Loading