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.

Restrict Patrol objective recovery scope

rcourtmanfe1f8d758218
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index b4d3d62bb4..4f0cd9871c 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -7272,8 +7272,10 @@ design when necessary, but an unrelated global finding or redundant inventory
search cannot consume the mission or leave a healthy run that never attempted
observer design. If that model-owned turn reaches its output limit before the
proposal call, core discards the partial prose and permits one bounded recovery
-turn with only `patrol_propose_observer`, required tool choice, and the remaining
-fixed run-level token budget. An accepted proposal then closes tool authority;
+turn only when the provider projection is exactly the single
+`patrol_propose_observer` capability, with required tool choice and the remaining
+fixed run-level token budget. Merely having that capability registered beside
+normal Watch tools cannot select this path. An accepted proposal then closes tool authority;
the optional completion turn is prose-only so it cannot duplicate the handoff.
A second truncated turn fails the objective mission closed.
diff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.go
index ad99beb6c2..5989d6e045 100644
--- a/internal/ai/chat/agentic.go
+++ b/internal/ai/chat/agentic.go
@@ -562,19 +562,15 @@ func applyPatrolObjectiveOutputLimitRecoveryRequest(req *providers.ChatRequest,
return false
}
- var proposalTool *providers.Tool
- for i := range availableTools {
- if strings.TrimSpace(availableTools[i].Name) == agentcapabilities.PatrolProposeObserverToolName {
- tool := availableTools[i]
- proposalTool = &tool
- break
- }
- }
- if proposalTool == nil {
+ // The proposal capability is also registered in a normal Watch run when an
+ // objective store exists. Only the dedicated objective mission projects it
+ // as the entire tool set, so exact cardinality is part of the authority
+ // boundary rather than a convenience check.
+ if len(availableTools) != 1 || strings.TrimSpace(availableTools[0].Name) != agentcapabilities.PatrolProposeObserverToolName {
return false
}
- req.Tools = []providers.Tool{*proposalTool}
+ req.Tools = []providers.Tool{availableTools[0]}
req.ToolChoice = &providers.ToolChoice{Type: providers.ToolChoiceRequired}
req.System = patrolObjectiveOutputLimitRecoverySystemPrompt
return true
diff --git a/internal/ai/chat/agentic_additional_test.go b/internal/ai/chat/agentic_additional_test.go
index b1533cd818..08b8b11a30 100644
--- a/internal/ai/chat/agentic_additional_test.go
+++ b/internal/ai/chat/agentic_additional_test.go
@@ -723,6 +723,21 @@ func TestAgenticLoopRecoversTruncatedObjectiveMissionWithProposalOnlyTurn(t *tes
}
}
+func TestPatrolObjectiveOutputLimitRecoveryRejectsMixedWatchTools(t *testing.T) {
+ req := providers.ChatRequest{System: "normal Watch"}
+ available := []providers.Tool{
+ {Name: agentcapabilities.PatrolProposeObserverToolName},
+ {Name: agentcapabilities.PatrolReportFindingToolName},
+ {Name: agentcapabilities.PatrolAssessFindingToolName},
+ }
+ if applyPatrolObjectiveOutputLimitRecoveryRequest(&req, tools.ProfilePatrolDetection, available) {
+ t.Fatal("normal Watch projection was misclassified as an objective-only mission")
+ }
+ if req.System != "normal Watch" || req.ToolChoice != nil {
+ t.Fatalf("rejected mixed projection mutated request: %+v", req)
+ }
+}
+
func TestAgenticLoopFailsClosedAfterRepeatedTruncatedObjectiveRecovery(t *testing.T) {
provider := &stubStreamingProvider{}
executor := tools.NewPulseToolExecutor(tools.ExecutorConfig{})