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
Remove Assistant handoff decision guidance
rcourtman303a8e2fe816
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.jsonindex 33c7f035e1..1f17c365ad 100644--- a/docs/release-control/v6/internal/status.json+++ b/docs/release-control/v6/internal/status.json@@ -2956,7 +2956,7 @@},{"id": "RA29",- "summary": "Interactive Pulse Assistant chat behaves like a governed LLM tool surface, not a Pulse-authored intent router: the operator's selected model receives the user turn and governed tools, decides whether tools are needed, and Pulse must not use prompt heuristics to force tool_choice, force a named tool, retry because an expected tool was not used, hide tools from the model by keyword detection, rewrite recent-context turns into Pulse-targeted instructions, fuzzy-match plain chat text into resource context before the model acts, synthesize/prefill/auto-submit product-authored Assistant prompts from handoffs, or keyword-match prior remediation history into suggested fixes. Pulse only provides context and enforces approvals, resource resolution, FSM gates, and tool policy after that model choice. The chat surface must echo user messages before network/session creation finishes and must not render Pulse-owned explore or internal workflow status cards as assistant output.",+ "summary": "Interactive Pulse Assistant chat behaves like a governed LLM tool surface, not a Pulse-authored intent router: the operator's selected model receives the user turn and governed tools, decides whether tools are needed, and Pulse must not use prompt heuristics to force tool_choice, force a named tool, retry because an expected tool was not used, hide tools from the model by keyword detection, rewrite recent-context turns into Pulse-targeted instructions, fuzzy-match plain chat text into resource context before the model acts, synthesize/prefill/auto-submit product-authored Assistant prompts from handoffs, keyword-match prior remediation history into suggested fixes, or generate Patrol handoff attention/decision/remediation guidance before the model reasons. Pulse only provides current context and enforces approvals, resource resolution, FSM gates, and tool policy after that model choice; any model-visible policy block must describe the boundary without naming a required next tool. The chat surface must echo user messages before network/session creation finishes and must not render Pulse-owned explore or internal workflow status cards as assistant output.","kind": "invariant","blocking_level": "repo-ready","proof_type": "automated",@@ -2968,6 +2968,19 @@],"release_gate_ids": [],"proof_commands": [+ {+ "id": "assistant-backend-handoff-policy-boundary-tests",+ "run": [+ "go",+ "test",+ "./internal/ai",+ "./internal/ai/chat",+ "./internal/api",+ "-run",+ "TestBuildPatrolRunAssistantHandoffUsesBackendSafeRunContext|TestFSM|TestService_ExecuteStream_InteractiveChatLetsModelChooseTools|TestHandleChat_|TestContract_AIHandler",+ "-count=1"+ ]+ },{"id": "assistant-chat-model-owned-routing-tests","run": [@@ -3037,6 +3050,19 @@"-count=1"]},+ {+ "id": "assistant-patrol-handoff-neutral-context-tests",+ "run": [+ "npm",+ "--prefix",+ "frontend-modern",+ "test",+ "--",+ "--run",+ "src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts",+ "src/components/AI/Chat/__tests__/AIChat.test.tsx"+ ]+ },{"id": "assistant-remediation-memory-context-tests","run": [@@ -3067,6 +3093,11 @@"path": "docs/release-control/v6/internal/status.json","kind": "file"},+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",+ "kind": "file"+ },{"repo": "pulse","path": "docs/release-control/v6/internal/subsystems/ai-runtime.md",@@ -3077,11 +3108,26 @@"path": "docs/release-control/v6/internal/subsystems/api-contracts.md","kind": "file"},+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/subsystems/frontend-primitives.md",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/subsystems/patrol-intelligence.md",+ "kind": "file"+ },{"repo": "pulse","path": "docs/release-control/v6/internal/subsystems/registry.json","kind": "file"},+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/subsystems/storage-recovery.md",+ "kind": "file"+ },{"repo": "pulse","path": "frontend-modern/src/api/__tests__/aiChatEvents.test.ts",@@ -3097,6 +3143,11 @@"path": "frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts","kind": "file"},+ {+ "repo": "pulse",+ "path": "frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx",+ "kind": "file"+ },{"repo": "pulse","path": "frontend-modern/src/components/AI/Chat/__tests__/ChatMessages.test.tsx",@@ -3202,6 +3253,11 @@"path": "internal/ai/chat/agentic_final.go","kind": "file"},+ {+ "repo": "pulse",+ "path": "internal/ai/chat/agentic_prompt.go",+ "kind": "file"+ },{"repo": "pulse","path": "internal/ai/chat/context_prefetch.go",@@ -3212,6 +3268,16 @@"path": "internal/ai/chat/context_prefetch_additional_test.go","kind": "file"},+ {+ "repo": "pulse",+ "path": "internal/ai/chat/fsm.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/ai/chat/fsm_test.go",+ "kind": "file"+ },{"repo": "pulse","path": "internal/ai/chat/read_routing_hints.go",@@ -3267,6 +3333,16 @@"path": "internal/ai/memory/remediation_memory_regression_test.go","kind": "file"},+ {+ "repo": "pulse",+ "path": "internal/ai/patrol_assistant_handoff.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/ai/patrol_assistant_handoff_test.go",+ "kind": "file"+ },{"repo": "pulse","path": "internal/ai/service.go",diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 7e7e02c47f..2ffb304c0f 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -496,8 +496,8 @@ profile and assignment columns, but embedded table framing must route throughlifecycle transition. Unified finding lifecycle facts, latest lifecycleevent briefing lines, and detailed lifecycle context included in Assistanthandoff context remain Patrol/AI review metadata and must not become agent- lifecycle state or fleet-control authority. Primary finding attention,- recency, evidence, verification, and operator-decision facts in the operator+ lifecycle state or fleet-control authority. Primary finding recency,+ evidence, verification, and governed action artifact facts in the findingbriefing and related root-cause or correlated finding summaries resolved forthe same Assistant handoff follow that same isolation rule, including anyrecency or latest lifecycle facts attached to those related summaries: they@@ -516,10 +516,10 @@ profile and assignment columns, but embedded table framing must route throughscoped resource label may restore Assistant presentation, but it must notbecome agent enrollment evidence, installer state, command-websocketidentity, or fleet-control authority.- Assistant operator-decision and action-posture briefing text derived from- those same recovered handoff action references stays under that review-only- boundary; lifecycle surfaces must not reinterpret a clearer approval posture- as install, enrollment, or command-execution authority.+ Assistant finding-briefing action metadata derived from those same recovered+ handoff action references stays under that review-only boundary; lifecycle+ surfaces must not reinterpret clearer approval metadata as install,+ enrollment, or command-execution authority.The same isolation rule applies to CSRF token-store behavior in`internal/api/csrf_store.go`: lifecycle-adjacent browser flows may rely onthe shared API/security layer to keep parallel replacement-token retries@@ -1296,8 +1296,8 @@ on `/api/ai/approvals` becoming ready from the first governed settings save,not only after some earlier process-start or chat-start side effect hasalready initialized the approval store.That same shared `internal/api/ai_handler.go` dependency now also assumes-Assistant finding handoffs may include a model-only operator briefing from-Patrol's unified finding and structured investigation record. Lifecycle-adjacent+Assistant finding handoffs may include a model-only factual finding briefing+from Patrol's unified finding and structured investigation record. Lifecycle-adjacentsetup, install, and fleet surfaces may treat that briefing as adjacentAI/runtime guidance only; it must not become agent readiness, install status,or lifecycle execution authority. When that briefing includes recovereddiff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 2fe7e4e506..994426b496 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -447,12 +447,12 @@ runtime cost control, and shared AI transport surfaces.runtime-failure boolean needed for browser presentation. Run-specificfields stay reserved for `patrol_run` handoffs, while hidden model context,command payloads, preflight output, and action results remain- backend-owned. The operator briefing must surface the primary- finding's current attention reason, recency facts, bounded evidence- snapshot, verification summary, and explicit operator decision framing- before investigation guidance, may surface the latest lifecycle event as- the current handoff state, and detailed lifecycle events must stay in a- bounded+ backend-owned. The finding briefing may surface the primary+ finding's current recency facts, bounded evidence snapshot,+ verification summary, latest lifecycle event, and governed action+ artifact metadata, but it must not generate Pulse-authored attention+ reasons, operator-decision framing, or remediation next-step guidance+ for the model. Detailed lifecycle events must stay in a bounded`[Finding Lifecycle Context]` block with an explicit model-only boundary.Assistant runtime may also hydrate canonicalresource-policy context for those handoff resources, using the same@@ -461,7 +461,7 @@ runtime cost control, and shared AI transport surfaces.model-only handling guidance, not saved user text or disclosure authority.Before injecting any product-originated handoff context into the modelprompt, the runtime must also apply canonical resource-policy redaction to- the assembled handoff text itself, including operator briefings and+ the assembled handoff text itself, including finding briefings andlower-level finding/action context, so local-model prompts and non-localprovider transport share the same governed identity boundary.Assistant runtime may also hydrate current canonical resource-state context@@ -486,17 +486,17 @@ runtime cost control, and shared AI transport surfaces.live Patrol investigation-fix approval by finding ID when the durable recorddoes not yet carry the latest approval ID. Those references are reviewcontext only: they must not include raw command text, must not grant- approval or execution authority, and must route any operator decision back+ approval or execution authority, and must route any requested action backthrough the governed approval/remediation flow. Patrol provides theconfigured LLM with observed finding context, evidence, policy posture, andgoverned action state; the LLM owns diagnosis and remediation reasoning.Operator-visible handoffs must not describe Patrol as having already- authored the correct remediation. The operator briefing's decision and- action-posture text must derive from those same structured action+ authored the correct remediation. The finding briefing may carry only+ factual governed action artifact metadata from those same structuredreferences 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.+ expiry, and dry-run posture, so Assistant sees current approval/action state+ without Pulse choosing the model's next investigative or corrective step.When those references include an approval ID, Assistant runtime may refresha current status snapshot from the canonical approval store on each turn,but it must enforce org scoping and still omit the approval command payload.@@ -559,7 +559,7 @@ runtime cost control, and shared AI transport surfaces.model-context hydration and current canonical stores instead of resendingstale browser handoff payloads. Patrol approval-row Assistant entries arestill Patrol finding handoffs, not local prompt-only shortcuts: live- approval rows, expired proposed-fix rows, and missing-detail queued-fix+ approval rows, expired action-artifact rows, and missing-detail queued-fixrecovery rows must route through the shared Patrol finding handoff builderso the backend receives the same bounded model-only finding context,resource reference, and safe action reference posture that the main finding@@ -1538,13 +1538,14 @@ card, so the learned-correlation layout and edge wording stay aligned acrossboth surfaces. That shared card also owns the correlation ordering andtruncation rule, so callers pass raw learned edges instead of page-specifictop-N slices.-Assistant finding handoffs now also receive a model-only operator briefing+Assistant finding handoffs now also receive a model-only finding briefingderived from the current unified finding and structured Patrol investigationrecord before the lower-level finding context. That briefing must summarize the-finding, resource, priority, current attention reason, current recency facts,-bounded evidence and verification summaries, investigation confidence,-operator decision framing, latest lifecycle event, and governed action posture-as model context, while leaving detailed lifecycle history, current+finding, resource, priority, current recency facts, bounded evidence and+verification summaries, investigation confidence, latest lifecycle event, and+governed action artifact metadata as factual model context without generating+Pulse-authored attention, operator-decision, or remediation guidance, while+leaving detailed lifecycle history, currentresource-state, timeline, related-finding, and action-audithydration in the existing canonical AI runtime handoff builders. Relatedroot-cause anddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex ecd2d3f424..292151ec2d 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -385,11 +385,12 @@ the canonical monitored-system blocked payload.3c. Route Assistant finding handoff context changes through`internal/api/ai_handler.go`, `internal/api/ai_handler_test.go`, and`internal/api/contract_test.go` together. Patrol-originated handoffs must- keep `[Operator Briefing]`, `[Finding Context]`, `[Finding Lifecycle+ keep `[Finding Briefing]`, `[Finding Context]`, `[Finding LifecycleContext]`, structured handoff resources, related root-cause/correlationfinding context, and structured handoff actions model-only, with the- briefing summarizing latest lifecycle event and governed action posture without raw- command text. Structured handoff action+ briefing summarizing latest lifecycle event and factual governed action+ artifact metadata without raw command text or Pulse-authored next-step+ guidance. Structured handoff actionreferences may use the current live Patrol investigation-fix approval forthe finding when that approval is newer than the approval ID on the durablerecord, but the payload may carry only IDs, status/risk/target metadata,@@ -401,32 +402,32 @@ the canonical monitored-system blocked payload.while raw command and rollback command payloads remain in governed actionsurfaces. Frontend Patrol finding-discussion handoffs must force arequest-local approval-required Assistant mode instead of inheriting the- user's persistent autonomous control setting; live approval, proposed-fix,+ user's persistent autonomous control setting; live approval, action artifact,fix-outcome, and remediation-plan references only add structured action- posture, they are not the trigger for the boundary. Frontend-visible Patrol+ metadata, they are not the trigger for the boundary. Frontend-visible Patrolbriefing payloads must stay compact and must not include suggested promptchips, Patrol-authored next-step recommendations, or route-ownedrecommendation metadata. Frontend queued-fix recovery handoffs- where the live approval or proposed-fix payload is unavailable must still- carry that Patrol-owned operator briefing, current `fix_queued` posture,+ where the live approval or action artifact payload is unavailable must still+ carry that Patrol-owned finding briefing, current `fix_queued` posture,request-local approval-required mode, and model-only evidence context; they mustnot degrade into generic Assistant investigation chat or imply thatexecution can proceed from missing command payloads. Expired-approval- recovery handoffs may use a still-available structured proposed-fix payload+ recovery handoffs may use a still-available structured action artifact payloadonly as safe metadata: description, target, risk, rationale, destructiveposture, and command count may enter the briefing, while raw command textremains owned by governed remediation or approval surfaces. If the unifiedfinding list lacks a full investigation record, frontend finding-discussionhandoffs may hydrate the latest investigation session for the same safe- proposed-fix metadata, but they must not paste raw proposed-fix command text+ action artifact metadata, but they must not paste raw action command textinto the authored prompt or visible briefing. Directalert-investigation API handoffs through `internal/api/ai_handlers.go` mustenforce that same request-scoped boundary by setting`ai.ExecuteRequest.AutonomousMode` tofalse and `ai.ExecuteRequest.RequireCommandApproval` to true; API proof mustkeep this guarded in both `internal/api/ai_handlers_test.go` and- `internal/api/contract_test.go`. The operator- decision and action-posture lines in the briefing must derive from those+ `internal/api/contract_test.go`. Governed action artifact lines in the+ briefing must derive from thosesame structured action references after recovery so the briefing cannotcontradict the handoff action payload. Related findingcontext must resolve from the current unified finding store, stay bounded@@ -598,11 +599,11 @@ the canonical monitored-system blocked payload.approval command payloads stay inside governed approval/remediation surfaces,and finding-level handoff context may be derived from the samebounded metadata only so Assistant receives approval status, risk,- dry-run posture, and proposed-fix posture without Pulse choosing the next+ dry-run posture, and existing action artifact metadata without Pulse choosing the nextstep or receiving raw command/execution payloads; finding-level handoffs may also send onebounded model-only `handoff_context`, one `handoff_resources` targetreference, and one `handoff_actions` entry for that governed approval or- proposed fix so the Assistant runtime can refresh finding and action posture+ action artifact so the Assistant runtime can refresh finding and action posturefrom IDs and safe summaries instead of relying on pasted chat textand the dedicated `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owner, so recent-change counts and governed policy-posture fallbacks normalize once at the shared store boundary instead of as Patrol-hook-local payload repairand the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loops@@ -643,14 +644,14 @@ the canonical monitored-system blocked payload.14. Keep Patrol status transport semantics explicit in that same AI handler layer: the Patrol status endpoint must carry machine-readable runtime availability such as blocked, running, disabled, active, or unavailable rather than asking frontend consumers to infer operator state from stale summaries or run history.15. Keep legacy Patrol quickstart transport semantics retired from the public v6 GA contract: ordinary AI settings and Patrol status payloads must not expose quickstart credit/status fields, and any stale hosted-model blocked copy that survives from compatibility state must normalize back to provider/local-model setup rather than presenting credit badges or acquisition prompts.16. Keep Patrol intelligence summary transport semantics single-voiced: the canonical overall-health payload and Patrol run-history payload together must support one primary assessment plus one explicit verification explanation, and frontend consumers must not need to derive a second compact assessment or verification verdict row from the same payloads beneath the primary assessment strip.- That same transport split now supports the visible Patrol recommended next- step without adding another API field: the frontend summary contract derives- the recommendation from existing overall-health, run-history, active- finding, runtime, and pending-approval state, so the API remains the source- of facts while Patrol presentation owns the operator decision wording and- bounded action kind. Those action kinds map back to existing API-backed- Patrol controls and approval/finding filters; recommendation transport- must not become a new execution or approval API.+ That same transport split now supports the visible Patrol assessment and+ action metadata without adding another API field: the frontend summary+ contract derives compact state from existing overall-health, run-history,+ active finding, runtime, and pending-approval facts, so the API remains the+ source of facts while the configured LLM owns next-step reasoning. Those+ action references map back to existing API-backed Patrol controls and+ approval/finding filters; summary transport must not become a new execution+ or approval API.The API contract should stay presentation-neutral here: it supplies thescore, current risk facts, verification facts, and action state needed for acompact operator summary, but it must not imply a hero, card, duplicate@@ -1175,7 +1176,7 @@ the canonical monitored-system blocked payload.runs still allow the coverage caveat to surface.and the Assistant finding-context request contract, so `/api/ai/chat`payloads carrying `finding_id` may hydrate a structured investigation- summary from the unified finding, but raw proposed-fix commands must stay+ summary from the unified finding, but raw action commands must stayout of the persisted prompt and inside governed approval/remediationcontext; the backend may pass that summary as model-only handoff contextfor the current turn and retain it as same-session model context for@@ -1200,10 +1201,10 @@ the canonical monitored-system blocked payload.summary. The frontend store boundary must preserve those recurrence factsfrom the shared payload, including `times_raised`, so Patrol presentation andAssistant handoff helpers do not infer repeated findings from page-local- state. The briefing must carry the primary finding's current attention- reason, recency facts, bounded evidence snapshot, verification summary, and- explicit operator decision framing before investigation guidance and may- carry the latest lifecycle event as the current handoff state, while the+ state. The briefing must carry the primary finding's current recency facts,+ bounded evidence snapshot, verification summary, and factual governed action+ artifact metadata before investigation guidance and may carry the latest+ lifecycle event as the current handoff state, while thedetailed lifecycle list must stay bounded and model-only. Chat execution mayalso resolve root-cause and correlated finding IDs from that current unifiedfinding into compact related-finding summaries and structured handoff@@ -1217,7 +1218,7 @@ the canonical monitored-system blocked payload.guidance is read-only, model-only context and must not become saved user text,disclosure authority, or action authority. Chat execution must apply thatsame resource-policy boundary to the assembled product-originated handoff- text before model prompt injection, including operator briefings and+ text before model prompt injection, including finding briefings andlower-level finding/action context, so governed resource identities areredacted even when the selected model is local and no provider-boundsanitizer will run. Chat execution may also hydrate@@ -1239,7 +1240,7 @@ the canonical monitored-system blocked payload.pending-action and approval references from the investigation record into chatexecution, and may recover the current live Patrol investigation-fix approvalfor the finding when the durable record has no current approval ID, but those- references must omit raw proposed-fix commands, remain model-only review+ references must omit raw action commands, remain model-only reviewcontext, and leave approval/execution authority with the governed approvaland remediation APIs. Frontend-visible pending-approval drawer briefings mustbe a presentation of that same safe handoff context: approval ID, status,@@ -1248,12 +1249,12 @@ the canonical monitored-system blocked payload.context payloads. Chat execution may refresh approval status snapshots forthose references from the canonical approval store, but that snapshot isread-only, org-scoped, and must not expose or infer the raw command. When the- API handoff builder recovers a live approval, the first model-only operator+ API handoff builder recovers a live approval, the first model-only findingbriefing and structured handoff action must use that recovered approval'ssafe 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+ approval policy, plan expiry, and dry-run posture as factual action artifact+ metadata instead of falling back to stale investigation-record approval+ posture. When the reference resolves to a governed action plan oraction audit, chat execution must hydrate the canonical action ID, lifecyclestate, requester, capability, approval policy, plan expiry, preflight/dry-runsummary, and terminal success/failure state from the action-audit store so@@ -3803,18 +3804,18 @@ actions visible even when no live pending approval remains and`proposed_fix`: queued remediation state cannot collapse into a dead badge withno user action path.The `/api/ai/chat` finding handoff contract must also include a model-only-`[Operator Briefing]` generated from the unified finding and structured Patrol+`[Finding Briefing]` generated from the unified finding and structured Patrolinvestigation record before detailed `[Finding Context]`. The briefing is the-canonical operator-facing frame for Assistant: it carries the finding summary,-resource, priority, current attention reason, current recency facts, bounded-evidence and verification summaries, investigation confidence, and-operator-decision framing plus approval/proposed-fix posture without raw command-text. It must not include a Pulse-authored recommended next step. Any recorded+canonical factual handoff frame for Assistant: it carries the finding summary,+resource, priority, current recency facts, bounded evidence and verification+summaries, investigation confidence, latest lifecycle facts, and governed+action artifact metadata without raw command text. It must not include a+Pulse-authored attention reason, operator decision, or recommended next step. Any recordedaction note from a durable investigation record is context, not remediation-guidance. That approval/proposed-fix posture must come from the same+guidance. That governed action artifact metadata must come from the samestructured action reference sent to chat execution, including any recovered livePatrol approval, so visible and model-only handoffs stay consistent. Patrol's-frontend Assistant drawer briefing must use that same operator frame for+frontend Assistant drawer briefing must use that same factual frame forvisible handoffs from findings, while the downstream chatservice hydrates live resource state, timeline, and action audit context aroundthat same handoff. Backend chat handling must treat matching frontend Patrol@@ -3825,12 +3826,12 @@ approval list payloads only as safe metadata for that visible briefing and anystructured `handoff_actions`: approval ID, status, risk, request/expirytimestamps, target label, requester identity, action ID, approval policy,plan expiry, and dry-run summary are allowed. Assessment-level visible- briefings may reuse that same safe metadata for action labels and safety notes,+ briefings may reuse that same safe metadata for factual action labels and safety notes,while approval command text remains inside the governed approval/remediationsurface.Patrol approval-row Assistant handoffs must use the same safe metadata boundaryand set `autonomousMode:false` for the request-local chat handoff; they must not-paste raw approval or proposed-fix command text into a chat prompt.+paste raw approval or action command text into a chat prompt.Patrol remediation-plan or action-artifact Assistant handoffs must pass only safestatus, risk, description, and command-count posture as non-authoritative contextfor the configured LLM to critique; raw plan command and rollback commanddiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 753b10a868..680f403b42 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -242,7 +242,7 @@ Patrol's primary assessment strip is descriptive only; it must not render aPatrol-authored recommended next step, suggested prompt chips, or a secondaryaction band inside the assessment shell. If the same assessment opensAssistant, the Patrol-to-Assistant handoff must carry only bounded evidence,-resource references, and governed approval/action posture as model-only+resource references, and factual governed approval/action metadata as model-onlycontext. Feature-owned Assistant handoffs may provide source context and safemetadata, but the shared drawer boundary must not turn those handoffs intofrontend-authored prompts, tool routes, or remediation plans; the configured@@ -1061,16 +1061,17 @@ AI runtime.drawer may render a genericcontext-briefing band from `frontend-modern/src/stores/aiChat.ts`, butfeature-owned helpers must provide compact source labels, primary subject,- status, and governed approval/action posture while keeping attention reason,- evidence summaries, operator-decision copy, and safety notes compact and- source-owned. Prompt suggestions must stay out of Patrol drawer chrome.+ status, and governed approval/action artifact metadata while keeping+ detailed evidence, safety notes, and model-only finding context outside+ drawer chrome. Prompt suggestions, attention-reason copy, and+ operator-decision framing must stay out of Patrol drawer chrome.Patrol finding and action-artifact handoffs must not render suggested promptchips in the drawer and must not become another primitive path for rawapproval, command, or rollback command payload text. Missing-detailqueued-fix recovery actions must still provide the feature-owned Patrolbriefing and request-local approval-required posture rather than opening theshared drawer as context-free generic Assistant chat. If a feature-owned- expired-approval recovery action still has structured proposed-fix metadata,+ expired-approval recovery action still has structured action artifact metadata,the shared drawer may receive only safe summary fields and command counts;raw command text remains outside shared Assistant primitives.When those feature-owned helpers attach backend model-only context, the@@ -1085,7 +1086,7 @@ AI runtime.`AIChatContextBriefing`, including generated approval summaries and commandcounts when available; raw approval commands remain owned by the governedapproval/remediation panels. If the generic finding-level helper hydrates- latest investigation detail to recover proposed-fix context, it may pass only+ latest investigation detail to recover action artifact context, it may pass onlysafe summary fields and command counts into the drawer briefing. Sharedapproval-required posture must derive its subject from that briefing orstructured finding context, so Patrol handoffs render as Patrol handoffs or@@ -1093,7 +1094,7 @@ AI runtime.than generic dashboard briefs. Patrol approval-row Assistant prompts mustroute through the samefeature-owned finding handoff helper rather than hand-written prompt-only- drawer opens: safe approval metadata, proposed-fix summaries, resource+ drawer opens: safe approval metadata, action artifact summaries, resourcereferences, and bounded `handoff_actions` may enter the prompt and context,but raw command text stays out and the scoped request must pass`autonomousMode:false` instead of changing the user's persistent Assistantdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex b7a90a7458..698446d6c1 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -138,7 +138,7 @@ Patrol-specific presentation helpers.presentation, but visible Patrol copy and Assistant handoff contextmust flow through the governed Patrol investigation-context helpers. Thosehelpers also own the Assistant drawer briefing content for Patrol records,- including the rule that proposed-fix commands are summarized by count only+ including the rule that action artifact commands are summarized by count onlyand never rendered as raw command text in the handoff surface. When Patrolhands a pending fix or approval into Assistant, the shared handoff may retainonly structured action references such as approval ID, status, request/expiry@@ -150,9 +150,10 @@ Patrol-specific presentation helpers.the durable record lacks the current approval reference, but Patrolpresentation must still keep command payloads inside governedapproval/remediation context rather than rendering them as handoff copy.- Assistant's operator decision and approval/proposed-fix posture must derive- from the same structured handoff action after that recovery, so the- briefing cannot contradict the action reference passed to chat execution.+ Assistant's governed action artifact metadata must derive from the same+ structured handoff action after that recovery, so the briefing cannot+ contradict the action reference passed to chat execution while still leaving+ next-step reasoning to the configured LLM.Assistant may also hydrate the referenced action plan or action audit so thehandoff explains current action lifecycle state, requester, capability,approval policy, plan expiry, preflight/dry-run posture, and terminal@@ -173,13 +174,13 @@ Patrol-specific presentation helpers.canonical policy, state, topology, and timeline hydration, but Patrolpresentation must treat them as explanation for the current finding ratherthan approval, lifecycle, disclosure, or execution authority.- Assistant handoffs from Patrol findings must also include a concise operator- briefing derived from the unified finding and structured investigation record- before the detailed finding context, so Assistant receives current risk,- attention reason, recency, evidence snapshot, verification summary,- conclusion, latest lifecycle event, explicit operator decision framing, and- governed approval/action posture instead of behaving like a generic chat over- a pasted incident dump. Patrol is the scheduled+ Assistant handoffs from Patrol findings must also include a concise factual+ finding briefing derived from the unified finding and structured+ investigation record before the detailed finding context, so Assistant+ receives current risk, recency, evidence snapshot, verification summary,+ conclusion, latest lifecycle event, and governed approval/action artifact+ metadata instead of behaving like a generic chat over a pasted incident dump.+ Patrol is the scheduledprobe, context assembler, and execution-governance owner; the configured LLMis the diagnostic and remediation-reasoning owner. Patrol handoffs mayprovide system context, resource posture, action posture, and governed tools,@@ -209,28 +210,28 @@ Patrol-specific presentation helpers.expiry, target label, generated approval summary, and command count; it mustnot copy the approval command payload into Assistant drawer prose. Themodel-only runtime briefing must apply that same- recovered approval reference when framing the operator decision and action- posture. The initial prompt for a Patrol finding may include governed action- posture when safe metadata is attached, but it must frame that posture as- context for the LLM to evaluate rather than as a Patrol-authored remediation+ recovered approval reference when adding factual governed action artifact+ metadata. The initial prompt for a Patrol finding may include governed action+ context when safe metadata is attached, but it must frame that context as+ input for the LLM to evaluate rather than as a Patrol-authored remediationanswer. Findinghandoffs must be assembled through the Patrol-owned handoff model so theprompt, visible briefing, model-only finding context, resource reference,bounded action reference, and request-local approval-required posture stay insync. The model-only context may includecurrent finding status, recurrence, investigation record facts, evidence,- verification, approval posture, dry-run posture, proposed-fix summary, target- resource references, and governed action references without raw command- payloads. Inline Patrol approval actions in+ verification, approval state, dry-run posture, existing action artifact+ summary, target resource references, and governed action references without+ raw command payloads. Inline Patrol approval actions in`frontend-modern/src/components/patrol/ApprovalSection.tsx` that openAssistant must follow that same Patrol-owned handoff model rather than aprompt-only local shortcut: pass approval ID/status/risk/target plus safesummary/count metadata as review context, attach the target resourcereference, include bounded `handoff_actions` for live approvals or structured- proposed fixes when present, force the request-local approval-required mode,+ action artifacts when present, force the request-local approval-required mode,attach the Patrol-owned visible drawer briefing for the pending approval orqueued-fix recovery state, and never paste the approval command or- proposed-fix command text into the chat prompt. Existing remediation-plan or+ action command text into the chat prompt. Existing remediation-plan oraction-plan artifacts follow the same boundary: plan status, risk, andcommand counts are allowed as non-authoritative governed action posture forthe LLM to critique, but visible handoffs must not render Patrol step lists@@ -238,7 +239,7 @@ Patrol-specific presentation helpers.governed remediation or approval surface. Generic findingdiscussion handoffs must also force request-local approval-required mode forany non-empty Patrol `finding_id`, including context-only findings and- findings that reference a live approval, proposed fix, fix outcome, or+ findings that reference a live approval, action artifact, fix outcome, orremediation plan, so default autonomous Assistant settings cannot bypass thePatrol action-governance boundary. The assembled handoff must still passthrough the Assistant runtime's resource-policy sanitizer before prompt@@ -246,19 +247,19 @@ Patrol-specific presentation helpers.cannot leak governed resource names, IDs, aliases, nodes, paths, oraddresses outside the canonical policy boundary.If a `fix_queued` finding no longer has a live approval payload or detailed- proposed-fix payload available, the recovery action must still open Assistant+ action artifact payload available, the recovery action must still open Assistantwith the same Patrol-owned visible briefing and approval-required posturefrom current finding facts; it must not fall back to generic investigationchat or invite execution from missing command details.- If the live approval is gone but the structured proposed-fix payload is still- available, the recovery Assistant briefing must carry only safe proposed-fix+ If the live approval is gone but the structured action artifact payload is still+ available, the recovery Assistant briefing must carry only safe action artifactmetadata such as description, target, risk, rationale, destructive posture,and command count. Raw command text remains in the governed remediation orapproval panel, while Assistant gets enough context to explain approvalrecovery and risk without becoming an execution surface.Generic finding-level Assistant handoffs must use that same safe metadataboundary when the list response lacks a full investigation record: they may- hydrate the latest investigation session to recover proposed-fix summary,+ hydrate the latest investigation session to recover action artifact summary,risk, target, rationale, destructive posture, and command count, but they muststill keep command text out of both the user-authored prompt and visibleAssistant briefing.@@ -284,7 +285,7 @@ Patrol-specific presentation helpers.an investigation record exists with no impact text, and a parallel`Rollback not specified` placeholder whenever rollback is empty, so theoperator-visible gap is conspicuous rather than hidden. The Patrol- operator briefing card built by+ finding briefing card built by`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`may include populated impact text in its bounded detail lines but mustomit the placeholder copy from that compact card so it stays tight,diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex f6858c9857..131f524ea6 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -574,8 +574,8 @@ bypass the API fail-closed execution gate.event briefing lines, and detailed lifecycle context carried by the samehandoff remain Patrol/AI review metadata and must not become backup recency,restore support, or storage-local lifecycle state. Primary finding- attention, recency, evidence, verification, and operator-decision facts in- the operator briefing and related root-cause or correlated finding summaries+ recency, evidence, verification, and governed action artifact facts in+ the finding briefing and related root-cause or correlated finding summariesresolved for that Assistant handoff are also adjacent AI/runtime explanationcontext only, including any recency or latest lifecycle facts attached tothose related summaries; storage and recovery surfaces must not reinterpret@@ -592,7 +592,7 @@ bypass the API fail-closed execution gate.bypass. Any refreshed approval or action-audit status snapshot in Assistanthandoff context is still read-only AI/runtime context and must not becomerecovery freshness, restore eligibility, or storage-local execution state.- Operator briefings generated for those same Assistant finding handoffs are+ Finding briefings generated for those same Assistant finding handoffs arealso adjacent AI/runtime context only: storage and recovery surfaces may readtheir Patrol conclusion and bounded evidence as investigation context, butmust not reinterpret the briefing as backup recency, restore support,@@ -1332,12 +1332,12 @@ resource or mention type that still reaches shared AI handlers must collapseto canonical `agent` before storage/recovery-adjacent links, filters, ordrill-ins consume it, so those surfaces never inherit a second live host-typecontract 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,+Assistant finding-briefing action metadata assembled from recovered Patrol+handoff action references is also AI/runtime review context only. Storage and+recovery may consume that explanation as incident context,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,+a recovered approval or clearer action artifact metadata as backup freshness,restore authority, recovery proof, or storage-local remediation executionstate. Those handoffs must remain context-only for the configured model andmust not be converted by storage/recovery code into pre-filled prompts,diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex fa73d17ded..da3bf75cf0 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -372,7 +372,7 @@ describe('AIChat', () => {autonomousMode: false,briefing: {sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'Provider connection issue on Patrol runtime',actionLabel: 'Open Patrol provider settings',actionHref: '/settings/system-ai',@@ -1733,7 +1733,7 @@ describe('AIChat', () => {autonomousMode: false,briefing: {sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',},};diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.tsindex 9bd4c306e0..a08a9b4561 100644--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts@@ -571,7 +571,7 @@ describe('patrolInvestigationContextModel', () => {expect(handoff.context.handoffContext).toContain('expires 2026-05-06T12:10:00Z');expect(handoff.context.handoffContext).toContain('requested by pulse_patrol');expect(handoff.context.handoffContext).toContain('1 command recorded for approval context');- expect(handoff.context.handoffContext).toContain('destructive proposed fix');+ expect(handoff.context.handoffContext).toContain('destructive action artifact');expect(handoff.context.handoffActions).toHaveLength(1);expect(handoff.context.handoffActions?.[0]).toMatchObject({findingId: 'finding-1',@@ -883,7 +883,7 @@ describe('patrolInvestigationContextModel', () => {]);});- it('normalizes safe proposed-fix briefing metadata without command text', () => {+ it('normalizes safe action artifact briefing metadata without command text', () => {const briefing = buildPatrolAssistantProposedFixBriefingInput({description: 'Restart the workload service',commands: ['systemctl restart workload.service'],@@ -1133,16 +1133,15 @@ describe('patrolInvestigationContextModel', () => {expect(briefing).toEqual({sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'High CPU usage on web-server',statusLabel: 'Completed · Fix Queued · High confidence',detailLines: [- 'Attention: active critical finding; regressed 2 times; last regression 2 hours ago; loop awaiting approval; approval approval-1; live approval pending; destructive proposed fix; fix queued for governed review','Backup job saturated CPU.',- `Decision: review live governed approval approval-1 before execution; approval pending; target web-server; expires ${approvalExpiresAt}; requested ${approvalRequestedAt}; action artifact fix-1; risk high; destructive true`,+ 'Existing action artifact: Restart the workload service; medium risk; 1 command recorded for approval context; destructive action artifact',],evidence: ['CPU stayed above 95% for 10 minutes', 'Verified: CPU returned below 50%'],- actionLabel: 'Restart the workload service',+ actionLabel: undefined,commandSummary: '1 command recorded for approval context',safetyNote:'Command details stay in approval context; destructive actions require governed approval.',@@ -1299,7 +1298,7 @@ describe('patrolInvestigationContextModel', () => {});expect(handoff).not.toHaveProperty('prompt');expect(handoff.context.briefing).toMatchObject({- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'Provider connection issue on Patrol runtime',});expect(handoff.context.briefing?.actionLabel).toBeUndefined();@@ -1310,11 +1309,11 @@ describe('patrolInvestigationContextModel', () => {expect(handoff.context.handoffActions).toBeUndefined();expect(handoff.context.handoffContext).not.toContain('Patrol Next Step');expect(handoff.context.handoffContext).toContain(- 'Operator Boundary: This Patrol finding handoff is model-only context',+ 'Model Boundary: This Patrol finding handoff is model-only context',);});- it('builds an operator briefing from current finding facts before a Patrol record exists', () => {+ it('builds a finding briefing from current finding facts before a Patrol record exists', () => {expect(buildPatrolAssistantFindingBriefing({title: 'High CPU usage',@@ -1326,13 +1325,10 @@ describe('patrolInvestigationContextModel', () => {}),).toEqual({sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'High CPU usage on web-server',statusLabel: undefined,- detailLines: [- 'Attention: active warning finding; raised 3 times; loop investigating',- 'Decision: Wait for Patrol to finish the investigation before approving remediation.',- ],+ detailLines: [],evidence: [],actionLabel: undefined,commandSummary: undefined,@@ -1358,15 +1354,12 @@ describe('patrolInvestigationContextModel', () => {expect(briefing).toEqual({sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'CPU saturation on node-1',statusLabel: 'Pending approval · High risk',- detailLines: [- 'Attention: active finding; loop fix queued; live approval pending',- 'Decision: Review live governed approval approval-1 before execution. Status: pending. Target: node-1. Risk: high. Expires: 2026-05-06T12:10:00Z. Requested: 2026-05-06T12:00:00Z.',- ],+ detailLines: [],evidence: [],- actionLabel: 'Approval approval-1',+ actionLabel: undefined,commandSummary: undefined,safetyNote: 'Execution requires the governed approval flow.',});@@ -1383,13 +1376,10 @@ describe('patrolInvestigationContextModel', () => {}),).toEqual({sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'CPU saturation on node-1',statusLabel: 'Fix Queued',- detailLines: [- 'Attention: active finding; loop fix queued; fix queued for governed review',- 'Decision: Recover or regenerate the governed approval before execution; do not execute from chat context.',- ],+ detailLines: [],evidence: [],actionLabel: undefined,commandSummary: undefined,@@ -1397,7 +1387,7 @@ describe('patrolInvestigationContextModel', () => {});});- it('builds queued-fix recovery briefing from safe proposed-fix metadata', () => {+ it('builds queued-fix recovery briefing from safe action artifact metadata', () => {expect(buildPatrolAssistantFindingBriefing({title: 'CPU saturation',@@ -1416,16 +1406,14 @@ describe('patrolInvestigationContextModel', () => {}),).toEqual({sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: 'CPU saturation on node-1',statusLabel: 'Fix Queued',detailLines: [- 'Attention: active finding; loop fix queued; fix queued for governed review',- 'Proposed fix: Restart workload service; target node-1; high risk; 1 command recorded for approval context; destructive proposed fix; rationale service is wedged',- 'Decision: Recover or regenerate the governed approval before execution; do not execute from chat context.',+ 'Existing action artifact: Restart workload service; target node-1; high risk; 1 command recorded for approval context; destructive action artifact; rationale service is wedged',],evidence: [],- actionLabel: 'Restart workload service',+ actionLabel: undefined,commandSummary: '1 command recorded for approval context',safetyNote:'Command details stay in approval context; destructive actions require governed approval.',diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.tsindex d25a51ba46..5afe854a51 100644--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts@@ -823,7 +823,7 @@ function buildPatrolAssessmentAssistantModelContext(omittedFindingCount > 0? `${omittedFindingCount} additional Patrol finding${omittedFindingCount === 1 ? '' : 's'} omitted from this bounded handoff summary.`: undefined,- 'Operator Boundary: This Patrol assessment handoff is model-only context for explanation and review. Diagnostics, remediation, and command execution require explicit governed approval.',+ 'Model Boundary: This Patrol assessment handoff is model-only context for explanation and review. Diagnostics, remediation, and command execution require explicit governed approval.',].filter(isNonEmptyString).join('\n');@@ -877,7 +877,7 @@ function buildPatrolConfigurationFailureModelContext(input.status ? `HTTP Status: ${input.status}` : undefined,...detailLines.map((line) => formatContextLine('Configuration Detail', line)),...details.map((line) => formatContextLine('Backend Detail', line)),- 'Operator Boundary: This Patrol configuration handoff is model-only context for explanation and review. Provider changes, retries, diagnostics, remediation, and command execution require explicit governed operator action.',+ 'Model Boundary: This Patrol configuration handoff is model-only context for explanation and review. Provider changes, retries, diagnostics, remediation, and command execution require explicit governed operator action.',].filter(isNonEmptyString).join('\n');@@ -1674,10 +1674,10 @@ function formatAssessmentFindingContextLine(: undefined,...formatAssessmentPendingApprovalContextParts(pendingApproval),proposedFix?.description- ? `proposed fix ${truncateContextText(proposedFix.description, 160)}`+ ? `action artifact ${truncateContextText(proposedFix.description, 160)}`: undefined,proposedFix?.commandSummary,- proposedFix?.destructive ? 'destructive proposed fix' : undefined,+ proposedFix?.destructive ? 'destructive action artifact' : undefined,record.error ? `investigation error ${truncateContextText(record.error, 160)}` : undefined,];@@ -1729,20 +1729,18 @@ function buildPatrolAssistantFindingModelContext(? `last regression ${formatBriefingTimestamp(normalizeText(input.lastRegressionAt))}`: undefined,].filter(isNonEmptyString);- const attentionReason = buildPatrolAssistantAttentionReason(input, record);- const operatorDecision = buildPatrolAssistantOperatorDecision(input);- const proposedFixFacts = proposedFix+ const actionArtifactFacts = proposedFix? formatBriefingStringList([proposedFix.description,proposedFix.targetHost ? `target ${proposedFix.targetHost}` : undefined,proposedFix.riskLabel ? `${proposedFix.riskLabel.toLowerCase()} risk` : undefined,proposedFix.commandSummary,- proposedFix.destructive ? 'destructive proposed fix' : undefined,+ proposedFix.destructive ? 'destructive action artifact' : undefined,proposedFix.rationale ? `rationale ${proposedFix.rationale}` : undefined,],6,- 'proposed-fix facts',+ 'action-artifact facts',): undefined;@@ -1758,7 +1756,6 @@ function buildPatrolAssistantFindingModelContext(formatContextLine('Last Seen At', input.lastSeenAt),formatContextLine('Recurrence', raisedParts.join('; ')),formatContextLine('Description', input.description),- formatContextLine('Attention', attentionReason),formatContextLine('Investigation Record', input.investigationRecord?.id),formatContextLine('Investigation Status', record.statusLabel),formatContextLine('Investigation Outcome', record.outcomeLabel),@@ -1795,10 +1792,9 @@ function buildPatrolAssistantFindingModelContext(formatContextLine('Action Plan Summary', pendingApproval.actionPlanMessage),formatContextLine('Action Preflight', pendingApproval.actionPreflight),formatContextLine('Dry-Run Posture', pendingApproval.actionDryRunSummary),- formatContextLine('Proposed Fix', proposedFixFacts),- formatContextLine('Operator Decision', operatorDecision),+ formatContextLine('Existing Action Artifact', actionArtifactFacts),'Command Boundary: Command details stay in governed approval or remediation context; this model-only handoff may include command counts but not raw command text.',- 'Operator Boundary: This Patrol finding handoff is model-only context for explanation and review. Diagnostics, remediation, and command execution require explicit governed approval.',+ 'Model Boundary: This Patrol finding handoff is model-only context for explanation and review. Diagnostics, remediation, and command execution require explicit governed approval.',].filter(isNonEmptyString).join('\n');@@ -1905,9 +1901,9 @@ export function buildPatrolRemediationPlanAssistantModelContext(formatContextLine('Recorded Risk', riskLabel),formatContextLine('Attached Action Context', planDescription),commandSummary- ? `Governed Action Posture: ${commandSummary}. Treat this as approval state, not remediation guidance.`+ ? `Governed Action Context: ${commandSummary}. Treat this as approval state, not remediation guidance.`: undefined,- 'Operator Boundary: Do not assume any Patrol-authored action is correct. Use the finding evidence, available tools, and current operational state to decide the remediation. Any state-changing command must go through governed approval; do not infer, repeat, or execute raw command text from this chat handoff.',+ 'Model Boundary: Do not assume any Patrol-authored action is correct. Use the finding evidence, available tools, and current operational state to decide the remediation. Any state-changing command must go through governed approval; do not infer, repeat, or execute raw command text from this chat handoff.',].filter(isNonEmptyString).join('\n');@@ -1966,275 +1962,42 @@ export function buildPatrolAssistantFindingBriefing(record.confidenceLabel,...approvalStatusParts,].filter(isNonEmptyString);- const attentionReason = buildPatrolAssistantAttentionReason(input, record);- const operatorDecision = buildPatrolAssistantOperatorDecision(input);- if (!record.hasRecord && !attentionReason && !operatorDecision) {+ const hasFindingFacts = [+ input.severity,+ input.findingStatus,+ input.investigationOutcome,+ input.loopState,+ normalizeNonNegativeCount(input.timesRaised) > 0 ? String(input.timesRaised) : '',+ normalizeNonNegativeCount(input.regressionCount) > 0 ? String(input.regressionCount) : '',+ input.lastRegressionAt,+ ].some((value) => normalizeText(value).length > 0);+ if (!record.hasRecord && !hasFindingFacts && !pendingApproval.id && !proposedFix) {return undefined;}- const proposedFixDetail = record.proposedFix- ? undefined- : formatPatrolAssistantProposedFixDetail(proposedFix);+ const actionArtifactDetail = formatPatrolAssistantActionArtifactDetail(proposedFix);const detailLines = [- attentionReason ? `Attention: ${attentionReason}` : undefined,record.conclusion,record.impact ? `Impact: ${record.impact}` : undefined,- proposedFixDetail,- operatorDecision ? `Decision: ${operatorDecision}` : undefined,+ actionArtifactDetail,].filter(isNonEmptyString).slice(0, 4);const verificationLines = record.verificationSummaries.map((summary) => `Verified: ${summary}`);- const actionLabel =- proposedFix?.description ||- (pendingApproval.id ? `Approval ${pendingApproval.id}` : undefined) ||- undefined;return {sourceLabel: 'Pulse Patrol',- title: 'Operator briefing attached',+ title: 'Patrol finding attached',subject: `${title} on ${subject}`,statusLabel: statusParts.join(' · ') || undefined,detailLines,evidence: [...record.evidenceSummaries, ...verificationLines].slice(0, 4),- actionLabel,+ actionLabel: undefined,commandSummary: proposedFix?.commandSummary,safetyNote: buildPatrolAssistantSafetyNote(proposedFix, pendingApproval),};}-function buildPatrolAssistantAttentionReason(- input: PatrolAssistantFindingBriefingInput,- record: PatrolInvestigationRecordPresentation,-): string | undefined {- const parts: string[] = [];- const status = normalizeText(input.findingStatus).toLowerCase();- const severity = normalizeText(input.severity).toLowerCase();-- switch (status) {- case 'active':- parts.push(severity ? `active ${severity} finding` : 'active finding');- break;- case 'resolved':- parts.push(- normalizeNonNegativeCount(input.regressionCount) > 0- ? 'resolved after prior regression'- : 'resolved finding',- );- break;- case 'snoozed':- parts.push('snoozed finding');- break;- case 'dismissed':- parts.push('dismissed finding');- break;- }-- const regressionCount = normalizeNonNegativeCount(input.regressionCount);- const timesRaised = normalizeNonNegativeCount(input.timesRaised);- if (regressionCount > 0) {- parts.push(`regressed ${regressionCount} time${regressionCount === 1 ? '' : 's'}`);- } else if (timesRaised > 1) {- parts.push(`raised ${timesRaised} times`);- }-- const lastRegressionAt = formatBriefingTimestamp(normalizeText(input.lastRegressionAt));- if (lastRegressionAt) {- parts.push(`last regression ${lastRegressionAt}`);- }-- // Only surface loop state when it differs from the default "detected".- // Loop=detected means "Patrol detected it, no investigation in flight"- // which is the trivial state for any active finding; rendering "loop- // detected" in the Attention line adds noise without information. Keep- // the loop signal only when it indicates a non-default investigation- // posture ("awaiting approval", "remediation failed", etc.).- const rawLoopState = normalizeText(input.loopState).toLowerCase();- if (rawLoopState && rawLoopState !== 'detected') {- const loopLabel = formatIdentifierLabel(input.loopState)?.toLowerCase();- if (loopLabel) {- parts.push(`loop ${loopLabel}`);- }- }-- const rawRecord = input.investigationRecord;- const approvalId = normalizeText(rawRecord?.approval_id);- if (approvalId) {- parts.push(`approval ${approvalId}`);- }- const pendingApproval = normalizeApprovalBriefing(input.pendingApproval);- if (pendingApproval.status === 'pending') {- parts.push('live approval pending');- }- if (record.proposedFix?.destructive) {- parts.push('destructive proposed fix');- }-- switch (normalizeText(rawRecord?.outcome || input.investigationOutcome)) {- case 'fix_queued':- parts.push('fix queued for governed review');- break;- case 'fix_executed':- parts.push('fix executed awaiting verification');- break;- case 'fix_failed':- parts.push('fix failed');- break;- case 'fix_verification_failed':- parts.push('verification failed');- break;- case 'fix_verification_unknown':- parts.push('verification inconclusive');- break;- case 'needs_attention':- parts.push('needs operator attention');- break;- case 'cannot_fix':- parts.push('Patrol cannot safely fix');- break;- case 'timed_out':- parts.push('Patrol timed out');- break;- }-- return formatBriefingStringList(parts, 8, 'attention facts');-}--function buildPatrolAssistantOperatorDecision(- input: PatrolAssistantFindingBriefingInput,-): string | undefined {- if (normalizeText(input.findingStatus).toLowerCase() === 'resolved') {- return 'Finding is resolved; explain the resolution and monitoring follow-up without proposing execution.';- }-- const record = input.investigationRecord;- if (record) {- const pendingApproval = normalizeApprovalBriefing(input.pendingApproval);- const approvalId = pendingApproval.id || normalizeText(record.approval_id);- if (approvalId) {- const parts = [- `review ${pendingApproval.status === 'pending' ? 'live ' : ''}governed approval ${approvalId} before execution`,- ];- if (pendingApproval.status) {- parts.push(`approval ${pendingApproval.status}`);- }- if (pendingApproval.targetName) {- parts.push(`target ${pendingApproval.targetName}`);- }- if (pendingApproval.expiresAt) {- parts.push(`expires ${pendingApproval.expiresAt}`);- }- if (pendingApproval.requestedAt) {- parts.push(`requested ${pendingApproval.requestedAt}`);- }- if (pendingApproval.actionRequestedBy) {- parts.push(`requested by ${pendingApproval.actionRequestedBy}`);- }- if (record.proposed_fix) {- const fixId = normalizeText(record.proposed_fix.id);- if (fixId) {- parts.push(`action artifact ${fixId}`);- } else if (normalizeText(record.proposed_fix.description)) {- parts.push('action artifact recorded');- }- const risk = pendingApproval.riskLevel || normalizeText(record.proposed_fix.risk_level);- if (risk) {- parts.push(`risk ${risk}`);- }- if (record.proposed_fix.destructive) {- parts.push('destructive true');- }- }- return parts.join('; ');- }-- switch (normalizeText(record.outcome)) {- case 'fix_queued':- return 'Review the recorded action posture in the governed approval or remediation flow before execution.';- case 'fix_executed':- return 'Verify the execution result before closing or resolving the finding.';- case 'fix_failed':- case 'fix_verification_failed':- return 'Review failed remediation evidence before retrying or escalating.';- case 'fix_verification_unknown':- return 'Gather verification evidence before closing or retrying remediation.';- case 'needs_attention':- case 'cannot_fix':- return 'Operator intervention is required; use the evidence to choose the next manual step.';- case 'timed_out':- return 'Patrol timed out; rerun investigation or gather more evidence before remediation.';- }-- switch (normalizeText(record.status)) {- case 'pending':- case 'running':- return 'Wait for Patrol to finish the investigation before approving remediation.';- case 'failed':- return 'Review the Patrol investigation failure and gather evidence before remediation.';- case 'needs_attention':- return 'Operator intervention is required; use the evidence to choose the next manual step.';- }- }-- const pendingApproval = normalizeApprovalBriefing(input.pendingApproval);- if (pendingApproval.id) {- const parts = [`Review live governed approval ${pendingApproval.id} before execution.`];- if (pendingApproval.status) {- parts.push(`Status: ${pendingApproval.status}.`);- }- if (pendingApproval.targetName) {- parts.push(`Target: ${pendingApproval.targetName}.`);- }- if (pendingApproval.riskLevel) {- parts.push(`Risk: ${pendingApproval.riskLevel}.`);- }- if (pendingApproval.expiresAt) {- parts.push(`Expires: ${pendingApproval.expiresAt}.`);- }- if (pendingApproval.requestedAt) {- parts.push(`Requested: ${pendingApproval.requestedAt}.`);- }- if (pendingApproval.actionRequestedBy) {- parts.push(`Requested by: ${pendingApproval.actionRequestedBy}.`);- }- return parts.join(' ');- }-- const remediationId = normalizeText(input.remediationId);- if (remediationId) {- return `Review governed remediation ${remediationId} before execution.`;- }-- switch (normalizeText(input.investigationOutcome).toLowerCase()) {- case 'fix_queued':- return 'Recover or regenerate the governed approval before execution; do not execute from chat context.';- case 'fix_executed':- return 'Verify the execution result before closing or resolving the finding.';- case 'fix_failed':- case 'fix_verification_failed':- return 'Review failed remediation evidence before retrying or escalating.';- case 'fix_verification_unknown':- return 'Gather verification evidence before closing or retrying remediation.';- case 'needs_attention':- case 'cannot_fix':- return 'Operator intervention is required; use the evidence to choose the next manual step.';- case 'timed_out':- return 'Patrol timed out; rerun investigation or gather more evidence before remediation.';- }-- const loopState = normalizeText(input.loopState).toLowerCase();- if (loopState.includes('approval')) {- return 'Review the governed approval flow before execution.';- }- if (loopState.includes('investigat')) {- return 'Wait for Patrol to finish the investigation before approving remediation.';- }- if (normalizeText(input.findingStatus).toLowerCase() === 'active') {- return 'Continue investigation or monitoring; no governed action reference is ready.';- }- return undefined;-}-function buildPatrolAssistantSafetyNote(proposedFix?: PatrolInvestigationRecordPresentation['proposedFix'],pendingApproval?: Required<PatrolAssistantApprovalBriefingInput>,@@ -2286,7 +2049,7 @@ function normalizeProposedFixBriefing(return normalized;}-function formatPatrolAssistantProposedFixDetail(+function formatPatrolAssistantActionArtifactDetail(proposedFix?: PatrolInvestigationRecordPresentation['proposedFix'],): string | undefined {if (!proposedFix) return undefined;@@ -2296,13 +2059,13 @@ function formatPatrolAssistantProposedFixDetail(proposedFix.targetHost ? `target ${proposedFix.targetHost}` : undefined,proposedFix.riskLabel ? `${proposedFix.riskLabel.toLowerCase()} risk` : undefined,proposedFix.commandSummary,- proposedFix.destructive ? 'destructive proposed fix' : undefined,+ proposedFix.destructive ? 'destructive action artifact' : undefined,proposedFix.rationale ? `rationale ${proposedFix.rationale}` : undefined,],6,- 'proposed-fix facts',+ 'action-artifact facts',);- return detail ? `Proposed fix: ${detail}` : undefined;+ return detail ? `Existing action artifact: ${detail}` : undefined;}function normalizeApprovalBriefing(diff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.goindex 6b148ce4af..16858bc7d5 100644--- a/internal/ai/chat/agentic.go+++ b/internal/ai/chat/agentic.go@@ -706,9 +706,13 @@ func (a *AgenticLoop) executeWithTools(ctx context.Context, sessionID string, me// Inject a minimal, factual constraint - not a narrative or example.// This tells the model what is required, not how to do it.+ verifyTarget := strings.TrimSpace(fsm.LastWriteTool)+ if verifyTarget == "" {+ verifyTarget = "the changed target"+ }verifyPrompt := fmt.Sprintf(- "Verification required: perform a read or status check on %s before responding.",- fsm.LastWriteTool,+ "Verification evidence is required before responding about the write result for %s. Decide what available evidence or tool call is appropriate to verify the current state.",+ verifyTarget,)// Update the last assistant message to include verification constraintdiff --git a/internal/ai/chat/agentic_prompt.go b/internal/ai/chat/agentic_prompt.goindex 2d19943109..5cda92a251 100644--- a/internal/ai/chat/agentic_prompt.go+++ b/internal/ai/chat/agentic_prompt.go@@ -11,15 +11,15 @@ func (a *AgenticLoop) getSystemPrompt() string {if isAutonomous {modeContext = `EXECUTION MODE: Autonomous-Commands execute immediately without user approval. Follow the Discover → Investigate → Act-workflow. Gather information before taking action. Use the tools freely to explore logs, check-status, and understand the situation before attempting fixes.`+Commands may execute without per-command approval when policy allows. Decide whether current+context is enough, whether read-only evidence is needed, or whether a state-changing tool is+appropriate. Prefer current evidence before changing state.`} else {modeContext = `EXECUTION MODE: Controlled-Commands require user approval before execution. The system handles this automatically via a-confirmation prompt - you don't need to ask "Would you like me to...?" Just execute what's-needed and the system will prompt the user to approve if required.`+State-changing tools require governed approval when policy says approval is required. If the+user asks you to perform an action, choose the appropriate tool and Pulse will handle any+required approval prompt.`}prompt := a.baseSystemPrompt + modeContextdiff --git a/internal/ai/chat/fsm.go b/internal/ai/chat/fsm.goindex 5202ca3223..63d28a2b3c 100644--- a/internal/ai/chat/fsm.go+++ b/internal/ai/chat/fsm.go@@ -161,13 +161,13 @@ func (fsm *SessionFSM) cleanupExpiredRecoveries() {func (fsm *SessionFSM) CanExecuteTool(kind ToolKind, toolName string) error {switch fsm.State {case StateResolving:- // In RESOLVING, only allow resolve/read tools (must discover before writing)+ // In RESOLVING, state-changing tools require validated target/resource context.if kind == ToolKindWrite {return &FSMBlockedError{State: fsm.State,ToolName: toolName,ToolKind: kind,- Reason: "BLOCKED: Call pulse_query first to discover resources, then retry this action.",+ Reason: "POLICY_BLOCKED: state-changing tools require a validated target/resource context. Establish the target from current context or available tools, then retry only if the requested action still fits.",Recoverable: true,}}@@ -182,7 +182,7 @@ func (fsm *SessionFSM) CanExecuteTool(kind ToolKind, toolName string) error {return nilcase StateVerifying:- // In VERIFYING, only allow read/resolve tools until verification is complete+ // In VERIFYING, state-changing tools wait for current verification evidence.if kind == ToolKindWrite {fsm.ConsecutiveVerifyBlocks++if fsm.ConsecutiveVerifyBlocks >= 3 {@@ -197,7 +197,7 @@ func (fsm *SessionFSM) CanExecuteTool(kind ToolKind, toolName string) error {State: fsm.State,ToolName: toolName,ToolKind: kind,- Reason: "BLOCKED: Call pulse_query or pulse_read NEXT to verify your last action, then retry.",+ Reason: "POLICY_BLOCKED: the previous state-changing tool call still needs current verification evidence. Gather evidence for the changed target, then retry only if another action is still needed.",Recoverable: true,}}@@ -213,7 +213,7 @@ func (fsm *SessionFSM) CanFinalAnswer() error {if fsm.State == StateVerifying && !fsm.ReadAfterWrite {return &FSMBlockedError{State: fsm.State,- Reason: "BLOCKED: Call pulse_query or pulse_read to verify your last action before responding.",+ Reason: "POLICY_BLOCKED: the previous state-changing tool call needs current verification evidence before responding about the result.",Recoverable: true,}}diff --git a/internal/ai/chat/fsm_test.go b/internal/ai/chat/fsm_test.goindex 2a7c90d7af..2566b34b94 100644--- a/internal/ai/chat/fsm_test.go+++ b/internal/ai/chat/fsm_test.go@@ -1,6 +1,7 @@package chatimport (+ "strings""testing")@@ -41,6 +42,51 @@ func TestFSM_WriteBlockedInResolving(t *testing.T) {}}+func TestFSMPolicyBlocksDoNotForceNextTool(t *testing.T) {+ assertNoForcedTool := func(t *testing.T, reason string) {+ t.Helper()+ forbidden := []string{+ "Call pulse_query",+ "Call pulse_read",+ "pulse_query first",+ "pulse_read NEXT",+ "required next tool",+ "Discover → Investigate → Act",+ }+ for _, phrase := range forbidden {+ if strings.Contains(reason, phrase) {+ t.Fatalf("policy block forces model tool routing with %q in %q", phrase, reason)+ }+ }+ if !strings.Contains(reason, "POLICY_BLOCKED") {+ t.Fatalf("policy block should keep explicit boundary code, got %q", reason)+ }+ }++ resolveFSM := NewSessionFSM()+ resolveErr, ok := resolveFSM.CanExecuteTool(ToolKindWrite, "pulse_control").(*FSMBlockedError)+ if !ok {+ t.Fatalf("expected resolving FSMBlockedError, got %T", resolveErr)+ }+ assertNoForcedTool(t, resolveErr.Reason)++ verifyFSM := NewSessionFSM()+ verifyFSM.OnToolSuccess(ToolKindResolve, "pulse_query")+ verifyFSM.OnToolSuccess(ToolKindWrite, "pulse_control")++ writeErr, ok := verifyFSM.CanExecuteTool(ToolKindWrite, "pulse_docker").(*FSMBlockedError)+ if !ok {+ t.Fatalf("expected verifying write FSMBlockedError, got %T", writeErr)+ }+ assertNoForcedTool(t, writeErr.Reason)++ finalErr, ok := verifyFSM.CanFinalAnswer().(*FSMBlockedError)+ if !ok {+ t.Fatalf("expected verifying final-answer FSMBlockedError, got %T", finalErr)+ }+ assertNoForcedTool(t, finalErr.Reason)+}+func TestFSM_WriteCausesVerifying(t *testing.T) {fsm := NewSessionFSM()@@ -252,7 +298,7 @@ func TestClassifyToolCall(t *testing.T) {{"pulse_knowledge recall", "pulse_knowledge", map[string]interface{}{"action": "recall"}, ToolKindRead},{"pulse_knowledge remember", "pulse_knowledge", map[string]interface{}{"action": "remember"}, ToolKindWrite},- // Unknown tool defaults to write (security-safe: requires discovery first)+ // Unknown tool defaults to write so state-changing safety policy applies.{"unknown_tool", "some_new_tool", nil, ToolKindWrite},// Action parameter fallbackdiff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.goindex 4b23087c2d..09de2fe614 100644--- a/internal/ai/chat/service.go+++ b/internal/ai/chat/service.go@@ -1348,7 +1348,7 @@ func buildHandoffActionContext(handoffActions []HandoffAction) string {appendHandoffContextLine(&b, label+" Action Dry Run Summary", action.ActionDryRunSummary)appendHandoffContextLine(&b, label+" Action Result", action.ActionResult)appendHandoffContextLine(&b, label+" Fix ID", action.FixID)- appendHandoffContextLine(&b, label+" Proposed Fix", action.Description)+ appendHandoffContextLine(&b, label+" Existing Action Artifact", action.Description)appendHandoffContextLine(&b, label+" Risk", action.RiskLevel)if action.Destructive {appendHandoffContextLine(&b, label+" Destructive", "true")@@ -2694,9 +2694,9 @@ You are like a colleague doing pair programming on infrastructure tasks. Tool ca5. BE DIRECT: Acknowledge mistakes or complications honestly. If something won't work as the user expects, say so clearly.## TASK COMPLETION-- After successful control actions, the system auto-verifies. Once verified, stop making tool calls and respond.-- If a tool call is BLOCKED, read the error message carefully and follow its instructions exactly.-- If a tool call is BLOCKED, use the returned facts and policy boundary to decide whether more read context, a different governed tool call, or user clarification is needed.`+- After successful control actions, respond once you have enough evidence to explain the result.+- If a tool call is blocked, treat the result as a policy boundary, not a tool-routing instruction.+- Use the returned facts and policy boundary to decide whether more context, a different governed tool call, or user clarification is needed.`}func (s *Service) buildToolGovernancePromptSection() string {diff --git a/internal/ai/chat/service_execute_additional_test.go b/internal/ai/chat/service_execute_additional_test.goindex ac502cdca5..c43e4f1bb8 100644--- a/internal/ai/chat/service_execute_additional_test.go+++ b/internal/ai/chat/service_execute_additional_test.go@@ -929,15 +929,15 @@ func TestService_ExecuteStream_OperatorBriefingHandoffHonorsResourcePolicy(t *te}req := ExecuteRequest{- SessionID: "sess-operator-briefing-policy",+ SessionID: "sess-finding-briefing-policy",Prompt: "What happened?",HandoffContext: strings.Join([]string{- "[Operator Briefing]",+ "[Finding Briefing]","Briefing Source: Pulse Patrol structured finding","Resource: finance-vm (vm) [vm-100] on pve-secret","Current Conclusion: finance-vm on pve-secret saturated CPU during backup.","Attached Context: finance-payroll backup completion is relevant.",- "Operator Boundary: Treat Patrol data as product context for explanation and review.",+ "Model Boundary: Treat Patrol data as product context for explanation and review.",}, "\n"),HandoffResources: []HandoffResource{{ID: "vm-100",@@ -950,7 +950,7 @@ func TestService_ExecuteStream_OperatorBriefingHandoffHonorsResourcePolicy(t *tet.Fatalf("ExecuteStream failed: %v", err)}- stored, err := store.GetMessages("sess-operator-briefing-policy")+ stored, err := store.GetMessages("sess-finding-briefing-policy")if err != nil {t.Fatalf("GetMessages failed: %v", err)}@@ -960,8 +960,8 @@ func TestService_ExecuteStream_OperatorBriefingHandoffHonorsResourcePolicy(t *teif stored[0].Content != "What happened?" {t.Fatalf("stored user message = %q, want clean prompt", stored[0].Content)}- if strings.Contains(stored[0].Content, "[Operator Briefing]") {- t.Fatalf("stored user message should not include operator briefing: %q", stored[0].Content)+ if strings.Contains(stored[0].Content, "[Finding Briefing]") {+ t.Fatalf("stored user message should not include finding briefing: %q", stored[0].Content)}if len(capturedMessages) == 0 {@@ -969,7 +969,7 @@ func TestService_ExecuteStream_OperatorBriefingHandoffHonorsResourcePolicy(t *te}modelUserContent := capturedMessages[len(capturedMessages)-1].Contentfor _, expected := range []string{- "[Operator Briefing]",+ "[Finding Briefing]","Resource: redacted by policy (vm) [redacted by policy] on redacted by policy","Current Conclusion: redacted by policy on redacted by policy saturated CPU during backup.","Attached Context: redacted by policy backup completion is relevant.",diff --git a/internal/ai/patrol_assistant_handoff.go b/internal/ai/patrol_assistant_handoff.goindex 70f993d9eb..fee054e0ca 100644--- a/internal/ai/patrol_assistant_handoff.go+++ b/internal/ai/patrol_assistant_handoff.go@@ -63,7 +63,7 @@ func buildPatrolRunAssistantContext(run PatrolRunRecord, runType, status, runtimformatPatrolRunContextLine("Effort", patrolRunEffortSummary(run)),formatPatrolRunContextLine("Findings Summary", run.FindingsSummary),formatPatrolRunContextLine("Patrol Analysis", truncatePatrolRunContextText(sanitizePatrolRunAnalysis(run.AIAnalysis), 500)),- "Operator Boundary: This Patrol run handoff is model-only context for explanation and review. Configuration changes, diagnostics, remediation, and command execution require explicit governed operator action.",+ "Model Boundary: This Patrol run handoff is model-only context for explanation and review. Configuration changes, diagnostics, remediation, and command execution require explicit governed operator action.",}filtered := make([]string, 0, len(lines))diff --git a/internal/ai/patrol_assistant_handoff_test.go b/internal/ai/patrol_assistant_handoff_test.goindex c5a6f43d7f..c181c2bfc0 100644--- a/internal/ai/patrol_assistant_handoff_test.go+++ b/internal/ai/patrol_assistant_handoff_test.go@@ -54,7 +54,7 @@ func TestBuildPatrolRunAssistantHandoffUsesBackendSafeRunContext(t *testing.T) {"Runtime Failure: Selected model does not support Patrol tools","no tool-capable endpoint","Patrol Analysis: Visible runtime summary.",- "Operator Boundary:",+ "Model Boundary:",} {if !strings.Contains(handoff.Context, required) {t.Fatalf("context missing %q in:\n%s", required, handoff.Context)diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.goindex eadcc4be85..c08bd79c15 100644--- a/internal/api/ai_handler.go+++ b/internal/api/ai_handler.go@@ -1030,7 +1030,7 @@ func buildUnifiedFindingChatContext(f *unified.UnifiedFinding, lookup unifiedFin}var b strings.Builder- appendUnifiedFindingOperatorBriefingContext(&b, f, handoffActions)+ appendUnifiedFindingModelBriefingContext(&b, f, handoffActions)appendChatContextLine(&b, "[Finding Context]", "")appendChatContextLine(&b, "ID", f.ID)appendChatContextLine(&b, "Title", f.Title)@@ -1211,7 +1211,6 @@ func isSafePatrolFindingRequestHandoffLine(line string) bool {"Last Seen At","Recurrence","Description",- "Attention","Investigation Record","Investigation Status","Investigation Outcome",@@ -1230,10 +1229,9 @@ func isSafePatrolFindingRequestHandoffLine(line string) bool {"Action Plan Summary","Action Preflight","Dry-Run Posture",- "Proposed Fix",- "Operator Decision",+ "Existing Action Artifact","Command Boundary",- "Operator Boundary":+ "Model Boundary":return truedefault:return false@@ -1453,7 +1451,7 @@ func formatUnifiedRelatedFindingSummary(f *unified.UnifiedFinding) string {return strings.Join(parts, " | ")}-func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) {+func appendUnifiedFindingModelBriefingContext(b *strings.Builder, f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) {if b == nil || f == nil {return}@@ -1463,15 +1461,11 @@ func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.briefingSource = "Pulse Patrol structured finding"}- appendChatContextLine(b, "[Operator Briefing]", "")+ appendChatContextLine(b, "[Finding Briefing]", "")appendChatContextLine(b, "Briefing Source", briefingSource)- appendChatContextLine(b, "Operator Role", "Explain the investigation, highlight current risk, and guide the operator through evidence, approval, or continued monitoring.")appendChatContextLine(b, "Finding", formatUnifiedFindingBriefingFinding(f))appendChatContextLine(b, "Resource", formatUnifiedFindingBriefingResource(f))appendChatContextLine(b, "Priority", formatUnifiedFindingBriefingPriority(f))- if attention := unifiedFindingBriefingAttention(f); attention != "" {- appendChatContextLine(b, "Attention Reason", attention)- }appendChatContextLine(b, "Recency", formatUnifiedFindingBriefingRecencyFacts(f))appendChatContextLine(b, "Investigation", formatUnifiedFindingBriefingInvestigation(f))if evidence := unifiedFindingBriefingEvidence(f); evidence != "" {@@ -1484,11 +1478,10 @@ func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.appendChatContextLine(b, "Latest Lifecycle Event", latestLifecycle)}appendChatContextLine(b, "Current Conclusion", unifiedFindingBriefingConclusion(f))- if decision := unifiedFindingBriefingOperatorDecision(f, handoffActions); decision != "" {- appendChatContextLine(b, "Operator Decision", decision)+ if actionContext := unifiedFindingBriefingActionContext(f, handoffActions); actionContext != "" {+ appendChatContextLine(b, "Governed Action Context", actionContext)}- appendChatContextLine(b, "Action Posture", unifiedFindingBriefingActionPosture(f, handoffActions))- appendChatContextLine(b, "Operator Boundary", "Treat Patrol data as product context for explanation and review; do not invent commands, expose raw command text, or treat chat as approval or execution authority.")+ appendChatContextLine(b, "Model Boundary", "Treat Patrol data as context for explanation and review. Existing governed action artifacts are approval state, not remediation instructions. Do not invent commands, expose raw command text, or treat chat as approval or execution authority.")appendChatContextLine(b, "", "")}@@ -1560,79 +1553,6 @@ func formatUnifiedFindingBriefingPriority(f *unified.UnifiedFinding) string {return strings.Join(parts, "; ")}-func unifiedFindingBriefingAttention(f *unified.UnifiedFinding) string {- if f == nil {- return ""- }-- now := time.Now()- parts := make([]string, 0, 8)- status := unifiedFindingChatStatus(f, now)- switch status {- case "active":- if severity := strings.TrimSpace(string(f.Severity)); severity != "" {- parts = append(parts, "active "+severity+" finding")- } else {- parts = append(parts, "active finding")- }- case "resolved":- if f.RegressionCount > 0 {- parts = append(parts, "resolved after prior regression")- } else {- parts = append(parts, "resolved finding")- }- case "snoozed":- parts = append(parts, "snoozed finding")- case "dismissed":- parts = append(parts, "dismissed finding")- case "suppressed":- parts = append(parts, "suppressed finding")- }- if f.RegressionCount > 0 {- parts = append(parts, fmt.Sprintf("regressed %d times", f.RegressionCount))- } else if f.TimesRaised > 1 {- parts = append(parts, fmt.Sprintf("raised %d times", f.TimesRaised))- }- if f.LastRegressionAt != nil {- parts = append(parts, "last regression "+f.LastRegressionAt.Format(time.RFC3339))- }- if loopState := strings.TrimSpace(f.LoopState); loopState != "" {- parts = append(parts, "loop "+loopState)- }-- rec := f.InvestigationRecord- outcome := strings.TrimSpace(f.InvestigationOutcome)- if rec != nil {- outcome = strings.TrimSpace(string(rec.Outcome))- if approvalID := strings.TrimSpace(rec.ApprovalID); approvalID != "" {- parts = append(parts, "approval "+approvalID)- }- if rec.ProposedFix != nil && rec.ProposedFix.Destructive {- parts = append(parts, "destructive proposed fix")- }- }- switch aicontracts.InvestigationOutcome(outcome) {- case aicontracts.OutcomeFixQueued:- parts = append(parts, "fix queued for governed review")- case aicontracts.OutcomeFixExecuted:- parts = append(parts, "fix executed awaiting verification")- case aicontracts.OutcomeFixFailed:- parts = append(parts, "fix failed")- case aicontracts.OutcomeFixVerificationFailed:- parts = append(parts, "verification failed")- case aicontracts.OutcomeFixVerificationUnknown:- parts = append(parts, "verification inconclusive")- case aicontracts.OutcomeNeedsAttention:- parts = append(parts, "needs operator attention")- case aicontracts.OutcomeCannotFix:- parts = append(parts, "Patrol cannot safely fix")- case aicontracts.OutcomeTimedOut:- parts = append(parts, "Patrol timed out")- }-- return formatBriefingStringList(parts, 8, "attention facts")-}-func formatUnifiedFindingBriefingRecency(f *unified.UnifiedFinding) string {if f == nil {return ""@@ -1748,81 +1668,6 @@ func unifiedFindingBriefingVerification(f *unified.UnifiedFinding) string {return formatBriefingStringList(f.InvestigationRecord.Verification, 2, "verification")}-func unifiedFindingBriefingOperatorDecision(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) string {- if f == nil {- return ""- }- if unifiedFindingChatStatus(f, time.Now()) == "resolved" {- return "Finding is resolved; explain the resolution and monitoring follow-up without proposing execution."- }-- if action, ok := unifiedFindingPrimaryHandoffAction(f, handoffActions); ok {- if decision := unifiedFindingHandoffActionOperatorDecision(action); decision != "" {- return decision- }- }-- rec := f.InvestigationRecord- if rec != nil {- if approvalID := strings.TrimSpace(rec.ApprovalID); approvalID != "" {- parts := []string{"review governed approval " + approvalID + " before execution"}- if rec.ProposedFix != nil {- if fixID := strings.TrimSpace(rec.ProposedFix.ID); fixID != "" {- parts = append(parts, "proposed fix "+fixID)- } else if description := strings.TrimSpace(rec.ProposedFix.Description); description != "" {- parts = append(parts, "proposed fix recorded")- }- if risk := strings.TrimSpace(rec.ProposedFix.RiskLevel); risk != "" {- parts = append(parts, "risk "+risk)- }- if rec.ProposedFix.Destructive {- parts = append(parts, "destructive true")- }- }- return strings.Join(parts, "; ")- }-- switch rec.Outcome {- case aicontracts.OutcomeFixQueued:- return "Review the proposed fix in the governed approval or remediation flow before execution."- case aicontracts.OutcomeFixExecuted:- return "Verify the execution result before closing or resolving the finding."- case aicontracts.OutcomeFixFailed, aicontracts.OutcomeFixVerificationFailed:- return "Review failed remediation evidence before retrying or escalating."- case aicontracts.OutcomeFixVerificationUnknown:- return "Gather verification evidence before closing or retrying remediation."- case aicontracts.OutcomeNeedsAttention, aicontracts.OutcomeCannotFix:- return "Operator intervention is required; use the evidence to choose the next manual step."- case aicontracts.OutcomeTimedOut:- return "Patrol timed out; rerun investigation or gather more evidence before remediation."- }-- switch rec.Status {- case aicontracts.InvestigationStatusPending, aicontracts.InvestigationStatusRunning:- return "Wait for Patrol to finish the investigation before approving remediation."- case aicontracts.InvestigationStatusFailed:- return "Review the Patrol investigation failure and gather evidence before remediation."- case aicontracts.InvestigationStatusNeedsAttention:- return "Operator intervention is required; use the evidence to choose the next manual step."- }- }-- if remediationID := strings.TrimSpace(f.RemediationID); remediationID != "" {- return "Review governed remediation " + remediationID + " before execution."- }- loopState := strings.ToLower(strings.TrimSpace(f.LoopState))- switch {- case strings.Contains(loopState, "approval"):- return "Review the governed approval flow before execution."- case strings.Contains(loopState, "investigat"):- return "Wait for Patrol to finish the investigation before approving remediation."- }- if unifiedFindingChatStatus(f, time.Now()) == "active" {- return "Continue investigation or monitoring; no governed action reference is ready."- }- return ""-}-func formatInvestigationRecordEvidenceBriefing(evidence []aicontracts.InvestigationRecordEvidence, limit int) string {if limit <= 0 || len(evidence) == 0 {return ""@@ -1884,7 +1729,7 @@ func formatBriefingStringList(values []string, limit int, itemName string) strinreturn strings.Join(parts, "; ")}-func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) string {+func unifiedFindingBriefingActionContext(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) string {if f == nil {return ""}@@ -1907,9 +1752,9 @@ func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding, handoffActio}if rec.ProposedFix != nil {if fixID := strings.TrimSpace(rec.ProposedFix.ID); fixID != "" {- parts = append(parts, "proposed fix "+fixID)+ parts = append(parts, "action artifact "+fixID)} else if description := strings.TrimSpace(rec.ProposedFix.Description); description != "" {- parts = append(parts, "proposed fix recorded")+ parts = append(parts, "action artifact recorded")}if risk := strings.TrimSpace(rec.ProposedFix.RiskLevel); risk != "" {parts = append(parts, "risk "+risk)@@ -1923,7 +1768,7 @@ func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding, handoffActioparts = append(parts, "remediation "+remediationID)}if len(parts) == 0 {- return "No governed action is ready; keep the response investigative."+ return ""}return strings.Join(parts, "; ")}@@ -1964,53 +1809,6 @@ func handoffActionHasBriefingValue(action chat.HandoffAction) bool {return action.Destructive || action.ApprovalConsumed || action.ActionRequiresApproval}-func unifiedFindingHandoffActionOperatorDecision(action chat.HandoffAction) string {- parts := make([]string, 0, 6)- if approvalID := strings.TrimSpace(action.ApprovalID); approvalID != "" {- parts = append(parts, "review governed approval "+approvalID+" before execution")- } else if actionID := strings.TrimSpace(action.ActionID); actionID != "" {- parts = append(parts, "review governed action "+actionID+" before execution")- } else if strings.TrimSpace(action.FixID) != "" || strings.TrimSpace(action.Description) != "" {- parts = append(parts, "review the proposed fix before execution")- }- 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 requestedBy := strings.TrimSpace(action.ActionRequestedBy); requestedBy != "" {- parts = append(parts, "requested by "+requestedBy)- }- 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 != "" {- parts = append(parts, "proposed fix recorded")- }- if risk := strings.TrimSpace(action.RiskLevel); risk != "" {- parts = append(parts, "risk "+risk)- }- if action.Destructive {- parts = append(parts, "destructive true")- }- return strings.Join(parts, "; ")-}-func unifiedFindingHandoffActionPosture(action chat.HandoffAction) string {parts := make([]string, 0, 8)if approvalID := strings.TrimSpace(action.ApprovalID); approvalID != "" {@@ -2050,9 +1848,9 @@ func unifiedFindingHandoffActionPosture(action chat.HandoffAction) string {parts = append(parts, "plan expires "+planExpiresAt)}if fixID := strings.TrimSpace(action.FixID); fixID != "" {- parts = append(parts, "proposed fix "+fixID)+ parts = append(parts, "action artifact "+fixID)} else if description := strings.TrimSpace(action.Description); description != "" {- parts = append(parts, "proposed fix recorded")+ parts = append(parts, "action artifact recorded")}if risk := strings.TrimSpace(action.RiskLevel); risk != "" {parts = append(parts, "risk "+risk)@@ -2187,19 +1985,19 @@ func appendInvestigationRecordChatContext(b *strings.Builder, rec *aicontracts.IappendStringListChatContext(b, "Tools Used", rec.ToolsUsed)if rec.ProposedFix != nil {- appendChatContextLine(b, "Proposed Fix", rec.ProposedFix.Description)- appendChatContextLine(b, "Proposed Fix Risk", rec.ProposedFix.RiskLevel)- appendChatContextLine(b, "Proposed Fix Target Host", rec.ProposedFix.TargetHost)- appendChatContextLine(b, "Proposed Fix Rationale", rec.ProposedFix.Rationale)+ appendChatContextLine(b, "Existing Action Artifact", rec.ProposedFix.Description)+ appendChatContextLine(b, "Existing Action Artifact Risk", rec.ProposedFix.RiskLevel)+ appendChatContextLine(b, "Existing Action Artifact Target Host", rec.ProposedFix.TargetHost)+ appendChatContextLine(b, "Existing Action Artifact Rationale", rec.ProposedFix.Rationale)if rec.ProposedFix.Destructive {- appendChatContextLine(b, "Proposed Fix Destructive", "true")+ appendChatContextLine(b, "Existing Action Artifact Destructive", "true")}switch len(rec.ProposedFix.Commands) {case 0:case 1:- appendChatContextLine(b, "Proposed Fix Commands", "1 command recorded for approval context")+ appendChatContextLine(b, "Existing Action Artifact Commands", "1 command recorded for approval context")default:- appendChatContextLine(b, "Proposed Fix Commands", fmt.Sprintf("%d commands recorded for approval context", len(rec.ProposedFix.Commands)))+ appendChatContextLine(b, "Existing Action Artifact Commands", fmt.Sprintf("%d commands recorded for approval context", len(rec.ProposedFix.Commands)))}}}diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.goindex a40a6729f2..5348b13397 100644--- a/internal/api/ai_handler_test.go+++ b/internal/api/ai_handler_test.go@@ -1070,12 +1070,12 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {if assert.NotNil(t, reqArg.AutonomousMode) {assert.False(t, *reqArg.AutonomousMode)}- assert.Contains(t, reqArg.HandoffContext, "[Operator Briefing]")+ assert.Contains(t, reqArg.HandoffContext, "[Finding Briefing]")assert.Contains(t, reqArg.HandoffContext, "Briefing Source: Pulse Patrol structured finding")assert.Contains(t, reqArg.HandoffContext, "Finding: High CPU usage (critical, performance, active)")assert.Contains(t, reqArg.HandoffContext, "Resource: web-server (vm) [vm-100] on pve-1")assert.Contains(t, reqArg.HandoffContext, "Priority: critical performance; status active; loop awaiting_approval; raised 3 times; regressed 2 times")- assert.Contains(t, reqArg.HandoffContext, "Attention Reason: active critical finding; regressed 2 times; last regression 2026-05-06T12:06:00Z; loop awaiting_approval; approval approval-123; destructive proposed fix; fix queued for governed review")+ assert.NotContains(t, reqArg.HandoffContext, "Attention Reason:")assert.Contains(t, reqArg.HandoffContext, "Recency: detected 2026-05-06T12:00:00Z; last seen 2026-05-06T12:02:00Z; raised 3 times; regressed 2 times; last regression 2026-05-06T12:06:00Z")assert.Contains(t, reqArg.HandoffContext, "Investigation: completed; outcome fix_queued; confidence high; attempts 1")assert.Contains(t, reqArg.HandoffContext, "Evidence Snapshot: metrics: CPU stayed above 95% for 10 minutes")@@ -1083,9 +1083,9 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {assert.Contains(t, reqArg.HandoffContext, "Latest Lifecycle Event: 2026-05-06T12:03:00Z | investigation_completed | Fix queued for approval | investigating -> fix_queued")assert.Contains(t, reqArg.HandoffContext, "Current Conclusion: Backup job saturated CPU.")assert.NotContains(t, reqArg.HandoffContext, "Recommended Next Step:")- assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-123 before execution; proposed fix fix-123; risk medium; destructive true")- assert.Contains(t, reqArg.HandoffContext, "Action Posture: approval approval-123; proposed fix fix-123; risk medium; destructive true; remediation remediation-123")- assert.Contains(t, reqArg.HandoffContext, "Operator Boundary: Treat Patrol data as product context for explanation and review")+ assert.NotContains(t, reqArg.HandoffContext, "Operator Decision:")+ assert.Contains(t, reqArg.HandoffContext, "Governed Action Context: approval approval-123; action artifact fix-123; risk medium; destructive true; remediation remediation-123")+ assert.Contains(t, reqArg.HandoffContext, "Model Boundary: Treat Patrol data as context for explanation and review")assert.Contains(t, reqArg.HandoffContext, "[Finding Context]")assert.Contains(t, reqArg.HandoffContext, "[Investigation Record]")assert.Contains(t, reqArg.HandoffContext, "Finding Status: active")@@ -1115,8 +1115,8 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {assert.Contains(t, reqArg.HandoffContext, "Conclusion: Backup job saturated CPU.")assert.Contains(t, reqArg.HandoffContext, "Recorded Action Note: Approve a controlled service restart after backup completion.")assert.Contains(t, reqArg.HandoffContext, "Evidence 1: metrics: CPU stayed above 95% for 10 minutes")- assert.Contains(t, reqArg.HandoffContext, "Proposed Fix: Restart the workload service")- assert.Contains(t, reqArg.HandoffContext, "Proposed Fix Commands: 1 command recorded for approval context")+ assert.Contains(t, reqArg.HandoffContext, "Existing Action Artifact: Restart the workload service")+ assert.Contains(t, reqArg.HandoffContext, "Existing Action Artifact Commands: 1 command recorded for approval context")assert.NotContains(t, reqArg.HandoffContext, "User message: What happened?")assert.NotContains(t, reqArg.HandoffContext, "systemctl restart workload.service")assert.Equal(t, []chat.HandoffResource{{@@ -1195,14 +1195,14 @@ func TestHandleChat_MergesSafePatrolFindingRequestHandoffContext(t *testing.T) {Run(func(args mock.Arguments) {reqArg := args.Get(1).(chat.ExecuteRequest)assert.Equal(t, "finding-123", reqArg.FindingID)- assert.Contains(t, reqArg.HandoffContext, "[Operator Briefing]")+ assert.Contains(t, reqArg.HandoffContext, "[Finding Briefing]")assert.Contains(t, reqArg.HandoffContext, "[Finding Context]")assert.Contains(t, reqArg.HandoffContext, "[Product Handoff Context]")assert.Contains(t, reqArg.HandoffContext, "[Patrol Finding Context]")assert.Contains(t, reqArg.HandoffContext, "Source: Pulse Patrol finding handoff")assert.Contains(t, reqArg.HandoffContext, "Finding ID: finding-123")assert.Contains(t, reqArg.HandoffContext, "Dry-Run Posture: One service restart would be attempted.")- assert.Contains(t, reqArg.HandoffContext, "Operator Decision: Review approval approval-frontend before execution.")+ assert.NotContains(t, reqArg.HandoffContext, "Operator Decision:")assert.Contains(t, reqArg.HandoffContext, "Product Handoff Boundary: This product-originated Patrol handoff is secondary to backend-refreshed canonical finding context")assert.NotContains(t, reqArg.HandoffContext, "Raw Command")assert.NotContains(t, reqArg.HandoffContext, "systemctl restart workload.service")@@ -1366,9 +1366,9 @@ func TestHandleChat_RecoversLivePatrolApprovalForFindingHandoffAction(t *testingTargetResourceType: "vm",TargetNode: "pve-1",}}, reqArg.HandoffActions)- assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-live before execution; approval status pending; approval expires "+approvalExpiresAt+"; action action-live; requested by pulse_patrol; 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; requested by pulse_patrol; 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, "Operator Decision:")+ assert.Contains(t, reqArg.HandoffContext, "Governed Action Context: approval approval-live; approval status pending; approval requested "+approvalRequestedAt+"; approval expires "+approvalExpiresAt+"; action action-live; requested by pulse_patrol; approval policy admin; action requires approval true; plan expires "+actionPlanExpiresAt+"; action artifact fix-123; risk high; destructive true")+ assert.NotContains(t, reqArg.HandoffContext, "Governed Action Context: action artifact 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.goindex 19b2dfeaf0..d202837ad0 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -248,21 +248,19 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"formatUnifiedFindingLatestLifecycleEvent(f.Lifecycle)","[Finding Lifecycle Context]","Lifecycle Boundary",- "appendUnifiedFindingOperatorBriefingContext(&b, f, handoffActions)",- "[Operator Briefing]",+ "appendUnifiedFindingModelBriefingContext(&b, f, handoffActions)",+ "[Finding Briefing]",`appendChatContextLine(b, "Recency", formatUnifiedFindingBriefingRecencyFacts(f))`,"formatUnifiedFindingBriefingRecencyFacts(f)",- `appendChatContextLine(b, "Attention Reason", attention)`,- "unifiedFindingBriefingAttention(f)",`appendChatContextLine(b, "Evidence Snapshot", evidence)`,`appendChatContextLine(b, "Verification", verification)`,"formatInvestigationRecordEvidenceBriefing","formatBriefingStringList",- `appendChatContextLine(b, "Operator Decision", decision)`,- "unifiedFindingBriefingOperatorDecision(f, handoffActions)",+ `appendChatContextLine(b, "Governed Action Context", actionContext)`,+ "unifiedFindingBriefingActionContext(f, handoffActions)","unifiedFindingPrimaryHandoffAction(f, handoffActions)","Latest Lifecycle Event",- "Operator Boundary",+ "Model Boundary",`return "suppressed"`,"Prompt:","HandoffContext:",@@ -304,7 +302,7 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"Source: Pulse Patrol run history","patrolRunAssistantHandoffResources","sanitizePatrolRunAnalysis",- "Operator Boundary",+ "Model Boundary",} {if !strings.Contains(patrolHandoffText, required) {t.Fatalf("Patrol runtime must own safe Assistant run handoff context: missing %q", required)