Files
Pulse/internal/ai/chat/invocation_identity.go
rcourtman c501376843 Preserve canonical Patrol planning and outcome continuity
Return persisted planning acceptance or refusal inside the investigation turn.
Keep model judgment separate from action authority and preserve accepted action
identity across provider failures. Enforce actor/request idempotency atomically
and retain complete approval and independent verification context.

Preserve unknown disk evidence, stream whitespace and historical resolution
timestamps. Keep conversation scrolling inside its own panel. Record real-model,
disposable-lab and browser qualification with explicit population limits.

Refs #1782
2026-09-07 17:24:25 +01:00

19 lines
555 B
Go

package chat
import (
"context"
"github.com/google/uuid"
"github.com/rcourtman/pulse-go-rewrite/internal/ai/tools"
)
func withRunInvocationIdentity(ctx context.Context, sessionID string, messages []Message) context.Context {
for i := len(messages) - 1; i >= 0; i-- {
if messages[i].Role == "user" && messages[i].ID != "" {
return tools.WithInvocationScope(ctx, sessionID, messages[i].ID)
}
}
// An unpersisted internal run still has one scope for all provider retries.
return tools.WithInvocationScope(ctx, sessionID, uuid.NewString())
}