Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
8 changes: 4 additions & 4 deletions pkg/workflow/awf_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/workflow/bounded_queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
})
}

Expand Down Expand Up @@ -606,7 +607,7 @@ func TestAWFBoundedQueriesJSONRoundtrip(t *testing.T) {
{Repo: "my-org/sealed-service", Sensitivity: "sealed"},
},
Runtime: BoundedQueryRuntimeSbx,
Timeout: 30,
Timeout: new(30),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new(30) is not valid Go — new takes a type, not a value. This will fail to compile.

Use a local variable or a helper instead:

// option 1
timeout := 30
Timeout: &timeout,

// option 2 (if a ptr helper exists in the package)
Timeout: ptr(30),

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] new(30) is not valid Go — new is a builtin that takes a type, not a value literal. This line will fail to compile.

💡 Suggested fix

Use an address-of with a temporary variable, consistent with pkg/workflow/compiler_safe_outputs_steps_test.go:

timeout := 30
Timeout: &timeout,

Or add a small package-level helper (as done in checkout_manager_test.go):

ptr := func(n int) *int { return &n }
// ...
Timeout: ptr(30),

Note: new(30) also appears on earlier lines (87, 191, 271) of this file for BoundedQueriesConfig.Timeout — those are pre-existing and should be addressed in a follow-up. This PR introduces one new occurrence on this line.

@copilot please address this.

MemoryLimit: "512m",
Interpreter: "python3",
MaxInvocations: 32,
Expand Down
Loading