Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Carry live approval lifecycle into Assistant handoffs

rcourtman7aaf76d03cec
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index ba3165443d..a211f3c25a 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -1010,7 +1010,11 @@ Assistant finding handoffs may include a model-only operator briefing from
Patrol's unified finding and structured investigation record. Lifecycle-adjacent
setup, install, and fleet surfaces may treat that briefing as adjacent
AI/runtime guidance only; it must not become agent readiness, install status,
-or lifecycle execution authority.
+or lifecycle execution authority. When that briefing includes recovered
+approval lifecycle metadata, action plan identity, approval policy, or dry-run
+posture, those fields remain Assistant review context and must not be treated
+as an agent command grant, enrollment state, update readiness, or fleet-control
+decision.
That same shared dependency now also assumes hosted cloud handoff authorizes
tenant org access before browser lifecycle continues. Lifecycle-adjacent opens
into hosted workspaces may depend on `internal/api/cloud_handoff_handlers.go`,
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 87abaeb958..c7e42d795f 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -255,12 +255,13 @@ runtime cost control, and shared AI transport surfaces.
approval or execution authority, and must route any operator decision back
through the governed approval/remediation flow. The operator briefing's
decision and action-posture text must derive from those same structured
- action references after live-approval recovery, so Assistant does not tell
- the operator that no governed action is ready while a recovered approval is
- present. When those references include an approval ID, Assistant runtime may
- refresh a current status snapshot from the canonical approval store on each
- turn, but it must enforce org scoping and still omit the approval command
- payload.
+ action references after live-approval recovery, including safe current
+ status, request/expiry timestamps, approval policy, action plan identity,
+ plan expiry, and dry-run posture, so Assistant does not tell the operator
+ that no governed action is ready while a recovered approval is present.
+ When those references include an approval ID, Assistant runtime may refresh
+ a current status snapshot from the canonical approval store on each turn,
+ but it must enforce org scoping and still omit the approval command payload.
When those references resolve to a governed action plan or action audit,
Assistant runtime must hydrate the canonical action ID, lifecycle state,
requester, capability, approval policy, plan expiry, preflight/dry-run
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index fe912fedbc..f56ab2a2f0 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -321,8 +321,9 @@ the canonical monitored-system blocked payload.
references may use the current live Patrol investigation-fix approval for
the finding when that approval is newer than the approval ID on the durable
record, but the payload may carry only IDs, status/risk/target metadata,
- safe generated approval summaries, command counts, and fix/action
- references, never the approval command payload. Patrol
+ request/expiry timestamps, action plan identity and expiry, safe generated
+ approval summaries, command counts, and fix/action references, never the
+ approval command payload. Patrol
remediation-plan handoffs must use the same boundary for frontend-authored
prompts: plan status, risk, step labels, and command counts are allowed,
while raw command and rollback command payloads remain in governed action
@@ -887,12 +888,14 @@ the canonical monitored-system blocked payload.
context payloads. Chat execution may refresh approval status snapshots for
those references from the canonical approval store, but that snapshot is
read-only, org-scoped, and must not expose or infer the raw command. When the
- API handoff builder recovers a live approval, the model-only operator
- briefing must use that recovered action reference for operator-decision and
+ API handoff builder recovers a live approval, the first model-only operator
+ briefing and structured handoff action must use that recovered approval's
+ safe lifecycle metadata, request/expiry timestamps, action plan identity,
+ approval policy, plan expiry, and dry-run posture for operator-decision and
action-posture text instead of falling back to stale investigation-record
approval posture. When the reference resolves to a governed action plan or
- action audit, chat execution must hydrate the canonical action ID, lifecycle state,
- requester, capability, approval policy, plan expiry, preflight/dry-run
+ action audit, chat execution must hydrate the canonical action ID, lifecycle
+ state, requester, capability, approval policy, plan expiry, preflight/dry-run
summary, and terminal success/failure state from the action-audit store so
API consumers do not mistake the original approval snapshot for current
action truth. That action-audit snapshot remains model-only review context
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 071a54add9..c9c6dc5417 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -104,10 +104,11 @@ Patrol-specific presentation helpers.
including the rule that proposed-fix commands are summarized by count only
and never rendered as raw command text in the handoff surface. When Patrol
hands a pending fix or approval into Assistant, the shared handoff may retain
- only structured action references such as approval ID, fix ID, risk, target,
- and resource identity; approval and execution authority stays with the
- governed approval/remediation surfaces. Assistant may refresh the referenced
- approval's current status for review, and the backend handoff builder may
+ only structured action references such as approval ID, status, request/expiry
+ timestamps, action plan identity, fix ID, risk, target, and resource
+ identity; approval and execution authority stays with the governed
+ approval/remediation surfaces. Assistant may refresh the referenced
+ approval's current status for review, and the backend handoff builder must
recover a live pending Patrol investigation-fix approval by finding ID when
the durable record lacks the current approval reference, but Patrol
presentation must still keep command payloads inside governed
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 110b97ecd9..ae6e8af5a5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -1078,9 +1078,11 @@ contract from chat or alert investigation ingress.
Assistant operator-decision and action-posture briefing text assembled from
recovered Patrol handoff action references is also AI/runtime review context
only. Storage and recovery may consume that explanation as incident context,
-but they must not reinterpret a recovered approval or clearer proposed-fix
-posture as backup freshness, restore authority, recovery proof, or
-storage-local remediation execution state.
+including safe approval status, request/expiry timestamps, action plan identity,
+approval policy, plan expiry, and dry-run posture, but they must not reinterpret
+a recovered approval or clearer proposed-fix posture as backup freshness,
+restore authority, recovery proof, or storage-local remediation execution
+state.
That same storage ownership also includes the shared storage-source presentation
contract in `frontend-modern/src/utils/storageSources.ts`: storage pages and
cross-surface storage links must reuse one canonical ordering, label, tone, and
diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.go
index e49b4f2e63..4e445a2e2c 100644
--- a/internal/ai/chat/service.go
+++ b/internal/ai/chat/service.go
@@ -1355,26 +1355,7 @@ func refreshHandoffActionStatus(handoffActions []HandoffAction, orgID string, ac
if approvalID != "" && store != nil {
req, ok := store.GetApproval(approvalID)
if ok && approval.BelongsToOrg(req, normalizedOrgID) {
- actions[idx].ApprovalStatus = string(req.Status)
- actions[idx].ApprovalRequestedAt = formatHandoffActionTime(req.RequestedAt)
- actions[idx].ApprovalExpiresAt = formatHandoffActionTime(req.ExpiresAt)
- if req.DecidedAt != nil {
- actions[idx].ApprovalDecidedAt = formatHandoffActionTime(*req.DecidedAt)
- }
- actions[idx].ApprovalConsumed = req.Consumed
- if strings.TrimSpace(actions[idx].RiskLevel) == "" {
- actions[idx].RiskLevel = string(req.RiskLevel)
- }
- if strings.TrimSpace(actions[idx].TargetResourceID) == "" {
- actions[idx].TargetResourceID = strings.TrimSpace(req.TargetID)
- }
- if strings.TrimSpace(actions[idx].TargetResourceName) == "" {
- actions[idx].TargetResourceName = strings.TrimSpace(req.TargetName)
- }
- if strings.TrimSpace(actions[idx].TargetResourceType) == "" {
- actions[idx].TargetResourceType = strings.TrimSpace(req.TargetType)
- }
- hydrateHandoffActionPlan(&actions[idx], req.Plan)
+ HydrateHandoffActionFromApproval(&actions[idx], req)
}
}
hydrateHandoffActionAudit(&actions[idx], actionStore)
@@ -1404,6 +1385,38 @@ func clearHandoffActionStatus(action *HandoffAction) {
action.ActionResult = ""
}
+// HydrateHandoffActionFromApproval copies non-command approval metadata into an
+// Assistant handoff action. It deliberately excludes ApprovalRequest.Command so
+// Assistant context can explain governed state without becoming command replay.
+func HydrateHandoffActionFromApproval(action *HandoffAction, req *approval.ApprovalRequest) {
+ if action == nil || req == nil {
+ return
+ }
+ if approvalID := strings.TrimSpace(req.ID); approvalID != "" {
+ action.ApprovalID = approvalID
+ }
+ action.ApprovalStatus = strings.TrimSpace(string(req.Status))
+ action.ApprovalRequestedAt = formatHandoffActionTime(req.RequestedAt)
+ action.ApprovalExpiresAt = formatHandoffActionTime(req.ExpiresAt)
+ if req.DecidedAt != nil {
+ action.ApprovalDecidedAt = formatHandoffActionTime(*req.DecidedAt)
+ }
+ action.ApprovalConsumed = req.Consumed
+ if strings.TrimSpace(action.RiskLevel) == "" {
+ action.RiskLevel = strings.TrimSpace(string(req.RiskLevel))
+ }
+ if strings.TrimSpace(action.TargetResourceID) == "" {
+ action.TargetResourceID = strings.TrimSpace(req.TargetID)
+ }
+ if strings.TrimSpace(action.TargetResourceName) == "" {
+ action.TargetResourceName = strings.TrimSpace(req.TargetName)
+ }
+ if strings.TrimSpace(action.TargetResourceType) == "" {
+ action.TargetResourceType = strings.TrimSpace(req.TargetType)
+ }
+ hydrateHandoffActionPlan(action, req.Plan)
+}
+
func hydrateHandoffActionPlan(action *HandoffAction, plan *unifiedresources.ActionPlan) {
if action == nil || plan == nil {
return
diff --git a/internal/ai/chat/service_execute_additional_test.go b/internal/ai/chat/service_execute_additional_test.go
index e73ce6fe9f..44ad852572 100644
--- a/internal/ai/chat/service_execute_additional_test.go
+++ b/internal/ai/chat/service_execute_additional_test.go
@@ -103,6 +103,69 @@ func testHandoffActionPlan(now time.Time) unifiedresources.ActionPlan {
}
}
+func TestHydrateHandoffActionFromApprovalCopiesSafeLifecycleMetadata(t *testing.T) {
+ requestedAt := time.Date(2026, 5, 6, 12, 0, 0, 0, time.UTC)
+ expiresAt := requestedAt.Add(10 * time.Minute)
+ decidedAt := requestedAt.Add(2 * time.Minute)
+ planExpiresAt := requestedAt.Add(5 * time.Minute)
+
+ action := HandoffAction{FindingID: "finding-123"}
+ HydrateHandoffActionFromApproval(&action, &approval.ApprovalRequest{
+ ID: "approval-123",
+ Command: "systemctl restart workload.service",
+ TargetType: "vm",
+ TargetID: "vm-100",
+ TargetName: "web-server",
+ RiskLevel: approval.RiskHigh,
+ Status: approval.StatusApproved,
+ RequestedAt: requestedAt,
+ ExpiresAt: expiresAt,
+ DecidedAt: &decidedAt,
+ Consumed: true,
+ Plan: &unifiedresources.ActionPlan{
+ ActionID: "action-123",
+ RequiresApproval: true,
+ ApprovalPolicy: unifiedresources.ApprovalAdmin,
+ Message: "Restart after the backup window clears.",
+ ExpiresAt: planExpiresAt,
+ Preflight: &unifiedresources.ActionPreflight{
+ IntendedChange: "Restart workload service",
+ DryRunSummary: "No provider-supported dry run is available for this action.",
+ },
+ },
+ })
+
+ if action.ApprovalID != "approval-123" || action.ApprovalStatus != "approved" || !action.ApprovalConsumed {
+ t.Fatalf("approval lifecycle was not hydrated: %#v", action)
+ }
+ if action.ApprovalRequestedAt != requestedAt.Format(time.RFC3339) ||
+ action.ApprovalExpiresAt != expiresAt.Format(time.RFC3339) ||
+ action.ApprovalDecidedAt != decidedAt.Format(time.RFC3339) {
+ t.Fatalf("approval timestamps were not hydrated: %#v", action)
+ }
+ if action.ActionID != "action-123" ||
+ action.ActionApprovalPolicy != "admin" ||
+ !action.ActionRequiresApproval ||
+ action.ActionPlanExpiresAt != planExpiresAt.Format(time.RFC3339) {
+ t.Fatalf("action plan metadata was not hydrated: %#v", action)
+ }
+ if action.RiskLevel != "high" ||
+ action.TargetResourceID != "vm-100" ||
+ action.TargetResourceName != "web-server" ||
+ action.TargetResourceType != "vm" {
+ t.Fatalf("approval target metadata was not hydrated: %#v", action)
+ }
+ safeContext := strings.Join([]string{
+ action.ActionPlanMessage,
+ action.ActionPreflight,
+ action.ActionDryRunSummary,
+ action.Description,
+ }, " ")
+ if strings.Contains(safeContext, "systemctl restart workload.service") {
+ t.Fatalf("approval command leaked into handoff action: %#v", action)
+ }
+}
+
func seedHandoffActionAudit(t *testing.T, store unifiedresources.ResourceStore, plan unifiedresources.ActionPlan, state unifiedresources.ActionState, result *unifiedresources.ExecutionResult) {
t.Helper()
if store == nil {
diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.go
index 69658779b5..c4a3d473de 100644
--- a/internal/api/ai_handler.go
+++ b/internal/api/ai_handler.go
@@ -1566,9 +1566,24 @@ func unifiedFindingHandoffActionOperatorDecision(action chat.HandoffAction) stri
if status := strings.TrimSpace(action.ApprovalStatus); status != "" {
parts = append(parts, "approval status "+status)
}
+ if expiresAt := strings.TrimSpace(action.ApprovalExpiresAt); expiresAt != "" {
+ parts = append(parts, "approval expires "+expiresAt)
+ }
+ if action.ApprovalConsumed {
+ parts = append(parts, "approval consumed true")
+ }
+ if actionID := strings.TrimSpace(action.ActionID); actionID != "" && strings.TrimSpace(action.ApprovalID) != "" {
+ parts = append(parts, "action "+actionID)
+ }
if state := strings.TrimSpace(action.ActionState); state != "" {
parts = append(parts, "action state "+state)
}
+ if policy := strings.TrimSpace(action.ActionApprovalPolicy); policy != "" {
+ parts = append(parts, "approval policy "+policy)
+ }
+ if planExpiresAt := strings.TrimSpace(action.ActionPlanExpiresAt); planExpiresAt != "" {
+ parts = append(parts, "plan expires "+planExpiresAt)
+ }
if fixID := strings.TrimSpace(action.FixID); fixID != "" {
parts = append(parts, "proposed fix "+fixID)
} else if description := strings.TrimSpace(action.Description); description != "" {
@@ -1591,6 +1606,15 @@ func unifiedFindingHandoffActionPosture(action chat.HandoffAction) string {
if status := strings.TrimSpace(action.ApprovalStatus); status != "" {
parts = append(parts, "approval status "+status)
}
+ if requestedAt := strings.TrimSpace(action.ApprovalRequestedAt); requestedAt != "" {
+ parts = append(parts, "approval requested "+requestedAt)
+ }
+ if expiresAt := strings.TrimSpace(action.ApprovalExpiresAt); expiresAt != "" {
+ parts = append(parts, "approval expires "+expiresAt)
+ }
+ if decidedAt := strings.TrimSpace(action.ApprovalDecidedAt); decidedAt != "" {
+ parts = append(parts, "approval decided "+decidedAt)
+ }
if action.ApprovalConsumed {
parts = append(parts, "approval consumed true")
}
@@ -1600,6 +1624,15 @@ func unifiedFindingHandoffActionPosture(action chat.HandoffAction) string {
if state := strings.TrimSpace(action.ActionState); state != "" {
parts = append(parts, "action state "+state)
}
+ if policy := strings.TrimSpace(action.ActionApprovalPolicy); policy != "" {
+ parts = append(parts, "approval policy "+policy)
+ }
+ if action.ActionRequiresApproval {
+ parts = append(parts, "action requires approval true")
+ }
+ if planExpiresAt := strings.TrimSpace(action.ActionPlanExpiresAt); planExpiresAt != "" {
+ parts = append(parts, "plan expires "+planExpiresAt)
+ }
if fixID := strings.TrimSpace(action.FixID); fixID != "" {
parts = append(parts, "proposed fix "+fixID)
} else if description := strings.TrimSpace(action.Description); description != "" {
@@ -1843,15 +1876,16 @@ func buildUnifiedFindingHandoffActions(f *unified.UnifiedFinding, orgID string)
action.TargetNode = firstNonEmptyString(rec.Subject.Node, action.TargetNode)
}
if liveApproval != nil {
- action.ApprovalID = strings.TrimSpace(liveApproval.ID)
- if risk := strings.TrimSpace(string(liveApproval.RiskLevel)); risk != "" {
- action.RiskLevel = risk
- }
- if action.TargetResourceName == "" {
- action.TargetResourceName = strings.TrimSpace(liveApproval.TargetName)
- }
- if action.TargetResourceType == "" && !strings.EqualFold(strings.TrimSpace(liveApproval.TargetID), strings.TrimSpace(f.ID)) {
- action.TargetResourceType = strings.TrimSpace(liveApproval.TargetType)
+ targetResourceIDBeforeApproval := strings.TrimSpace(action.TargetResourceID)
+ targetResourceTypeBeforeApproval := strings.TrimSpace(action.TargetResourceType)
+ chat.HydrateHandoffActionFromApproval(&action, liveApproval)
+ if liveTargetID := strings.TrimSpace(liveApproval.TargetID); liveTargetID != "" && strings.EqualFold(liveTargetID, strings.TrimSpace(f.ID)) {
+ if targetResourceIDBeforeApproval == "" && strings.EqualFold(strings.TrimSpace(action.TargetResourceID), liveTargetID) {
+ action.TargetResourceID = ""
+ }
+ if targetResourceTypeBeforeApproval == "" && strings.EqualFold(strings.TrimSpace(action.TargetResourceType), strings.TrimSpace(liveApproval.TargetType)) {
+ action.TargetResourceType = ""
+ }
}
}
if rec != nil && rec.ProposedFix != nil {
diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.go
index 9304ba6403..be6c713f8b 100644
--- a/internal/api/ai_handler_test.go
+++ b/internal/api/ai_handler_test.go
@@ -877,7 +877,8 @@ func TestHandleChat_RecoversLivePatrolApprovalForFindingHandoffAction(t *testing
approval.SetStore(prevStore)
})
- assert.NoError(t, approvalStore.CreateApproval(&approval.ApprovalRequest{
+ planExpiresAt := time.Date(2026, 5, 6, 12, 9, 0, 0, time.UTC)
+ liveApproval := &approval.ApprovalRequest{
ID: "approval-live",
ToolID: "investigation_fix",
Command: "systemctl restart workload.service",
@@ -886,7 +887,22 @@ func TestHandleChat_RecoversLivePatrolApprovalForFindingHandoffAction(t *testing
TargetName: "web-server",
Context: "Restart the workload service after backup saturation clears.",
RiskLevel: approval.RiskHigh,
- }))
+ Plan: &unifiedresources.ActionPlan{
+ ActionID: "action-live",
+ RequiresApproval: true,
+ ApprovalPolicy: unifiedresources.ApprovalAdmin,
+ Message: "Restart the workload service after backup saturation clears.",
+ ExpiresAt: planExpiresAt,
+ Preflight: &unifiedresources.ActionPreflight{
+ IntendedChange: "Restart workload service",
+ DryRunSummary: "No provider-supported dry run is available for this action.",
+ },
+ },
+ }
+ assert.NoError(t, approvalStore.CreateApproval(liveApproval))
+ approvalRequestedAt := liveApproval.RequestedAt.UTC().Format(time.RFC3339)
+ approvalExpiresAt := liveApproval.ExpiresAt.UTC().Format(time.RFC3339)
+ actionPlanExpiresAt := liveApproval.Plan.ExpiresAt.UTC().Format(time.RFC3339)
detectedAt := time.Date(2026, 5, 6, 12, 0, 0, 0, time.UTC)
store := unified.NewUnifiedStore(unified.DefaultAlertToFindingConfig())
@@ -941,21 +957,31 @@ func TestHandleChat_RecoversLivePatrolApprovalForFindingHandoffAction(t *testing
Run(func(args mock.Arguments) {
reqArg := args.Get(1).(chat.ExecuteRequest)
assert.Equal(t, []chat.HandoffAction{{
- FindingID: "finding-123",
- RecordID: "investigation-123",
- ApprovalID: "approval-live",
- FixID: "fix-123",
- Description: "Restart the workload service",
- RiskLevel: "high",
- Destructive: true,
- TargetHost: "pve-1",
- TargetResourceID: "vm-100",
- TargetResourceName: "web-server",
- TargetResourceType: "vm",
- TargetNode: "pve-1",
+ FindingID: "finding-123",
+ RecordID: "investigation-123",
+ ApprovalID: "approval-live",
+ ApprovalStatus: "pending",
+ ApprovalRequestedAt: approvalRequestedAt,
+ ApprovalExpiresAt: approvalExpiresAt,
+ ActionID: "action-live",
+ ActionApprovalPolicy: "admin",
+ ActionRequiresApproval: true,
+ ActionPlanExpiresAt: actionPlanExpiresAt,
+ ActionPlanMessage: "Restart the workload service after backup saturation clears.",
+ ActionPreflight: "Restart workload service",
+ ActionDryRunSummary: "No provider-supported dry run is available for this action.",
+ FixID: "fix-123",
+ Description: "Restart the workload service",
+ RiskLevel: "high",
+ Destructive: true,
+ TargetHost: "pve-1",
+ TargetResourceID: "vm-100",
+ TargetResourceName: "web-server",
+ TargetResourceType: "vm",
+ TargetNode: "pve-1",
}}, reqArg.HandoffActions)
- assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-live before execution; proposed fix fix-123; risk high; destructive true")
- assert.Contains(t, reqArg.HandoffContext, "Action Posture: approval approval-live; proposed fix fix-123; risk high; destructive true")
+ assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-live before execution; approval status pending; approval expires "+approvalExpiresAt+"; action action-live; approval policy admin; plan expires "+actionPlanExpiresAt+"; proposed fix fix-123; risk high; destructive true")
+ assert.Contains(t, reqArg.HandoffContext, "Action Posture: approval approval-live; approval status pending; approval requested "+approvalRequestedAt+"; approval expires "+approvalExpiresAt+"; action action-live; approval policy admin; action requires approval true; plan expires "+actionPlanExpiresAt+"; proposed fix fix-123; risk high; destructive true")
assert.NotContains(t, reqArg.HandoffContext, "Action Posture: proposed fix fix-123; risk medium")
assert.NotContains(t, reqArg.HandoffContext, "systemctl restart workload.service")
assert.NotContains(t, fmt.Sprintf("%#v", reqArg.HandoffActions), "systemctl restart workload.service")
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index a007f00428..3c5731ade1 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -146,6 +146,9 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {
"handoffContext = buildUnifiedFindingChatContext(f, store, handoffActions)",
"handoffResources = buildUnifiedFindingHandoffResources(f, store)",
"livePatrolApprovalForFinding(f.ID, orgID)",
+ "chat.HydrateHandoffActionFromApproval(&action, liveApproval)",
+ "ApprovalRequestedAt",
+ "ApprovalExpiresAt",
"func chatAutonomousModeForFindingHandoff(requested *bool, findingID, handoffContext string, handoffResources []chat.HandoffResource, handoffActions []chat.HandoffAction) *bool",
"AutonomousMode: chatAutonomousModeForFindingHandoff(req.AutonomousMode, findingID, handoffContext, handoffResources, handoffActions)",
`appendChatContextLine(&b, "Finding Status", unifiedFindingChatStatus(f, time.Now()))`,
@@ -218,6 +221,8 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {
"sessions.SetModelHandoffActions(session.ID, handoffActions)",
"sessions.GetModelHandoffActions(session.ID)",
"refreshHandoffActionStatus(handoffActions, s.orgID, s.actionAuditStore)",
+ "HydrateHandoffActionFromApproval(&actions[idx], req)",
+ "func HydrateHandoffActionFromApproval(action *HandoffAction, req *approval.ApprovalRequest)",
"mergeHandoffResourcePolicyContext(handoffContext, handoffResources, handoffResourceProvider)",
"mergeHandoffResourceStateContext(handoffContext, handoffResources, handoffResourceProvider)",
"mergeHandoffResourceRelationshipContext(handoffContext, handoffResources, handoffResourceProvider)",