Skip to content

fix(config): reject rule items with multiple matchers - #444

Open
karanb192 wants to merge 4 commits into
alibaba:mainfrom
karanb192:fix/one-matcher-per-rule
Open

karanb192 wants to merge 4 commits into
alibaba:mainfrom
karanb192:fix/one-matcher-per-rule

Conversation

@karanb192

@karanb192 karanb192 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A single success item containing output_contains and exit_code checks only the first matching field at runtime. Validation now reports the affected item and names its matchers. The migration note explains that all success items must pass and any matching failure item fails the case. Split failure conditions only when each should trigger failure independently.

Changes

The check applies to both success and failure rules on a rule_based judge. Other judge types retain their existing handling of unused rule fields.

Related issues

Related to #365. The existing work in #341 covers incomplete matcher values. This patch covers several recognized matchers in the same item.

Test plan

Validator tests cover multiple success and failure matchers and a script judge with unused rule fields.

Local checks passed with make verify, go test -race ./... and the Codex plugin unit tests.

The rule_based judge evaluates one matcher per rule item and silently
ignored the rest, so an item holding output_contains, exit_code and
files_exist checked only the output and could pass with a failed exit
and a missing file. Validation now rejects such an item and names its
matchers.
Other judge types ignore success and failure rules, so a script judge
with an unused multi-matcher item must keep validating. Share one
matcher list between both rule checks.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 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-27T02:08:45.352727Z 8933ce3 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.

@zpzjzj

zpzjzj commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

I’m good with keeping one matcher per rule item and rejecting ambiguous configs at validation time. Could you add a short note to the configuration docs explaining that older configs with multiple matchers in one item will now fail validation instead of silently evaluating only the first matcher?

It would also help to clarify the migration advice: separate success items must all pass, while any matching failure item fails the case. So splitting a failure item is only appropriate if each condition is meant to trigger failure on its own—not if both conditions must hold.

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.

2 participants