STET

agent_patch

runs/2026-02-28__13-38-10__gpt-5-1-codex-mini/flux-pr-1260/flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/agent-logs/agent.patch

8815 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/datasource/graphql_datasource/graphql_datasource.go b/app/v2/pkg/engine/datasource/graphql_datasource/graphql_datasource.go
index 6f35dbe..c108527 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/datasource/graphql_datasource/graphql_datasource.go
+++ b/app/v2/pkg/engine/datasource/graphql_datasource/graphql_datasource.go
@@ -461,6 +461,11 @@ func (p *Planner[T]) ConfigureSubscription() plan.SubscriptionConfiguration {
 		Variables:      p.variables,
 		PostProcessing: DefaultPostProcessingConfiguration,
 		QueryPlan:      p.queryPlan,
+		TriggerMetadata: &resolve.SubscriptionTriggerMetadata{
+			DataSourceID:   p.dataSourceConfig.Id(),
+			DataSourceName: p.dataSourceConfig.Name(),
+			QueryPlan:      p.queryPlan,
+		},
 	}
 }
 
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_configuration.go b/app/v2/pkg/engine/plan/datasource_configuration.go
index 07ec63e..c4b2234 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_configuration.go
+++ b/app/v2/pkg/engine/plan/datasource_configuration.go
@@ -430,9 +430,10 @@ type DataSourcePlanner[T any] interface {
 }
 
 type SubscriptionConfiguration struct {
-	Input          string
-	Variables      resolve.Variables
-	DataSource     resolve.SubscriptionDataSource
-	PostProcessing resolve.PostProcessingConfiguration
-	QueryPlan      *resolve.QueryPlan
+	Input           string
+	Variables       resolve.Variables
+	DataSource      resolve.SubscriptionDataSource
+	PostProcessing  resolve.PostProcessingConfiguration
+	QueryPlan       *resolve.QueryPlan
+	TriggerMetadata *resolve.SubscriptionTriggerMetadata
 }
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/visitor.go b/app/v2/pkg/engine/plan/visitor.go
index 3a95e8f..40c6f8a 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/visitor.go
+++ b/app/v2/pkg/engine/plan/visitor.go
@@ -1283,6 +1283,28 @@ func (v *Visitor) configureSubscription(config *objectFetchConfiguration) {
 	v.resolveInputTemplates(config, &subscription.Input, &v.subscription.Trigger.Variables)
 	v.subscription.Trigger.Input = []byte(subscription.Input)
 	v.subscription.Filter = config.filter
+
+	metadata := subscription.TriggerMetadata
+	if metadata != nil {
+		if metadata.DataSourceID == "" {
+			metadata.DataSourceID = config.sourceID
+		}
+		if metadata.DataSourceName == "" {
+			metadata.DataSourceName = config.sourceName
+		}
+		if metadata.QueryPlan == nil {
+			metadata.QueryPlan = subscription.QueryPlan
+		}
+	} else if config.sourceID != "" || config.sourceName != "" || subscription.QueryPlan != nil {
+		metadata = &resolve.SubscriptionTriggerMetadata{
+			DataSourceID:   config.sourceID,
+			DataSourceName: config.sourceName,
+			QueryPlan:      subscription.QueryPlan,
+		}
+	}
+	if metadata != nil {
+		v.subscription.Trigger.Metadata = metadata
+	}
 }
 
 func (v *Visitor) configureObjectFetch(config *objectFetchConfiguration) {
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/postprocess/postprocess.go b/app/v2/pkg/engine/postprocess/postprocess.go
index fa63dd2..f71515c 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/postprocess/postprocess.go
+++ b/app/v2/pkg/engine/postprocess/postprocess.go
@@ -203,8 +203,26 @@ func (p *Processor) createFetchTree(res *resolve.GraphQLResponse) {
 }
 
 func (p *Processor) appendTriggerToFetchTree(res *resolve.GraphQLSubscription) {
-	// Using json parser here because input is not yet valid JSON
-	v, _ := jsonparser.GetString(res.Trigger.Input, "body", "query")
+	var (
+		query      string
+		queryPlan  *resolve.QueryPlan
+		sourceID   string
+		sourceName string
+	)
+
+	if res.Trigger.Metadata != nil {
+		sourceID = res.Trigger.Metadata.DataSourceID
+		sourceName = res.Trigger.Metadata.DataSourceName
+		if res.Trigger.Metadata.QueryPlan != nil {
+			queryPlan = res.Trigger.Metadata.QueryPlan
+			query = queryPlan.Query
+		}
+	}
+
+	if query == "" {
+		// Using json parser here because input is not yet valid JSON
+		query, _ = jsonparser.GetString(res.Trigger.Input, "body", "query")
+	}
 
 	rootData := res.Response.Data
 	if rootData == nil || len(rootData.Fields) == 0 {
@@ -216,6 +234,21 @@ func (p *Processor) appendTriggerToFetchTree(res *resolve.GraphQLSubscription) {
 		return
 	}
 
+	if sourceID == "" && len(info.Source.IDs) > 0 {
+		sourceID = info.Source.IDs[0]
+	}
+	if sourceName == "" && len(info.Source.Names) > 0 {
+		sourceName = info.Source.Names[0]
+	}
+
+	if queryPlan == nil {
+		queryPlan = &resolve.QueryPlan{
+			Query: query,
+		}
+	} else if queryPlan.Query == "" {
+		queryPlan.Query = query
+	}
+
 	res.Response.Fetches.Trigger = &resolve.FetchTreeNode{
 		Kind: resolve.FetchTreeNodeKindTrigger,
 		Item: &resolve.FetchItem{
@@ -224,11 +257,9 @@ func (p *Processor) appendTriggerToFetchTree(res *resolve.GraphQLSubscription) {
 					FetchID: info.FetchID,
 				},
 				Info: &resolve.FetchInfo{
-					DataSourceID:   info.Source.IDs[0],
-					DataSourceName: info.Source.Names[0],
-					QueryPlan: &resolve.QueryPlan{
-						Query: v,
-					},
+					DataSourceID:   sourceID,
+					DataSourceName: sourceName,
+					QueryPlan:      queryPlan,
 				},
 			},
 			ResponsePath: info.Name,
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/postprocess/postprocess_test.go b/app/v2/pkg/engine/postprocess/postprocess_test.go
index 19ca66f..6142ad7 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/postprocess/postprocess_test.go
+++ b/app/v2/pkg/engine/postprocess/postprocess_test.go
@@ -9,6 +9,7 @@ import (
 
 	"github.com/kylelemons/godebug/pretty"
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 
 	"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/plan"
 	"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/resolve"
@@ -390,6 +391,52 @@ func TestProcess_ExtractFetches(t *testing.T) {
 	}
 }
 
+func TestProcessor_appendTriggerToFetchTree_UsesMetadata(t *testing.T) {
+	processor := NewProcessor()
+	subscription := &resolve.GraphQLSubscription{
+		Trigger: resolve.GraphQLSubscriptionTrigger{
+			Input: []byte(`{"invalid":`),
+			Metadata: &resolve.SubscriptionTriggerMetadata{
+				DataSourceID:   "custom-id",
+				DataSourceName: "custom-source",
+				QueryPlan:      &resolve.QueryPlan{Query: "subscription { counter }"},
+			},
+		},
+		Response: &resolve.GraphQLResponse{
+			Data: &resolve.Object{
+				Fields: []*resolve.Field{
+					{
+						Name: []byte("counter"),
+						Info: &resolve.FieldInfo{
+							Name: "counter",
+						},
+					},
+				},
+			},
+		},
+	}
+	subscription.Response.Fetches = resolve.Sequence()
+
+	processor.appendTriggerToFetchTree(subscription)
+
+	planNode := subscription.Response.Fetches.Trigger
+	require.NotNil(t, planNode)
+	require.NotNil(t, planNode.Item)
+	require.NotNil(t, planNode.Item.Fetch)
+	info := planNode.Item.Fetch.(*resolve.SingleFetch).Info
+	require.NotNil(t, info)
+	assert.Equal(t, "custom-id", info.DataSourceID)
+	assert.Equal(t, "custom-source", info.DataSourceName)
+	assert.Equal(t, "subscription { counter }", info.QueryPlan.Query)
+
+	planNodeRoot := subscription.Response.Fetches.QueryPlan()
+	require.NotNil(t, planNodeRoot)
+	require.NotNil(t, planNodeRoot.Trigger)
+	assert.Equal(t, "custom-id", planNodeRoot.Trigger.SubgraphID)
+	assert.Equal(t, "custom-source", planNodeRoot.Trigger.SubgraphName)
+	assert.Equal(t, "subscription { counter }", planNodeRoot.Trigger.Query)
+}
+
 func TestProcess_ExtractServiceNames(t *testing.T) {
 	type TestCase struct {
 		name     string
diff --git a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/response.go b/app/v2/pkg/engine/resolve/response.go
index f8e0c60..63c53d1 100644
--- a/tmp/agent-patch-flux-pr-1260.1-of-1.2026-02-28__13-38-10__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/response.go
+++ b/app/v2/pkg/engine/resolve/response.go
@@ -20,6 +20,13 @@ type GraphQLSubscriptionTrigger struct {
 	Variables      Variables
 	Source         SubscriptionDataSource
 	PostProcessing PostProcessingConfiguration
+	Metadata       *SubscriptionTriggerMetadata
+}
+
+type SubscriptionTriggerMetadata struct {
+	DataSourceID   string
+	DataSourceName string
+	QueryPlan      *QueryPlan
 }
 
 type GraphQLResponse struct {