agent_patch
runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1128/flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch
5933 bytes
diff --git a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/plan/plan.go b/app/pkg/engine/plan/plan.go
index 4725d5a..8ed4ce1 100644
--- a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/plan/plan.go
+++ b/app/pkg/engine/plan/plan.go
@@ -298,6 +298,7 @@ func (p *Planner) Plan(operation, definition *ast.Document, operationName string
p.planningVisitor.Config = config
p.planningVisitor.fetchConfigurations = p.configurationVisitor.fetches
p.planningVisitor.fieldBuffers = p.configurationVisitor.fieldBuffers
+ p.planningVisitor.staticTypeNameFields = p.configurationVisitor.staticTypeNameFields
p.planningVisitor.skipFieldPaths = p.requiredFieldsVisitor.skipFieldPaths
p.planningWalker.ResetVisitors()
@@ -383,6 +384,7 @@ type Visitor struct {
planners []plannerConfiguration
fetchConfigurations []objectFetchConfiguration
fieldBuffers map[int]int
+ staticTypeNameFields map[int][]byte
skipFieldPaths []string
fieldConfigs map[int]*FieldConfiguration
exportedVariables map[string]struct{}
@@ -526,6 +528,26 @@ func (v *Visitor) EnterField(ref int) {
fieldName := v.Operation.FieldNameBytes(ref)
fieldAliasOrName := v.Operation.FieldAliasOrNameBytes(ref)
+ if staticValue, ok := v.staticTypeNameFields[ref]; ok {
+ staticValueCopy := append([]byte(nil), staticValue...)
+ v.currentField = &resolve.Field{
+ Name: fieldAliasOrName,
+ Value: &resolve.String{
+ Path: nil,
+ Nullable: false,
+ IsTypeName: true,
+ StaticValue: staticValueCopy,
+ },
+ OnTypeNames: v.resolveOnTypeNames(),
+ Position: v.resolveFieldPosition(ref),
+ SkipDirectiveDefined: skip,
+ SkipVariableName: skipVariableName,
+ IncludeDirectiveDefined: include,
+ IncludeVariableName: includeVariableName,
+ }
+ *v.currentFields[len(v.currentFields)-1].fields = append(*v.currentFields[len(v.currentFields)-1].fields, v.currentField)
+ return
+ }
if bytes.Equal(fieldName, literal.TYPENAME) {
v.currentField = &resolve.Field{
Name: fieldAliasOrName,
@@ -1435,6 +1457,7 @@ type configurationVisitor struct {
fetches []objectFetchConfiguration
currentBufferId int
fieldBuffers map[int]int
+ staticTypeNameFields map[int][]byte
parentTypeNodes []ast.Node
@@ -1583,6 +1606,17 @@ func (c *configurationVisitor) EnterField(ref int) {
if root.Kind != ast.NodeKindOperationDefinition {
return
}
+ isRootSelection := parentPath == string(literal.QUERY) ||
+ parentPath == string(literal.MUTATION) ||
+ parentPath == string(literal.SUBSCRIPTION)
+
+ if isRootSelection && fieldName == "__typename" {
+ if c.staticTypeNameFields == nil {
+ c.staticTypeNameFields = make(map[int][]byte)
+ }
+ c.staticTypeNameFields[ref] = []byte(typeName)
+ return
+ }
isSubscription := c.isSubscription(root.Ref, currentPath)
for i, plannerConfig := range c.planners {
planningBehaviour := plannerConfig.planner.DataSourcePlanningBehavior()
@@ -1746,6 +1780,7 @@ func (c *configurationVisitor) EnterDocument(operation, definition *ast.Document
delete(c.fieldBuffers, i)
}
}
+ c.staticTypeNameFields = map[int][]byte{}
}
func (c *configurationVisitor) isSubscription(root int, path string) bool {
diff --git a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/plan/plan_test.go b/app/pkg/engine/plan/plan_test.go
index d57cad2..562c8be 100644
--- a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/plan/plan_test.go
+++ b/app/pkg/engine/plan/plan_test.go
@@ -208,6 +208,29 @@ func TestPlanner_Plan(t *testing.T) {
DefaultFlushIntervalMillis: 0,
}))
+ t.Run("root __typename static field", test(testDefinition, `
+ query RootTypeName {
+ __typename
+ }
+ `, "", &SynchronousResponsePlan{
+ Response: &resolve.GraphQLResponse{
+ Data: &resolve.Object{
+ Fields: []*resolve.Field{
+ {
+ Name: []byte("__typename"),
+ Value: &resolve.String{
+ Nullable: false,
+ IsTypeName: true,
+ StaticValue: []byte("Query"),
+ },
+ },
+ },
+ },
+ },
+ }, Configuration{
+ DisableResolveFieldPositions: true,
+ }))
+
t.Run("Union response type with interface fragments", test(testDefinition, `
query SearchResults {
searchResults {
diff --git a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/resolve/resolve.go b/app/pkg/engine/resolve/resolve.go
index f6b93a0..ef4b196 100644
--- a/tmp/agent-patch-flux-pr-1128.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/pkg/engine/resolve/resolve.go
+++ b/app/pkg/engine/resolve/resolve.go
@@ -1014,6 +1014,25 @@ func (r *Resolver) resolveString(ctx *Context, str *String, data []byte, stringB
err error
)
+ if str.StaticValue != nil {
+ value := str.StaticValue
+ if value == nil {
+ if !str.Nullable {
+ return errNonNullableFieldValueIsNull
+ }
+ r.resolveNull(stringBuf.Data)
+ return nil
+ }
+ if str.IsTypeName {
+ value = r.renameTypeName(ctx, str, value)
+ }
+ stringBuf.Data.WriteBytes(quote)
+ stringBuf.Data.WriteBytes(value)
+ stringBuf.Data.WriteBytes(quote)
+ r.exportField(ctx, str.Export, value)
+ return nil
+ }
+
value, valueType, _, err = jsonparser.Get(data, str.Path...)
if err != nil || valueType != jsonparser.String {
if err == nil && str.UnescapeResponseJson {
@@ -1544,6 +1563,7 @@ type String struct {
Export *FieldExport `json:"export,omitempty"`
UnescapeResponseJson bool `json:"unescape_response_json,omitempty"`
IsTypeName bool `json:"is_type_name,omitempty"`
+ StaticValue []byte `json:"-"`
}
func (_ *String) NodeKind() NodeKind {