Wire pool resource targets through runner and repair quarantined-member handoff

This commit is contained in:
2026-10-18 23:20:55 +01:00
parent a4c7149060
commit a022b58c5c
10 changed files with 246 additions and 15 deletions
+26
View File
@@ -5,8 +5,34 @@ package stage
import (
"context"
"fmt"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
type resourceTargetContextKey struct{}
// WithResourceTarget attaches the server-granted concrete target to a stage's
// runtime context. It is deliberately separate from model input and contains
// no capability or credential material.
func WithResourceTarget(ctx context.Context, target *protocol.ResourceTarget) context.Context {
if target == nil {
return ctx
}
copy := &protocol.ResourceTarget{Member: target.Member}
if target.Metadata != nil {
copy.Metadata = map[string]string{}
for key, value := range target.Metadata {
copy.Metadata[key] = value
}
}
return context.WithValue(ctx, resourceTargetContextKey{}, copy)
}
func ResourceTarget(ctx context.Context) (*protocol.ResourceTarget, bool) {
target, ok := ctx.Value(resourceTargetContextKey{}).(*protocol.ResourceTarget)
return target, ok
}
// Values are runtime data, not the prose output contract in a definition.
type Values map[string]any