Skip to content

fix(workflows): command/prompt steps fail cleanly on a non-string integration#3626

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/command-prompt-nonstring-integration
Jul 22, 2026
Merged

fix(workflows): command/prompt steps fail cleanly on a non-string integration#3626
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/command-prompt-nonstring-integration

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

Both the command and prompt steps dispatch via _try_dispatch, which guarded only the falsy case before the registry lookup:

if not integration_key:
    return None
...
impl = get_integration(integration_key)   # dict lookup

A non-string integration — a list/dict, or an expression like integration: "{{ steps.pick.output.agents }}" that resolves to a list — passes the falsy guard and hits get_integration's dict lookup, raising TypeError: unhashable type: 'list' and aborting the entire workflow run.

Fix

Widen the guard to also require a str:

if not integration_key or not isinstance(integration_key, str):
    return None

None routes execution to the already-present FAILED StepResult ("Cannot dispatch … integration … not found"), so the step fails cleanly instead of crashing the run. Unconfigured integration=None still returns None as before. Applied to both command and prompt steps.

Test

test_execute_non_string_integration_fails_cleanly (command + prompt): a list integration yields a FAILED result — fails before (TypeError: unhashable type: 'list'), passes after.


🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.

…egration

_try_dispatch guarded only 'if not integration_key', then called
get_integration(integration_key). A non-string integration (a list/dict, or an
expression like integration: "{{ steps.pick.output.agents }}" that resolves to a
list) reached the registry dict lookup and raised 'TypeError: unhashable type:
list', aborting the entire workflow run. Widen the guard to also require a str,
so a non-string integration is treated as not-dispatchable and execute() falls
through to its existing FAILED StepResult (unconfigured integration=None still
returns None as before). Applied to both command and prompt steps.

Tests: a list integration now yields a FAILED result (fail before: TypeError).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Prevents command and prompt workflow steps from crashing when integration expressions resolve to non-string values.

Changes:

  • Rejects non-string integration keys before registry lookup.
  • Adds regression tests confirming clean FAILED results.
Show a summary per file
File Description
src/specify_cli/workflows/steps/command/__init__.py Guards command dispatch integration keys.
src/specify_cli/workflows/steps/prompt/__init__.py Guards prompt dispatch integration keys.
tests/test_workflows.py Tests non-string integrations for both step types.

Review details

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Medium

@mnriem
mnriem merged commit aee9df0 into github:main Jul 22, 2026
12 checks passed
@mnriem

mnriem commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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.

3 participants