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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Close the two profile residuals before the proposal slice
rcourtmand274c93c583c
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex e491c8e5f4..e00eee2acb 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -4649,7 +4649,12 @@ tool-only-turn wrap-up guardrail is interactive-profile-owned ratherthan keyed on autonomy. The system prompt describes detection andinvestigation modes directly instead of claiming controlled orautonomous execution. Non-interactive operation grants no mutation-authority. Profile proofs live in+authority. The profile vocabulary is closed: unknown profile values are+rejected at apply time and classify as non-interactive, never as the+permissive interactive default. A blocked question call is persisted to+the durable transcript paired with its refusal result (the assistant+message records the call, so the transcript must never retain an+unanswered call). Profile proofs live in`internal/ai/tools/invocation_policy_test.go` (detection allowlist,investigation structural read-only, profile clone isolation) and`internal/ai/chat/service_tooling_test.go` (profile prompt modes,diff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.goindex a43382f8b8..30bdac3c95 100644--- a/internal/ai/chat/agentic.go+++ b/internal/ai/chat/agentic.go@@ -1234,6 +1234,16 @@ func (a *AgenticLoop) executeWithTools(ctx context.Context, sessionID string, meMsg("[AgenticLoop] Blocked pulse_question in non-interactive execution profile")projection := newProviderToolResultContextProjection(tc.ID,"pulse_question is unavailable: this is a non-interactive run and no user can answer. Continue with the available evidence.", true)+ // Persist the refusal alongside the provider context: the+ // assistant message above already recorded the question+ // call, so the durable transcript must pair it with this+ // result rather than retaining an unanswered call.+ resultMessages = append(resultMessages, Message{+ ID: uuid.New().String(),+ Role: "user",+ Timestamp: time.Now(),+ ToolResult: &projection.Transcript,+ })providerMessages = append(providerMessages, providers.Message{Role: "user",ToolResult: &projection.Model,diff --git a/internal/ai/chat/agentic_control.go b/internal/ai/chat/agentic_control.goindex 12b530dfe3..4304a89220 100644--- a/internal/ai/chat/agentic_control.go+++ b/internal/ai/chat/agentic_control.go@@ -25,6 +25,9 @@ func (a *AgenticLoop) SetAutonomousMode(enabled bool) {// it is deliberately separate from autonomous mode, which only affects// approval waiting and grants no mutation authority.func (a *AgenticLoop) SetExecutionProfile(profile tools.ExecutionProfile) {+ if !profile.Valid() {+ panic("unknown execution profile: profiles are a closed vocabulary and cannot default to interactive permissions")+ }a.mu.Lock()a.executionProfile = profilea.mu.Unlock()diff --git a/internal/ai/chat/service_tooling_test.go b/internal/ai/chat/service_tooling_test.goindex 00983d8137..affcb81045 100644--- a/internal/ai/chat/service_tooling_test.go+++ b/internal/ai/chat/service_tooling_test.go@@ -1085,3 +1085,92 @@ func TestToolsForExecutorHidesQuestionToolForPatrolProfiles(t *testing.T) {t.Fatalf("investigation manifest must keep read tools, got %v", set)}}++func TestNonInteractiveProfileBlocksQuestionPersistsPairAndContinues(t *testing.T) {+ turn := 0+ provider := &stubStreamingProvider{}+ provider.chatStream = func(ctx context.Context, req providers.ChatRequest, callback providers.StreamCallback) error {+ turn+++ switch turn {+ case 1:+ // The model fabricates an interactive question alongside a+ // legitimate read in the same provider turn.+ callback(providers.StreamEvent{Type: "done", Data: providers.DoneEvent{+ ToolCalls: []providers.ToolCall{+ {ID: "q-1", Name: pulseQuestionToolName, Input: map[string]interface{}{"question": "which host?"}},+ {ID: "r-1", Name: "pulse_query", Input: map[string]interface{}{"action": "health"}},+ },+ }})+ default:+ callback(providers.StreamEvent{Type: "content", Data: providers.ContentEvent{Text: "diagnosis complete"}})+ callback(providers.StreamEvent{Type: "done", Data: providers.DoneEvent{}})+ }+ return nil+ }++ exec := tools.NewPulseToolExecutor(tools.ExecutorConfig{+ StateProvider: &mockStateProvider{},+ AgentServer: &mockAgentServer{},+ })+ exec.ApplyExecutionProfile(tools.ProfilePatrolDetection)++ loop := NewAgenticLoop(provider, exec, "base prompt")+ loop.SetExecutionProfile(tools.ProfilePatrolDetection)++ var sawWaiting bool+ messages, err := loop.ExecuteWithTools(+ context.Background(),+ "session-noninteractive",+ []Message{{Role: "user", Content: "investigate"}},+ nil,+ func(event StreamEvent) {+ if strings.Contains(string(event.Data), "Waiting for your answer") {+ sawWaiting = true+ }+ },+ )+ if err != nil {+ t.Fatalf("ExecuteWithTools: %v", err)+ }+ if sawWaiting {+ t.Fatal("non-interactive profile must not emit a waiting-for-answer event")+ }+ if turn < 2 {+ t.Fatalf("inference must continue after the blocked question, provider turns = %d", turn)+ }++ var questionCallSeen, questionResultSeen, queryResultSeen, finalTextSeen bool+ for _, msg := range messages {+ for _, tc := range msg.ToolCalls {+ if tc.Name == pulseQuestionToolName {+ questionCallSeen = true+ }+ }+ if msg.ToolResult != nil {+ switch msg.ToolResult.ToolUseID {+ case "q-1":+ questionResultSeen = true+ if !msg.ToolResult.IsError || !strings.Contains(msg.ToolResult.Content, "non-interactive") {+ t.Fatalf("question result must be a non-interactive error, got %+v", msg.ToolResult)+ }+ case "r-1":+ queryResultSeen = true+ }+ }+ if msg.Role == "assistant" && strings.Contains(msg.Content, "diagnosis complete") {+ finalTextSeen = true+ }+ }+ if !questionCallSeen {+ t.Fatal("persisted transcript must retain the question tool call")+ }+ if !questionResultSeen {+ t.Fatal("persisted transcript must pair the question call with its refusal result")+ }+ if !queryResultSeen {+ t.Fatal("sibling tool call from the same provider turn must still execute")+ }+ if !finalTextSeen {+ t.Fatal("loop must continue to the model's final answer after the blocked question")+ }+}diff --git a/internal/ai/tools/execution_profile.go b/internal/ai/tools/execution_profile.goindex 0be718d0cb..2a77aea71d 100644--- a/internal/ai/tools/execution_profile.go+++ b/internal/ai/tools/execution_profile.go@@ -1,6 +1,8 @@package toolsimport (+ "fmt"+"github.com/rcourtman/pulse-go-rewrite/internal/agentcapabilities")@@ -30,12 +32,27 @@ const (ProfilePatrolInvestigation)+// Valid reports whether the profile is one of the closed set. Like the+// invocation-class vocabulary, execution profiles are a closed+// vocabulary: an unknown value must be rejected, never silently treated+// as the permissive interactive default.+func (p ExecutionProfile) Valid() bool {+ switch p {+ case ProfileInteractiveAssistant, ProfilePatrolDetection, ProfilePatrolInvestigation:+ return true+ default:+ return false+ }+}+// NonInteractive reports whether the profile forbids interactive user// input. This is deliberately independent of autonomous mode: suppressing// questions grants no mutation authority, and mutation policy never-// loosens because a run is interactive.+// loosens because a run is interactive. Unknown profiles are treated as+// non-interactive: an unclassifiable posture must never gain the+// interactive default's permissions.func (p ExecutionProfile) NonInteractive() bool {- return p == ProfilePatrolDetection || p == ProfilePatrolInvestigation+ return p != ProfileInteractiveAssistant}// patrolDetectionPulseStateAllowlist names the only tools whose@@ -53,7 +70,12 @@ func patrolDetectionPulseStateAllowlist() map[string]bool {// instance (normally a request-scoped clone). Both Patrol profiles deny// infrastructure mutations, clear any inherited autonomous mode, and mark// the executor non-interactive; they differ only in pulse-state policy.+// Unknown profiles are rejected outright (panic on programmer error)+// rather than falling through to the interactive default's permissions.func (e *PulseToolExecutor) ApplyExecutionProfile(profile ExecutionProfile) {+ if !profile.Valid() {+ panic(fmt.Sprintf("unknown execution profile %d: profiles are a closed vocabulary and cannot default to interactive permissions", int(profile)))+ }e.executionProfile = profileswitch profile {case ProfilePatrolDetection:diff --git a/internal/ai/tools/invocation_policy_test.go b/internal/ai/tools/invocation_policy_test.goindex e88a90e91e..64288dc3f5 100644--- a/internal/ai/tools/invocation_policy_test.go+++ b/internal/ai/tools/invocation_policy_test.go@@ -351,3 +351,20 @@ func TestExecutionProfileSurvivesCloneIsolation(t *testing.T) {t.Fatal("original executor lost its profile policy after clone reset")}}++func TestExecutionProfileVocabularyIsClosed(t *testing.T) {+ unknown := ExecutionProfile(99)+ if unknown.Valid() {+ t.Fatal("unknown profile must not validate")+ }+ if !unknown.NonInteractive() {+ t.Fatal("unknown profile must fail closed as non-interactive, never interactive")+ }+ exec := newInvocationPolicyExecutor(t)+ defer func() {+ if recover() == nil {+ t.Fatal("applying an unknown execution profile must panic")+ }+ }()+ exec.ApplyExecutionProfile(unknown)+}