Skip to content

fix(config): reject negative per-case timeouts and turn limits - #458

Open
karanb192 wants to merge 2 commits into
alibaba:mainfrom
karanb192:fix/reject-negative-case-limits
Open

karanb192 wants to merge 2 commits into
alibaba:mainfrom
karanb192:fix/reject-negative-case-limits

Conversation

@karanb192

@karanb192 karanb192 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A case could set constraints.timeout_seconds or constraints.max_turns to -1. The evaluator only uses positive case values, so a negative one silently fell back to the eval default.

validate and run now reject a negative per-case value and name the field. The error also says how to get the intended behaviour: 0 inherits the default, and cases.defaults.timeout_seconds: -1 disables the deadline.

cases.defaults is not checked. A negative default timeout is the documented opt-out from the case deadline: the loader preserves it, and withCaseTimeout treats it as no deadline. A negative default max_turns likewise skips the turn-count check for scripted turns.

Test plan

A validator test runs -1, 0 and 1 at both scopes. Defaults accept all three, and constraints reject -1 with both field names in the error. The existing loader test for the -1 default opt-out still passes.

Local checks: go test -race ./... and make verify.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T03:11:18.001995Z 1cca8cd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cca8cd82b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/validator.go Outdated
}

errs = append(errs, validateCollectArtifacts("cases.defaults.collect_artifacts", cfg.Cases.Defaults.CollectArtifacts)...)
errs = append(errs, validateCaseLimits("cases.defaults", cfg.Cases.Defaults.MaxTurns, cfg.Cases.Defaults.TimeoutSeconds)...)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the default-timeout opt-out

For suites that set cases.defaults.timeout_seconds: -1 to disable the case deadline, this new default-scope validation breaks both run and validate. applyDocumentedDefaults explicitly preserves that sentinel (internal/config/loader.go:86-96), an existing loader test covers it (internal/config/loader_test.go:486-499), and withCaseTimeout honors negative defaults as no deadline rather than falling back. Zero cannot replace it because the loader rewrites zero to 300 seconds. Preserve this opt-out at the defaults scope, or provide a replacement before rejecting it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3014577. Validation now covers only per-case constraints, so cases.defaults.timeout_seconds: -1 still disables the deadline. The case-level error explains how to opt out.

cases.defaults.timeout_seconds: -1 disables the case deadline, and the
loader keeps it on purpose. A negative default max_turns likewise skips
the turn-count check for scripted turns. Validate only the per-case
constraints, where a negative value silently fell back to the defaults,
and say in the error how to opt out.
@karanb192 karanb192 changed the title fix(config): reject negative case timeouts and turn limits fix(config): reject negative per-case timeouts and turn limits Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant