From d29d9684dbbb644cce3e8260288e6e2f3712d960 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 9 Jun 2026 11:02:39 +0100 Subject: [PATCH] Assert discovery freshness reaches the model end-to-end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend the cloud-context e2e test to stamp the discovery with an UpdatedAt and assert "Last discovered: 2 days ago" reaches the model on both the handoff and @-mention paths — proving freshness survives the full ExecuteStream path (cloud policy, sanitizer allow-list, prompt injection), not just the formatter unit. Test-only. --- internal/ai/chat/service_execute_additional_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/ai/chat/service_execute_additional_test.go b/internal/ai/chat/service_execute_additional_test.go index a2751ccc6..db8ccdf4a 100644 --- a/internal/ai/chat/service_execute_additional_test.go +++ b/internal/ai/chat/service_execute_additional_test.go @@ -3705,9 +3705,11 @@ func newCloudOperationalContextService(t *testing.T) (*Service, *[]providers.Mes Identity: unifiedresources.ResourceIdentity{Hostnames: []string{"homeassistant", "delly-ha-host"}}, }}) + disc := homeAssistantDiscovery() + disc.UpdatedAt = now.Add(-2 * 24 * time.Hour) // exercise freshness end-to-end discoveryProvider := &mockDiscoveryProvider{ existing: map[string]*tools.ResourceDiscoveryInfo{ - "system-container:node1:101": homeAssistantDiscovery(), + "system-container:node1:101": disc, }, } unifiedProvider := handoffUnifiedProvider{resources: map[unifiedresources.ResourceType][]unifiedresources.Resource{ @@ -3752,6 +3754,7 @@ func TestService_ExecuteStream_DeliversCloudSafeOperationalContextToCloudModel(t "pct exec 101 -- docker exec homeassistant", "/config/automations.yaml", "8123", + "Last discovered: 2 days ago", // freshness reaches the model end-to-end } { if !strings.Contains(content, want) { t.Fatalf("model context missing operational detail %q:\n%s", want, content)