Skip to content

fix(edge): validate keyword condition regex patterns and honor default fallback - #730

Open
pei711 wants to merge 1 commit into
OpenBMB:mainfrom
pei711:fix/keyword-edge-condition-regex-validation
Open

pei711 wants to merge 1 commit into
OpenBMB:mainfrom
pei711:fix/keyword-edge-condition-regex-validation

Conversation

@pei711

@pei711 pei711 commented Nov 15, 2026

Copy link
Copy Markdown

Summary

This PR improves configuration validation and runtime reliability for keyword edge conditions (type: keyword):

  1. Upfront regex validation: Adds validate() to KeywordEdgeConditionConfig to validate all regular expressions in regex_patterns with appropriate flags, raising ConfigError with the exact path (edge.condition.config.regex) if an invalid regex pattern is provided.
  2. Defensive initialization: In KeywordEdgeConditionManager.__init__, wraps regex compilation in a try/except block to catch re.error defensively.
  3. Honor default fallback and guard None data: In KeywordEdgeConditionManager._evaluate(), guards against data is None, and returns self.default_value when none of the affirmative keyword or regex conditions match.
  4. Unit test coverage: Adds comprehensive test cases in tests/test_keyword_edge_conditions.py verifying valid configs, invalid regex syntax rejection, any/none precedence, regex matching, default fallback, and None data handling.

Verification

  • Ran pytest tests/test_keyword_edge_conditions.py: 7 passed in 3.24s
  • Ran git diff --check: clean

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T19:44:27.245411Z d20d407 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.

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