From 4352f368cb174e780b96529f9d602c0d5afbb3d6 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 04:08:47 +0000 Subject: [PATCH] Guard nil confirm card in surface action dispatcher Why: Committed button actions with no HITL card panicked on resp.Card.ID during prod acceptance (nil pointer). Evidence: go test ./internal/app/ ./internal/surfacesvc/; prod panic stack Impact: B-class help/intent and C-class submit return without crash. Refs: GenUI prod deploy acceptance Co-authored-by: Cursor --- internal/app/app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/app/app.go b/internal/app/app.go index a1a1bb1..46ce5a1 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -535,7 +535,11 @@ func Run(opt Options) error { if resp.Receipt.State != "" { state = string(resp.Receipt.State) } - return surfacesvc.ActionOutcome{State: state, CardID: resp.Card.ID, Receipt: resp.Receipt, Payload: resp.Payload}, nil + cardID := "" + if resp.Card != nil { + cardID = string(resp.Card.ID) + } + return surfacesvc.ActionOutcome{State: state, CardID: cardID, Receipt: resp.Receipt, Payload: resp.Payload}, nil }) // U3:generative-ui 工具注入闸——activation 台账关闭时命令不投影给该 owner // 的模型(禁用即不注入能力;执行端守卫仍在 surfacesvc)。