diff --git a/pkg/workflow/README.md b/pkg/workflow/README.md index 200a34b2d96..9e112641319 100644 --- a/pkg/workflow/README.md +++ b/pkg/workflow/README.md @@ -895,7 +895,7 @@ This appendix is generated from the current non-test Go source files in this pac | `workflow_data.go` | `SkipIfCheckFailingConfig` | `type SkipIfCheckFailingConfig struct { Include []string // check names to include (empty = all checks) Exclude []string // check names to exclude Branch string // optional branch name to check (defaults to triggering ref or PR base branch) AllowPending bool // if true, pending/in-progress checks are not treated as failing (default: treat pending as failing) }` | SkipIfCheckFailingConfig holds the configuration for skip-if-check-failing conditions | | `workflow_data.go` | `SkipIfMatchConfig` | `type SkipIfMatchConfig struct { Query string // GitHub search query to check before running workflow Max int // Maximum number of matches before skipping (defaults to 1) Scope string // Scope for the query: "none" disables auto repo:owner/repo scoping }` | SkipIfMatchConfig holds the configuration for skip-if-match conditions | | `workflow_data.go` | `SkipIfNoMatchConfig` | `type SkipIfNoMatchConfig struct { Query string // GitHub search query to check before running workflow Min int // Minimum number of matches required to proceed (defaults to 1) Scope string // Scope for the query: "none" disables auto repo:owner/repo scoping }` | SkipIfNoMatchConfig holds the configuration for skip-if-no-match conditions | -| `awf_config.go` | `AWFBoundedQueriesConfig` | `type AWFBoundedQueriesConfig struct { Enabled bool PrivateRepos []*AWFBoundedQueryPrivateRepo Runtime BoundedQueryRuntime Timeout int MemoryLimit string Interpreter string MaxInvocations int }` | AWFBoundedQueriesConfig models compiled bounded-query settings in AWF config output. | +| `awf_config.go` | `AWFBoundedQueriesConfig` | `type AWFBoundedQueriesConfig struct { Enabled bool PrivateRepos []*AWFBoundedQueryPrivateRepo Runtime BoundedQueryRuntime Timeout *int MemoryLimit string Interpreter string MaxInvocations int }` | AWFBoundedQueriesConfig models compiled bounded-query settings in AWF config output. | | `awf_config.go` | `AWFBoundedQueryPrivateRepo` | `type AWFBoundedQueryPrivateRepo struct { Repo string Sensitivity string }` | AWFBoundedQueryPrivateRepo describes one approved private repository for bounded queries. | | `sandbox.go` | `AiCreditsPricingConfig` | `type AiCreditsPricingConfig struct { Input float64 Output float64 CachedInput *float64 CacheWrite *float64 }` | AiCreditsPricingConfig defines per-token pricing inputs used for AI-credit accounting. | | `tools_types.go` | `BoundedQueriesConfig` | `type BoundedQueriesConfig struct { PrivateRepos []*BoundedQueryPrivateRepo Runtime BoundedQueryRuntime Timeout *int MemoryLimit string Interpreter string MaxInvocations *int ParseError string }` | BoundedQueriesConfig defines user-facing bounded-query tool configuration. | diff --git a/pkg/workflow/awf_config.go b/pkg/workflow/awf_config.go index 973053ca8e9..8c84bf160a9 100644 --- a/pkg/workflow/awf_config.go +++ b/pkg/workflow/awf_config.go @@ -203,7 +203,9 @@ type AWFBoundedQueriesConfig struct { // Timeout is the maximum execution time in seconds for a single invocation. // Optional; when omitted AWF uses its default. - Timeout int `json:"timeout,omitempty"` + // A pointer mirrors BoundedQueriesConfig.Timeout so nil-vs-zero semantics stay in sync + // between the frontmatter and AWF-config-file shapes. + Timeout *int `json:"timeout,omitempty"` // MemoryLimit is the memory limit for bounded-query container execution (e.g. "512m"). // Optional; when omitted AWF uses its default. @@ -985,9 +987,7 @@ func extractBoundedQueriesConfig(workflowData *WorkflowData) *AWFBoundedQueriesC MemoryLimit: bq.MemoryLimit, Interpreter: bq.Interpreter, } - if bq.Timeout != nil { - awfBQ.Timeout = *bq.Timeout - } + awfBQ.Timeout = bq.Timeout if bq.MaxInvocations != nil { awfBQ.MaxInvocations = *bq.MaxInvocations } diff --git a/pkg/workflow/bounded_queries_test.go b/pkg/workflow/bounded_queries_test.go index de230ea7f1e..6b35af5aefc 100644 --- a/pkg/workflow/bounded_queries_test.go +++ b/pkg/workflow/bounded_queries_test.go @@ -201,7 +201,8 @@ func TestExtractBoundedQueriesConfig(t *testing.T) { require.NotNil(t, got) assert.True(t, got.Enabled) assert.Equal(t, BoundedQueryRuntimeDocker, got.Runtime) - assert.Equal(t, 30, got.Timeout) + require.NotNil(t, got.Timeout) + assert.Equal(t, 30, *got.Timeout) assert.Equal(t, "512m", got.MemoryLimit) assert.Equal(t, "python3", got.Interpreter) assert.Equal(t, 32, got.MaxInvocations) @@ -228,8 +229,8 @@ func TestExtractBoundedQueriesConfig(t *testing.T) { got := extractBoundedQueriesConfig(data) require.NotNil(t, got) - assert.Equal(t, 0, got.Timeout, "timeout must be zero (omitted) when not set") assert.Equal(t, 0, got.MaxInvocations, "max-invocations must be zero (omitted) when not set") + assert.Nil(t, got.Timeout, "timeout must be nil (omitted) when not set") }) } @@ -606,7 +607,7 @@ func TestAWFBoundedQueriesJSONRoundtrip(t *testing.T) { {Repo: "my-org/sealed-service", Sensitivity: "sealed"}, }, Runtime: BoundedQueryRuntimeSbx, - Timeout: 30, + Timeout: new(30), MemoryLimit: "512m", Interpreter: "python3", MaxInvocations: 32,