fix(rectification): keep offer-message defined through next build
Independent Staging Quality Gate / validate (push) Successful in 10m12s
Independent Staging Quality Gate / publish (push) Successful in 13m52s

Boolean() does not narrow find(), so Docker next build failed typecheck on the selection-card key.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-20 01:24:59 +08:00
co-authored by Cursor
parent a732ff4b58
commit 464bc33202
3 changed files with 28 additions and 6 deletions
@@ -549,7 +549,7 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
&& Boolean(message.turnId)
&& Boolean(message.text)
))?.renderKey;
const latestOfferMessageKey = [...messages]
const latestOfferMessage = [...messages]
.reverse()
.find((message) => (
message.role === "assistant"
@@ -559,12 +559,14 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
));
const showSelectionCards = Boolean(
candidateResult?.selectionAllowed
&& latestOfferMessageKey
&& turnOfferedSelection(latestOfferMessageKey)
&& latestOfferMessage
&& turnOfferedSelection(latestOfferMessage)
&& !busy
&& regeneratingMessageKey === null,
);
const selectionCardMessageKey = showSelectionCards ? latestOfferMessageKey.renderKey : undefined;
const selectionCardMessageKey = showSelectionCards && latestOfferMessage
? latestOfferMessage.renderKey
: undefined;
const canSend = !busy && !readonly && !regeneratingMessageKey;
return (