Skip to content

Conversation

@shazee257
Copy link

@shazee257 shazee257 commented Jan 20, 2026

Fixes #5650 - - Bug: "Regex" operation in Condition node is not implemented in backend

The Condition Agentflow node exposes a Regex operation in the UI but the backend did not implement it, causing runtime errors during evaluation. This update adds the missing backend behavior and ensures regex conditions evaluate safely.

  • Backend condition evaluation

    • Added a regex comparator with defensive limits and invalid-pattern handling to prevent runtime errors and mitigate expensive pattern evaluation.
  • Tests

    • Added unit coverage for regex match, invalid patterns, and safety limit enforcement.

Example:

const isMatch = compareOperationFunctions.regex('Hello123', '^Hello\\d+$')
// → true

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.sheetjs.com
    • Triggering command: /usr/local/bin/node node /usr/local/bin/pnpm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

read the issue at #5650 and create new pull request with description , fix it


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 20, 2026 16:11
Co-authored-by: shazee257 <50085698+shazee257@users.noreply.github.com>
Co-authored-by: shazee257 <50085698+shazee257@users.noreply.github.com>
Co-authored-by: shazee257 <50085698+shazee257@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 20, 2026 16:37
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shazee257, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a functional gap in the Condition Agentflow node by providing a robust backend implementation for regex comparisons. It ensures that users can safely and effectively utilize regular expressions within their agent flows, preventing previous runtime errors and enhancing the node's conditional logic capabilities.

Highlights

  • Regex Comparison Support: Implemented the missing backend logic for the 'regex' operation in the Condition Agentflow node, which was previously only exposed in the UI, resolving runtime errors during evaluation.
  • Robustness and Safety: The new regex comparator includes defensive limits for pattern and input string lengths (256 and 10000 characters respectively) and handles invalid regex patterns gracefully to prevent runtime errors and mitigate expensive pattern evaluations.
  • Comprehensive Testing: Added new unit tests to cover successful regex matches, scenarios with invalid regex patterns, and cases where safety limits are exceeded, ensuring the reliability of the new functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the missing regex operation for the Condition Agentflow node, including important safety checks to prevent runtime errors and expensive evaluations. The addition of unit tests is also great for ensuring the new functionality is robust. My feedback includes suggestions to improve code readability by using named constants, enhancing type safety in the tests, and expanding test coverage to include all safety checks.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug where the Condition Agentflow node exposed a "Regex" operation in the UI but lacked the corresponding backend implementation, causing runtime errors when users attempted to use this feature.

Changes:

  • Added regex comparator implementation with defensive safety limits (256 char pattern, 10,000 char input) and error handling for invalid patterns
  • Added comprehensive unit tests covering successful regex matching, invalid pattern handling, and safety limit enforcement

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/components/nodes/agentflow/Condition/Condition.ts Implements the missing regex comparison function with safety limits and error handling
packages/components/nodes/agentflow/Condition/Condition.test.ts Adds new test suite with three test cases covering regex functionality, invalid patterns, and safety limits

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

shazee257 and others added 4 commits January 20, 2026 22:18
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

Bug: "Regex" operation in Condition node is not implemented in backend

1 participant