Pulse/internal/ai
rcourtman e36945741e Sanitise plain-JSON tool-call leaks from weak local models
Small Ollama models (qwen2.5:11b, qwen2.5:14b, similar) frequently emit
Pulse tool invocations as plain JSON inside content instead of routing
through the structured tool_calls channel. Users saw raw payloads like
`{"name": "pulse_query", "parameters": {...}}` as the assistant's final
response.

Extend cleanToolCallArtifacts and containsToolCallMarker with a new pass
that detects this leak shape, gated on a closed allowlist of canonical
tool names sourced from the runtime registry. The allowlist auto-syncs
when registerTools() gains a tool, so no separate hand-maintained list.

Anchored on (?:^|\n) and a leading `"name"` key so prose containing JSON
fragments, unrelated objects (`{"foo":"bar"}`), or named resources
(`{"name":"my-vm","cpu":50}`) are left untouched.
2026-05-11 17:02:07 +01:00
..
adapters feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
approval Drop redundant policy gates in resource-link routing 2026-05-09 21:31:45 +01:00
baseline feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
chat Sanitise plain-JSON tool-call leaks from weak local models 2026-05-11 17:02:07 +01:00
circuit feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
correlation Normalize relationship terminology 2026-03-19 14:30:45 +00:00
cost Update DeepSeek Patrol defaults 2026-05-08 01:24:50 +01:00
eval feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
forecast feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
infradiscovery Align AI discovery lifecycle with discovery settings 2026-04-21 16:06:49 +01:00
knowledge Harden AI knowledge guest listing paths 2026-03-29 14:18:20 +01:00
learning feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
memory Harden AI memory persistence roots 2026-03-29 14:28:48 +01:00
modelboundary Enforce data policy at AI model boundary 2026-04-25 21:13:53 +01:00
patterns feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
providers Correct the DeepSeek tool_choice coercion rationale 2026-05-11 14:46:08 +01:00
proxmox Cap AI patrol history and correlation reads 2026-04-01 14:47:58 +01:00
safety feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
tools Sanitise plain-JSON tool-call leaks from weak local models 2026-05-11 17:02:07 +01:00
unified Attribute operator-driven Mark resolved closures as "Resolved by you" 2026-05-09 11:10:11 +01:00
agent_exec_test_helpers_test.go Align Patrol prober with agent command policy 2026-05-01 20:28:11 +01:00
alert_adapter.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
alert_adapter_test.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
alert_provider.go Require approval for backend alert investigation commands 2026-05-07 01:24:57 +01:00
alert_provider_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
alert_provider_test.go Require approval for backend alert investigation commands 2026-05-07 01:24:57 +01:00
alert_threshold_adapter.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
alert_threshold_adapter_test.go fix: Docker container update detection showing false positives 2025-12-29 13:49:04 +00:00
baseline_adapter.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
baseline_adapter_test.go fix: Docker container update detection showing false positives 2025-12-29 13:49:04 +00:00
baseline_exports.go feat(ai): Wire baseline learning loop into router startup 2025-12-12 11:29:47 +00:00
config.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
correlation_exports.go feat(ai): Add multi-resource correlation detection (Phase 6) 2025-12-12 14:26:10 +00:00
cost_persistence.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
cost_persistence_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
cost_recording_audit_test.go Fix QuickAnalysis cost recording and audit the pattern 2026-05-10 21:57:39 +01:00
coverage_increase_test.go Clarify canonical timeline ownership 2026-03-20 11:05:08 +00:00
demo.go Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
demo_test.go Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
discovery_adapter.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
discovery_adapter_test.go Align Patrol prober with agent command policy 2026-05-01 20:28:11 +01:00
exports_test.go Restore RC backend proof regressions 2026-04-09 20:15:17 +01:00
findings.go Purge resolved legacy alert-mirror findings on load 2026-05-11 11:40:07 +01:00
findings_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
findings_clustering_test.go feat(backend): implement AI Patrol, Investigation, and system-wide refactors 2026-01-30 19:02:14 +00:00
findings_coverage_test.go Purge resolved legacy alert-mirror findings on load 2026-05-11 11:40:07 +01:00
findings_dedup_test.go feat(backend): implement AI Patrol, Investigation, and system-wide refactors 2026-01-30 19:02:14 +00:00
findings_investigation_test.go feat(backend): implement AI Patrol, Investigation, and system-wide refactors 2026-01-30 19:02:14 +00:00
findings_lifecycle_test.go Drop duplicate loop_state lifecycle events for every transition 2026-05-10 18:12:03 +01:00
findings_persistence.go Add structured Patrol investigation records 2026-05-06 16:31:51 +01:00
findings_persistence_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
findings_resource_type_test.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
findings_suppression_persistence_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
findings_test.go Plumb operator-state and operational memory into investigation findings 2026-05-09 21:03:15 +01:00
findings_timeout_test.go feat(patrol): add timeout handling and shorter retry cooldown 2026-02-01 10:12:23 +00:00
findings_tools_adapter.go refactor(ai): Rename findings adapter and add chat patrol alias 2026-01-19 19:20:49 +00:00
findings_tools_adapter_test.go refactor(ai): Rename findings adapter and add chat patrol alias 2026-01-19 19:20:49 +00:00
incident_coordinator.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
incident_coordinator_additional_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
incident_coordinator_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
intelligence.go Suppress assessment error penalty after trailing-success recovery 2026-05-10 23:02:57 +01:00
intelligence_coverage_test.go Suppress assessment error penalty after trailing-success recovery 2026-05-10 23:02:57 +01:00
intelligence_test.go Route correlations through intelligence facade 2026-03-19 04:15:26 +00:00
investigation_records.go Lift remediation-plan rollback into investigation records 2026-05-08 18:17:19 +01:00
investigation_records_test.go Lift remediation-plan rollback into investigation records 2026-05-08 18:17:19 +01:00
kubernetes_analysis.go Audit unified AI exports 2026-03-18 17:22:24 +00:00
kubernetes_analysis_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
memory_exports.go feat(ai): Add operational memory (Phase 3) - change detection and remediation logging 2025-12-12 13:49:37 +00:00
metadata_provider.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
metadata_provider_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
metrics_history_adapter.go feat(ai): Add enriched context with historical trends and predictions 2025-12-12 09:45:57 +00:00
metrics_history_adapter_test.go fix: Docker container update detection showing false positives 2025-12-29 13:49:04 +00:00
mock_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
model_resolution.go Retire self-hosted AI quickstart surfaces 2026-04-28 15:49:18 +01:00
model_resolution_test.go Restore RC backend proof regressions 2026-04-09 20:15:17 +01:00
parity_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol.go Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
patrol_ai.go Stop mirroring alerts into Patrol findings 2026-05-10 21:33:41 +01:00
patrol_ai_additional_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_ai_eval_additional_test.go Stop mirroring alerts into Patrol findings 2026-05-10 21:33:41 +01:00
patrol_ai_intelligence_test.go Retire self-hosted AI quickstart surfaces 2026-04-28 15:49:18 +01:00
patrol_ai_more_test.go Own quickstart state and bill Patrol per run 2026-04-03 19:45:38 +01:00
patrol_ai_test.go fix(ai): filter DeepSeek DSML internal function-call format from responses 2026-02-01 18:07:41 +00:00
patrol_alerts_review_test.go Own quickstart state and bill Patrol per run 2026-04-03 19:45:38 +01:00
patrol_assistant_handoff.go Move Patrol run Assistant handoffs server-side 2026-05-07 21:58:06 +01:00
patrol_assistant_handoff_test.go Split overgreedy "tools not supported" classifier into three causes 2026-05-10 14:10:18 +01:00
patrol_context_additional_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_coverage_test.go Gate Patrol readiness across runtime entrypoints 2026-05-07 18:24:47 +01:00
patrol_findings.go Expose resolved findings to the Patrol Resolved tab 2026-05-11 11:09:03 +01:00
patrol_findings_additional_test.go Expose resolved findings to the Patrol Resolved tab 2026-05-11 11:09:03 +01:00
patrol_history_memory_regression_test.go test: add memory regression coverage for AI stores 2026-02-04 19:56:12 +00:00
patrol_history_persistence.go Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
patrol_history_persistence_test.go Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
patrol_init.go Persist Patrol settings with readiness handoff 2026-05-07 19:26:00 +01:00
patrol_init_additional_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_integration_test.go fix(patrol): improve service lifecycle, graceful shutdown, and concurrency 2026-02-01 16:27:25 +00:00
patrol_intelligence.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_intelligence_test.go Align Patrol prober with agent command policy 2026-05-01 20:28:11 +01:00
patrol_lifecycle_integration_test.go fix(patrol): improve service lifecycle, graceful shutdown, and concurrency 2026-02-01 16:27:25 +00:00
patrol_metrics.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_metrics_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_preflight.go Fix QuickAnalysis cost recording and audit the pattern 2026-05-10 21:57:39 +01:00
patrol_preflight_test.go Auto-trigger Patrol preflight when settings save moves Patrol transport 2026-05-10 16:14:26 +01:00
patrol_prober.go Align Patrol prober with agent command policy 2026-05-01 20:28:11 +01:00
patrol_prober_test.go Align Patrol prober with agent command policy 2026-05-01 20:28:11 +01:00
patrol_readiness.go Patrol runs are now stateless — drop prior session history 2026-05-10 17:14:47 +01:00
patrol_readiness_test.go Align DeepSeek V4 Patrol readiness 2026-05-08 11:34:07 +01:00
patrol_reconcile_test.go Gate stale-finding auto-resolve on category whitelist 2026-05-10 19:27:36 +01:00
patrol_resource_state_test.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
patrol_run.go Clear Patrol runtime issue after scoped success 2026-05-07 22:42:38 +01:00
patrol_run_additional_test.go Update Patrol provider setup guidance 2026-05-07 16:15:07 +01:00
patrol_run_test.go Retire hosted AI quickstart runtime 2026-04-28 16:11:27 +01:00
patrol_runtime_failure.go Patrol runs are now stateless — drop prior session history 2026-05-10 17:14:47 +01:00
patrol_runtime_failure_test.go Patrol runs are now stateless — drop prior session history 2026-05-10 17:14:47 +01:00
patrol_scoped_run_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_seed_budget_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_signals.go Stop mirroring alerts into Patrol findings 2026-05-10 21:33:41 +01:00
patrol_signals_test.go Stop mirroring alerts into Patrol findings 2026-05-10 21:33:41 +01:00
patrol_signals_vmid_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_state.go fix(patrol): split truenas from agent run history 2026-03-30 11:57:49 +01:00
patrol_stream_debug.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
patrol_test.go Surface trust metrics on the Patrol page 2026-05-08 21:11:24 +01:00
patrol_thresholds_test.go feat: add AI Intelligence system with investigation and forecasting 2026-01-24 22:41:43 +00:00
patrol_triage.go Retry Patrol with provider-derived seed budgets 2026-04-01 23:09:32 +01:00
patrol_triage_integration_test.go Own quickstart state and bill Patrol per run 2026-04-03 19:45:38 +01:00
patrol_triage_test.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
patrol_triggers.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
patrol_triggers_test.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
pattern_exports.go feat(ai): Add failure pattern detection for predictive intelligence (Phase 5) 2025-12-12 14:11:28 +00:00
report_findings.go Replace heuristic report narrative with optional AI-generated layer 2026-05-10 19:30:54 +01:00
report_findings_test.go Replace heuristic report narrative with optional AI-generated layer 2026-05-10 19:30:54 +01:00
report_fleet_narrator.go Forbid the report narrators from acting as parallel detectors 2026-05-10 22:02:10 +01:00
report_fleet_narrator_test.go Add fleet-level AI narrative for multi-resource reports 2026-05-10 21:23:12 +01:00
report_narrator.go Forbid the report narrators from acting as parallel detectors 2026-05-10 22:02:10 +01:00
report_narrator_test.go Record cost events for AI report narration 2026-05-10 21:08:51 +01:00
resource_context.go Enforce data handling in AI context 2026-04-25 20:41:13 +01:00
resource_context_policy_model.go Enforce data handling in AI context 2026-04-25 20:41:13 +01:00
resource_context_policy_model_test.go Enforce data handling in AI context 2026-04-25 20:41:13 +01:00
resource_context_test.go Enforce data handling in AI context 2026-04-25 20:41:13 +01:00
resource_export.go Canonicalize export redaction labels 2026-03-19 04:07:47 +00:00
resource_export_test.go Canonicalize export redaction labels 2026-03-19 04:07:47 +00:00
resource_type_legacy.go refactor(ai): canonicalize truenas host resource types 2026-03-30 13:34:08 +01:00
resource_type_legacy_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
routing.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
routing_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
sanitize_test.go refactor(ai): Remove over-engineered URL discovery service 2025-12-10 08:35:24 +00:00
service.go Record user-chat token usage to the cost ledger 2026-05-10 23:15:53 +01:00
service_coverage_imp_test.go Enforce data policy at AI model boundary 2026-04-25 21:13:53 +01:00
service_extended_test.go Keep direct DeepSeek Patrol models selectable 2026-05-08 11:57:04 +01:00
service_remediation_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
service_test.go Align AI discovery lifecycle with discovery settings 2026-04-21 16:06:49 +01:00
service_tools_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
target_host_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
test_remediation_engine_test.go feat: Pulse v6 release 2026-03-18 16:06:30 +00:00