Skip to content

feat: added dynamic variable support#135

Merged
sauravpanda merged 4 commits into
mainfrom
134-add-ai-powered-variable-identifier
Nov 4, 2025
Merged

feat: added dynamic variable support#135
sauravpanda merged 4 commits into
mainfrom
134-add-ai-powered-variable-identifier

Conversation

@sauravpanda
Copy link
Copy Markdown
Collaborator

@sauravpanda sauravpanda commented Nov 4, 2025

Summary by cubic

Adds automatic variable identification and parameterization to workflows, generating an input_schema and replacing hardcoded values with placeholders. Integrates into the semantic converter and healing flow with a fast, pattern-based pass and optional YAML cleanup.

  • New Features

    • New VariableIdentifier with pattern/context heuristics and optional LLM; exposes identify_variables_in_workflow.
    • Auto-generates input_schema and metadata. Presets via VariableConfigPresets.
    • SemanticWorkflowConverter now identifies variables (enable_variable_identification, variable_config).
    • Healing service post-process adds pattern-based identification (enable_pattern_variable_identification, pattern_variable_confidence) and YAML cleanup (cleanup_yaml, remove_descriptions, remove_verification_checks, remove_expected_outcomes).
    • Tests added for variable detection, presets, and converter integration.
    • Implements Linear 134 by introducing an AI-powered variable identifier with a zero-cost pattern mode.
  • Migration

    • YAML cleanup defaults to on; disable via cleanup_yaml=False to preserve descriptions/verification/expected_outcome.
    • Pattern-based variable identification defaults to on; disable via enable_pattern_variable_identification=False.
    • Adjust confidence via pattern_variable_confidence or converter variable_config.min_confidence.

Written for commit 1fe6e86. Summary will update automatically on new commits.

@sauravpanda sauravpanda linked an issue Nov 4, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 8 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="workflows/workflow_use/workflow/tests/test_variable_identifier.py">

<violation number="1" location="workflows/workflow_use/workflow/tests/test_variable_identifier.py:183">
`email_schema[&#39;type&#39;]` is asserted to equal `&#39;email&#39;`, but `_generate_input_schema` maps email variables to schema type `&#39;string&#39;` and uses the `&#39;format&#39;` field for email specificity. Update the test to check for `&#39;string&#39;` (and optionally the `&#39;format&#39;`) so it reflects the actual schema.</violation>
</file>

<file name="workflows/workflow_use/workflow/variable_config.py">

<violation number="1" location="workflows/workflow_use/workflow/variable_config.py:93">
`domain_config` should use `typing.Any` instead of the builtin `any`; otherwise static type checkers will flag invalid annotations.</violation>
</file>

<file name="workflows/workflow_use/workflow/variable_identifier.py">

<violation number="1" location="workflows/workflow_use/workflow/variable_identifier.py:287">
Context-based matches can return a None variable name, which ends up as `{None}` in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Comment thread workflows/workflow_use/workflow/tests/test_variable_identifier.py Outdated
group_related_fields: bool = True

# Domain-specific configurations
domain_config: Dict[str, any] = field(default_factory=dict)
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Nov 4, 2025

Choose a reason for hiding this comment

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

domain_config should use typing.Any instead of the builtin any; otherwise static type checkers will flag invalid annotations.

Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/variable_config.py at line 93:

<comment>`domain_config` should use `typing.Any` instead of the builtin `any`; otherwise static type checkers will flag invalid annotations.</comment>

<file context>
@@ -0,0 +1,254 @@
+	group_related_fields: bool = True
+
+	# Domain-specific configurations
+	domain_config: Dict[str, any] = field(default_factory=dict)
+
+
</file context>
Fix with Cubic

for keyword, var_type in self.VARIABLE_KEYWORDS.items():
if keyword in combined_hints:
# Generate variable name from context
var_name = self._generate_variable_name_from_context(context, var_type)
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Nov 4, 2025

Choose a reason for hiding this comment

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

Context-based matches can return a None variable name, which ends up as {None} in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.

Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/variable_identifier.py at line 287:

<comment>Context-based matches can return a None variable name, which ends up as `{None}` in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.</comment>

<file context>
@@ -0,0 +1,526 @@
+		for keyword, var_type in self.VARIABLE_KEYWORDS.items():
+			if keyword in combined_hints:
+				# Generate variable name from context
+				var_name = self._generate_variable_name_from_context(context, var_type)
+				confidence = 0.85  # Good confidence for context matches
+				logger.debug(f&quot;Context match: keyword &#39;{keyword}&#39; → {var_type} (name: {var_name})&quot;)
</file context>

✅ Addressed in 1fe6e86

sauravpanda and others added 2 commits November 4, 2025 15:40
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

Reviewed changes from recent commits (found 1 issue).

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="workflows/workflow_use/workflow/tests/test_variable_identifier.py">

<violation number="1" location="workflows/workflow_use/workflow/tests/test_variable_identifier.py:183">
This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

# Check schema structure
email_schema = next((s for s in schema if 'email' in s['name']), None)
assert email_schema is not None
assert email_schema['type'] == 'string'
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Nov 4, 2025

Choose a reason for hiding this comment

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

This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.

Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/tests/test_variable_identifier.py at line 183:

<comment>This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.</comment>

<file context>
@@ -180,7 +180,7 @@ def test_input_schema_generation(self):
 		email_schema = next((s for s in schema if &#39;email&#39; in s[&#39;name&#39;]), None)
 		assert email_schema is not None
-		assert email_schema[&#39;type&#39;] == &#39;email&#39;
+        assert email_schema[&#39;type&#39;] == &#39;string&#39;
 		assert email_schema[&#39;required&#39;] is True
 
</file context>
Suggested change
assert email_schema['type'] == 'string'
assert email_schema['type'] == 'string'
Fix with Cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

@sauravpanda sauravpanda merged commit 0f55339 into main Nov 4, 2025
8 checks passed
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.

Add AI powered variable identifier

1 participant