Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Static analysis identified SC2166 warnings in 138 workflow files using the deprecated -a operator in shell test expressions. The operator was generated by the workflow compiler, not present in source markdown files.

Changes

Core Fix

  • Modified pkg/workflow/unified_prompt_step.go line 335 to generate POSIX-compliant shell conditions
  • Changed from -a to separate test expressions joined with &&

Generated Output

  • Recompiled 140 workflow files with corrected syntax
  • All .lock.yml files now use POSIX-compliant test expressions

Example

Before:

if [ "$GITHUB_EVENT_NAME" = "issue_comment" -a -n "$GH_AW_IS_PR_COMMENT" ]; then

After:

if [ "$GITHUB_EVENT_NAME" = "issue_comment" ] && [ -n "$GH_AW_IS_PR_COMMENT" ]; then

This eliminates all SC2166 warnings and improves shell portability without functional changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Fix deprecated test syntax (SC2166) in 15 workflow files</issue_title>
<issue_description>## Description

Shellcheck (SC2166) identified 15 workflows using the deprecated -a operator in test expressions. This should be replaced with && for better portability and POSIX compliance.

Affected Workflows

  1. .github/workflows/ai-moderator.md
  2. .github/workflows/archie.md
  3. .github/workflows/brave.md
  4. .github/workflows/cloclo.md
  5. .github/workflows/craft.md
  6. .github/workflows/dev.md
  7. .github/workflows/dictation-prompt.md
  8. .github/workflows/example-workflow-analyzer.md
  9. .github/workflows/github-mcp-structural-analysis.md
  10. .github/workflows/grumpy-reviewer.md
  11. .github/workflows/jsweep.md
  12. .github/workflows/mcp-inspector.md
  13. .github/workflows/plan.md
  14. .github/workflows/q.md
  15. .github/workflows/sergo.md

Problem Pattern

Problematic Code:

if [ "$a" = "x" -a "$b" = "y" ]; then
  # do something
fi

Correct Code:

if [ "$a" = "x" ] && [ "$b" = "y" ]; then
  # do something
fi

Why This Matters

  • Portability: -a operator may fail on some shells
  • POSIX Compliance: && is the recommended approach
  • Best Practices: Modern shell scripting guidelines prefer &&

Success Criteria

  • All 15 workflows updated to use && instead of -a
  • Workflows recompiled with make recompile
  • No SC2166 warnings in next static analysis scan
  • All existing tests pass

Source

Extracted from Static Analysis Report discussion githubnext/gh-aw#12036

Finding: SC2166 - Deprecated Test Syntax (15 occurrences)
Severity: Warning
Priority: Medium
Automation Potential: High

Recommended Approach

  1. Create a script to identify and replace -a patterns
  2. Test on 2-3 workflows first
  3. Deploy in batches of 5 workflows
  4. Run make recompile after each batch
  5. Verify with make lint

Shellcheck Reference

See [SC2166]((redacted) for detailed explanation of this issue.

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 10, 2026, 9:06 PM UTC

Comments on the Issue (you are @copilot in this section)


💡 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.


Changeset

  • Type: patch
  • Description: Update the workflow compiler to emit POSIX-compliant shell test expressions and regenerate workflows so no prompt step uses the deprecated -a operator.

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator

Copilot AI and others added 2 commits January 27, 2026 22:01
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix deprecated test syntax in 15 workflow files Fix SC2166: Replace deprecated -a operator in shell conditions Jan 27, 2026
Copilot AI requested a review from pelikhan January 27, 2026 22:10
@pelikhan pelikhan added the smoke label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

Use Claude CLI --debug-file flag for native log capture
chore: enhance campaign id handling
GitHub MCP: ✅
Safeinputs gh: ✅
Serena: ✅
Playwright: ✅
Tavily: ✅
File/Bash: ✅
Discussion: ✅
Overall: PASS

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

Smoke Test Results - Copilot Engine

Status: ✅ PASS

Run: §21416250561

cc: @pelikhan

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results

PRs Reviewed:

Tests:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Serena MCP
  • ✅ Make Build
  • ✅ Playwright
  • ✅ Tavily Web Search
  • ✅ File Writing
  • ✅ Bash Tool
  • ✅ Discussion Interaction

Overall Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan marked this pull request as ready for review January 27, 2026 22:19
@pelikhan pelikhan merged commit 8f28b9d into main Jan 27, 2026
90 checks passed
@pelikhan pelikhan deleted the copilot/fix-deprecated-test-syntax branch January 27, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Fix deprecated test syntax (SC2166) in 15 workflow files

2 participants