STET

agent_patch

runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1351/flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch

21686 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/authorization_test.go b/app/v2/pkg/engine/resolve/authorization_test.go
index 263724a..02b8528 100644
--- a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/authorization_test.go
+++ b/app/v2/pkg/engine/resolve/authorization_test.go
@@ -54,6 +54,24 @@ func createTestAuthorizer(authorizePreFetch preFetchAuthFunc, authorizeObjectFie
 	}
 }
 
+func requireSubgraphError(t *testing.T, ctx *Context, name string) *SubgraphError {
+	t.Helper()
+
+	groups := ctx.SubgraphErrorsByDataSource()
+	require.NotNil(t, groups)
+
+	group, ok := groups[name]
+	require.True(t, ok, "expected subgraph %s to have errors", name)
+	for _, err := range group.Errors {
+		var subgraphError *SubgraphError
+		if errors.As(err, &subgraphError) {
+			return subgraphError
+		}
+	}
+	t.Fatalf("subgraph %s did not produce a SubgraphError", name)
+	return nil
+}
+
 func TestAuthorization(t *testing.T) {
 	t.Run("allow all", testFnWithPostEvaluation(func(t *testing.T, ctrl *gomock.Controller) (node *GraphQLResponse, ctx *Context, expectedOutput string, postEvaluation func(t *testing.T)) {
 
@@ -72,7 +90,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				require.Nil(t, resolveCtx.subgraphErrors)
+				require.Nil(t, resolveCtx.SubgraphErrors())
 			}
 	}))
 	t.Run("validate authorizer args", testFnWithPostEvaluation(func(t *testing.T, ctrl *gomock.Controller) (node *GraphQLResponse, ctx *Context, expectedOutput string, postEvaluation func(t *testing.T)) {
@@ -139,7 +157,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				require.Nil(t, resolveCtx.subgraphErrors)
+				require.Nil(t, resolveCtx.SubgraphErrors())
 			}
 	}))
 	t.Run("disallow field with extension", testFnWithPostEvaluation(func(t *testing.T, ctrl *gomock.Controller) (node *GraphQLResponse, ctx *Context, expectedOutput string, postEvaluation func(t *testing.T)) {
@@ -167,7 +185,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				require.Nil(t, resolveCtx.subgraphErrors)
+				require.Nil(t, resolveCtx.SubgraphErrors())
 			}
 	}))
 	t.Run("no authorization rules/checks", testFnWithPostEvaluation(func(t *testing.T, ctrl *gomock.Controller) (node *GraphQLResponse, ctx *Context, expectedOutput string, postEvaluation func(t *testing.T)) {
@@ -187,7 +205,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(0), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(0), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				require.Nil(t, resolveCtx.subgraphErrors)
+				require.Nil(t, resolveCtx.SubgraphErrors())
 			}
 	}))
 	t.Run("disallow root fetch", testFnWithPostEvaluation(func(t *testing.T, ctrl *gomock.Controller) (node *GraphQLResponse, ctx *Context, expectedOutput string, postEvaluation func(t *testing.T)) {
@@ -212,9 +230,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(1), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(0), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "users", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "users")
 				require.Equal(t, "query", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch from users Subgraph", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -243,9 +259,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(1), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(0), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "users", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "users")
 				require.Equal(t, "query", subgraphError.Path)
 				require.Equal(t, "", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -276,12 +290,10 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				require.NotEmpty(t, resolveCtx.subgraphErrors)
-				require.EqualError(t, resolveCtx.subgraphErrors, "Failed to fetch from Subgraph 'products' at Path: 'query.me.reviews.@.product', Reason: Not allowed to fetch from products Subgraph.")
+				require.NotEmpty(t, resolveCtx.SubgraphErrors())
+				require.EqualError(t, resolveCtx.SubgraphErrors(), "Failed to fetch from Subgraph 'products' at Path: 'query.me.reviews.@.product', Reason: Not allowed to fetch from products Subgraph.")
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "products", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, &resolveCtx, "products")
 				require.Equal(t, "query.me.reviews.@.product", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch from products Subgraph", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -310,9 +322,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "products", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "products")
 				require.Equal(t, "Query.me.reviews.product.data.name", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch name on Product", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -343,9 +353,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "products", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "products")
 				require.Equal(t, "query.me.reviews.@.product", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch from products Subgraph", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -387,9 +395,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "reviews", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "reviews")
 				require.Equal(t, "Query.me.reviews.body", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch body on Review", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -416,9 +422,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "reviews", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "reviews")
 				require.Equal(t, "Query.me.reviews.body", subgraphError.Path)
 				require.Equal(t, "", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -447,9 +451,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "products", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "products")
 				require.Equal(t, "query.me.reviews.@.product", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch name on Product", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
@@ -478,9 +480,7 @@ func TestAuthorization(t *testing.T) {
 				assert.Equal(t, int64(2), authorizer.(*testAuthorizer).preFetchCalls.Load())
 				assert.Equal(t, int64(4), authorizer.(*testAuthorizer).objectFieldCalls.Load())
 
-				var subgraphError *SubgraphError
-				require.ErrorAs(t, resolveCtx.subgraphErrors, &subgraphError)
-				require.Equal(t, "products", subgraphError.DataSourceInfo.Name)
+				subgraphError := requireSubgraphError(t, resolveCtx, "products")
 				require.Equal(t, "Query.me.reviews.product.data.name", subgraphError.Path)
 				require.Equal(t, "Not allowed to fetch name on Product", subgraphError.Reason)
 				require.Equal(t, 0, subgraphError.ResponseCode)
diff --git a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/context.go b/app/v2/pkg/engine/resolve/context.go
index 65d2d6b..bd1413f 100644
--- a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/context.go
+++ b/app/v2/pkg/engine/resolve/context.go
@@ -6,6 +6,7 @@ import (
 	"errors"
 	"io"
 	"net/http"
+	"sort"
 	"time"
 
 	"github.com/wundergraph/astjson"
@@ -31,7 +32,7 @@ type Context struct {
 	rateLimiter   RateLimiter
 	fieldRenderer FieldValueRenderer
 
-	subgraphErrors error
+	subgraphErrors subgraphErrorsStore
 }
 
 type ExecutionOptions struct {
@@ -138,11 +139,15 @@ func (c *Context) SetRateLimiter(limiter RateLimiter) {
 }
 
 func (c *Context) SubgraphErrors() error {
-	return c.subgraphErrors
+	return c.subgraphErrors.joinedError()
 }
 
-func (c *Context) appendSubgraphErrors(errs ...error) {
-	c.subgraphErrors = errors.Join(c.subgraphErrors, errors.Join(errs...))
+func (c *Context) SubgraphErrorsByDataSource() map[string]SubgraphErrorGroup {
+	return c.subgraphErrors.byDataSource()
+}
+
+func (c *Context) appendSubgraphErrors(ds DataSourceInfo, errs ...error) {
+	c.subgraphErrors.append(ds, errs...)
 }
 
 type Request struct {
@@ -202,11 +207,99 @@ func (c *Context) Free() {
 	c.RemapVariables = nil
 	c.TracingOptions.DisableAll()
 	c.Extensions = nil
-	c.subgraphErrors = nil
+	c.subgraphErrors = subgraphErrorsStore{}
 	c.authorizer = nil
 	c.LoaderHooks = nil
 }
 
+type SubgraphErrorGroup struct {
+	DataSourceInfo DataSourceInfo
+	Errors         []error
+}
+
+type subgraphErrorsStore struct {
+	groups map[string]*SubgraphErrorGroup
+}
+
+func (s *subgraphErrorsStore) append(ds DataSourceInfo, errs ...error) {
+	if len(errs) == 0 {
+		return
+	}
+	if s.groups == nil {
+		s.groups = make(map[string]*SubgraphErrorGroup)
+	}
+
+	key := subgraphKey(ds)
+	group, ok := s.groups[key]
+	if !ok {
+		group = &SubgraphErrorGroup{
+			DataSourceInfo: ds,
+		}
+		s.groups[key] = group
+	} else if group.DataSourceInfo.Name == "" && ds.Name != "" {
+		group.DataSourceInfo.Name = ds.Name
+	} else if group.DataSourceInfo.ID == "" && ds.ID != "" {
+		group.DataSourceInfo.ID = ds.ID
+	}
+
+	for _, err := range errs {
+		if err == nil {
+			continue
+		}
+		group.Errors = append(group.Errors, err)
+	}
+}
+
+func (s subgraphErrorsStore) joinedError() error {
+	if len(s.groups) == 0 {
+		return nil
+	}
+	keys := s.sortedKeys()
+	var errs []error
+	for _, key := range keys {
+		group := s.groups[key]
+		errs = append(errs, group.Errors...)
+	}
+	if len(errs) == 0 {
+		return nil
+	}
+	return errors.Join(errs...)
+}
+
+func (s subgraphErrorsStore) byDataSource() map[string]SubgraphErrorGroup {
+	if len(s.groups) == 0 {
+		return nil
+	}
+	result := make(map[string]SubgraphErrorGroup, len(s.groups))
+	for _, key := range s.sortedKeys() {
+		group := s.groups[key]
+		result[key] = SubgraphErrorGroup{
+			DataSourceInfo: group.DataSourceInfo,
+			Errors:         append([]error(nil), group.Errors...),
+		}
+	}
+	return result
+}
+
+func (s subgraphErrorsStore) sortedKeys() []string {
+	keys := make([]string, 0, len(s.groups))
+	for key := range s.groups {
+		keys = append(keys, key)
+	}
+	sort.Strings(keys)
+	return keys
+}
+
+func subgraphKey(ds DataSourceInfo) string {
+	if ds.Name != "" {
+		return ds.Name
+	}
+	if ds.ID != "" {
+		return ds.ID
+	}
+	return "__unknown"
+}
+
 type traceStartKey struct{}
 
 type TraceInfo struct {
diff --git a/app/v2/pkg/engine/resolve/context_subgraph_errors_test.go b/app/v2/pkg/engine/resolve/context_subgraph_errors_test.go
new file mode 100644
index 0000000..461046d
--- /dev/null
+++ b/app/v2/pkg/engine/resolve/context_subgraph_errors_test.go
@@ -0,0 +1,36 @@
+package resolve
+
+import (
+	"errors"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+)
+
+func TestContext_SubgraphErrorsByDataSource(t *testing.T) {
+	ctx := &Context{}
+
+	ctx.appendSubgraphErrors(DataSourceInfo{ID: "users-id", Name: "users"}, errors.New("user error"))
+	ctx.appendSubgraphErrors(DataSourceInfo{Name: "products"}, errors.New("product error"))
+
+	groups := ctx.SubgraphErrorsByDataSource()
+
+	require.Len(t, groups, 2)
+	require.Contains(t, groups, "users")
+	require.Contains(t, groups, "products")
+
+	require.Equal(t, "user error", groups["users"].Errors[0].Error())
+	require.Equal(t, "users-id", groups["users"].DataSourceInfo.ID)
+	require.Equal(t, "products", groups["products"].DataSourceInfo.Name)
+}
+
+func TestContext_SubgraphErrorsDeterministicOrder(t *testing.T) {
+	ctx := &Context{}
+
+	ctx.appendSubgraphErrors(DataSourceInfo{Name: "b"}, errors.New("from b"))
+	ctx.appendSubgraphErrors(DataSourceInfo{Name: "a"}, errors.New("from a"))
+
+	err := ctx.SubgraphErrors()
+	require.Error(t, err)
+	require.Equal(t, "from a\nfrom b", err.Error())
+}
diff --git a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/loader.go b/app/v2/pkg/engine/resolve/loader.go
index 7a14d61..abde1f4 100644
--- a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/loader.go
+++ b/app/v2/pkg/engine/resolve/loader.go
@@ -243,7 +243,7 @@ func (l *Loader) resolveParallel(nodes []*FetchTreeNode) error {
 				if l.ctx.LoaderHooks != nil && results[i].nestedMergeItems[j].loaderHookContext != nil {
 					l.ctx.LoaderHooks.OnFinished(results[i].nestedMergeItems[j].loaderHookContext,
 						results[i].nestedMergeItems[j].ds,
-						newResponseInfo(results[i].nestedMergeItems[j], l.ctx.subgraphErrors))
+						newResponseInfo(results[i].nestedMergeItems[j], l.ctx.SubgraphErrors()))
 				}
 				if err != nil {
 					return errors.WithStack(err)
@@ -252,7 +252,7 @@ func (l *Loader) resolveParallel(nodes []*FetchTreeNode) error {
 		} else {
 			err = l.mergeResult(nodes[i].Item, results[i], itemsItems[i])
 			if l.ctx.LoaderHooks != nil {
-				l.ctx.LoaderHooks.OnFinished(results[i].loaderHookContext, results[i].ds, newResponseInfo(results[i], l.ctx.subgraphErrors))
+				l.ctx.LoaderHooks.OnFinished(results[i].loaderHookContext, results[i].ds, newResponseInfo(results[i], l.ctx.SubgraphErrors()))
 			}
 			if err != nil {
 				return errors.WithStack(err)
@@ -289,7 +289,7 @@ func (l *Loader) resolveSingle(item *FetchItem) error {
 		}
 		err = l.mergeResult(item, res, items)
 		if l.ctx.LoaderHooks != nil {
-			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.subgraphErrors))
+			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.SubgraphErrors()))
 		}
 
 		return err
@@ -303,7 +303,7 @@ func (l *Loader) resolveSingle(item *FetchItem) error {
 		}
 		err = l.mergeResult(item, res, items)
 		if l.ctx.LoaderHooks != nil {
-			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.subgraphErrors))
+			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.SubgraphErrors()))
 		}
 		return err
 	case *EntityFetch:
@@ -316,7 +316,7 @@ func (l *Loader) resolveSingle(item *FetchItem) error {
 		}
 		err = l.mergeResult(item, res, items)
 		if l.ctx.LoaderHooks != nil {
-			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.subgraphErrors))
+			l.ctx.LoaderHooks.OnFinished(res.loaderHookContext, res.ds, newResponseInfo(res, l.ctx.SubgraphErrors()))
 		}
 		return err
 	case *ParallelListItemFetch:
@@ -349,7 +349,7 @@ func (l *Loader) resolveSingle(item *FetchItem) error {
 		for i := range results {
 			err = l.mergeResult(item, results[i], items[i:i+1])
 			if l.ctx.LoaderHooks != nil {
-				l.ctx.LoaderHooks.OnFinished(results[i].loaderHookContext, results[i].ds, newResponseInfo(results[i], l.ctx.subgraphErrors))
+				l.ctx.LoaderHooks.OnFinished(results[i].loaderHookContext, results[i].ds, newResponseInfo(results[i], l.ctx.SubgraphErrors()))
 			}
 			if err != nil {
 				return errors.WithStack(err)
@@ -740,7 +740,7 @@ func (l *Loader) appendSubgraphError(res *result, fetchItem *FetchItem, value *a
 		subgraphError.AppendDownstreamError(&gErr)
 	}
 
-	l.ctx.appendSubgraphErrors(res.err, subgraphError)
+	l.ctx.appendSubgraphErrors(res.ds, res.err, subgraphError)
 
 	return nil
 }
@@ -1088,7 +1088,7 @@ func (l *Loader) renderErrorsFailedDeps(fetchItem *FetchItem, res *result) error
 }
 
 func (l *Loader) renderErrorsFailedToFetch(fetchItem *FetchItem, res *result, reason string) error {
-	l.ctx.appendSubgraphErrors(res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, reason, res.statusCode))
+	l.ctx.appendSubgraphErrors(res.ds, res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, reason, res.statusCode))
 	errorObject, err := astjson.ParseWithoutCache(l.renderSubgraphBaseError(res.ds, fetchItem.ResponsePath, reason))
 	if err != nil {
 		return err
@@ -1104,7 +1104,7 @@ func (l *Loader) renderErrorsStatusFallback(fetchItem *FetchItem, res *result, s
 		reason += fmt.Sprintf(": %s", statusText)
 	}
 
-	l.ctx.appendSubgraphErrors(res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, reason, res.statusCode))
+	l.ctx.appendSubgraphErrors(res.ds, res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, reason, res.statusCode))
 
 	errorObject, err := astjson.ParseWithoutCache(fmt.Sprintf(`{"message":"%s"}`, reason))
 	if err != nil {
@@ -1133,7 +1133,7 @@ func (l *Loader) renderSubgraphBaseError(ds DataSourceInfo, path, reason string)
 
 func (l *Loader) renderAuthorizationRejectedErrors(fetchItem *FetchItem, res *result) error {
 	for i := range res.authorizationRejectedReasons {
-		l.ctx.appendSubgraphErrors(res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, res.authorizationRejectedReasons[i], res.statusCode))
+		l.ctx.appendSubgraphErrors(res.ds, res.err, NewSubgraphError(res.ds, fetchItem.ResponsePath, res.authorizationRejectedReasons[i], res.statusCode))
 	}
 	pathPart := l.renderAtPathErrorPart(fetchItem.ResponsePath)
 	extensionErrorCode := fmt.Sprintf(`"extensions":{"code":"%s"}`, errorcodes.UnauthorizedFieldOrType)
@@ -1174,7 +1174,7 @@ func (l *Loader) renderAuthorizationRejectedErrors(fetchItem *FetchItem, res *re
 }
 
 func (l *Loader) renderRateLimitRejectedErrors(fetchItem *FetchItem, res *result) error {
-	l.ctx.appendSubgraphErrors(res.err, NewRateLimitError(res.ds.Name, fetchItem.ResponsePath, res.rateLimitRejectedReason))
+	l.ctx.appendSubgraphErrors(res.ds, res.err, NewRateLimitError(res.ds.Name, fetchItem.ResponsePath, res.rateLimitRejectedReason))
 	pathPart := l.renderAtPathErrorPart(fetchItem.ResponsePath)
 	var (
 		err         error
diff --git a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/resolvable.go b/app/v2/pkg/engine/resolve/resolvable.go
index 5219c91..5b48b9e 100644
--- a/tmp/agent-patch-flux-pr-1351.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/resolve/resolvable.go
+++ b/app/v2/pkg/engine/resolve/resolvable.go
@@ -4,12 +4,12 @@ import (
 	"bytes"
 	"context"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"io"
 	"strconv"
 
 	"github.com/cespare/xxhash/v2"
-	"github.com/pkg/errors"
 	"github.com/tidwall/gjson"
 
 	"github.com/wundergraph/astjson"
@@ -758,7 +758,8 @@ func (r *Resolvable) addRejectFieldError(reason string, ds DataSourceInfo, field
 	} else {
 		errorMessage = fmt.Sprintf("Unauthorized to load field '%s', Reason: %s.", fieldPath, reason)
 	}
-	r.ctx.appendSubgraphErrors(errors.New(errorMessage),
+	r.ctx.appendSubgraphErrors(ds,
+		errors.New(errorMessage),
 		NewSubgraphError(ds, fieldPath, reason, 0))
 	fastjsonext.AppendErrorWithExtensionsCodeToArray(r.astjsonArena, r.errors, errorMessage, errorcodes.UnauthorizedFieldOrType, r.path)
 	r.popNodePathElement(nodePath)