Skip to content

Commit 43b13ca

Browse files
committed
fix(web): a lost operate permission no longer reads as a landed stop
canInterrupt includes the operate permission, so a permission flap during a run looked like the stop had landed. Stop transitions now wait until the permission holds again.
1 parent dea2696 commit 43b13ca

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎apps/web/src/components/chat/ComposerPrimaryActions.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,13 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
114114
onToggleKeepFullHistory,
115115
}: ComposerPrimaryActionsProps) {
116116
const [stopPhase, setStopPhase] = useState<"pending" | "timedOut" | "landed" | null>(null);
117-
// Once the stop has landed, interruptible again means a new run started.
118-
if ((stopPhase === "pending" || stopPhase === "timedOut") && !canInterrupt)
119-
setStopPhase("landed");
120-
else if (stopPhase === "landed" && canInterrupt) setStopPhase(null);
117+
// canInterrupt includes the operate permission, so only read it as run state while that
118+
// permission holds. Once the stop has landed, interruptible again means a new run started.
119+
if (canOperateThread) {
120+
if ((stopPhase === "pending" || stopPhase === "timedOut") && !canInterrupt)
121+
setStopPhase("landed");
122+
else if (stopPhase === "landed" && canInterrupt) setStopPhase(null);
123+
}
121124
const isStopping = stopPhase === "pending" || stopPhase === "landed";
122125
useEffect(() => {
123126
if (stopPhase !== "pending") return;

0 commit comments

Comments
 (0)