Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

Fix SC2155: Separate export declaration from command substitution in workflows

Progress Checklist

  • Understand the issue - SC2155 warnings about masking exit status
  • Identify affected code locations (2 files in pkg/workflow/)
  • Fix claude_engine.go - split export PATH command
  • Fix codex_engine.go - split export PATH command
  • Rebuild the binary with make build
  • Recompile workflows with make recompile
  • Verify fixes with actionlint .github/workflows/*.lock.yml
  • Run tests to ensure no regression
  • Confirm all 31 SC2155 warnings are resolved
  • Refactor claude_engine.go to use pathSetup variable for consistency

Summary

Successfully fixed all 31 SC2155 shellcheck warnings by separating variable declaration from command substitution in PATH export statements. The problematic pattern:

export PATH="/opt/hostedtoolcache/node/$(ls ...)/x64/bin:$PATH"

Was changed to:

NODE_BIN_PATH="$(ls /opt/hostedtoolcache/node | head -1)/x64/bin" && export PATH="/opt/hostedtoolcache/node/$NODE_BIN_PATH:$PATH"

This prevents masking the exit status of the ls command, ensuring that failures are properly detected when set -e is enabled.

Both claude_engine.go and codex_engine.go now consistently use the pathSetup variable pattern for better code maintainability.

All tests pass and actionlint confirms 0 SC2155 warnings remain.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Fix SC2155: Separate local declaration from assignment in 31 workflows</issue_title>
<issue_description>## Objective

Fix 31 occurrences of shellcheck SC2155 warnings across workflow files. This is the highest priority issue as it's warning-level and can mask command failures.

Problem

Combining local declaration with command substitution masks the exit status:

local result=$(command)  # ❌ Exit status of 'command' is masked by 'local'

With set -e, the script should exit on errors, but this pattern prevents that - the exit status checked is from local (always 0), not from the command.

Solution

Split into two statements:

local result
result=$(command)  # ✅ Exit status properly checked

Affected Workflows (31 total)

Click to expand full list
  • audit-workflows
  • blog-auditor
  • cli-version-checker
  • cloclo
  • commit-changes-analyzer
  • copilot-agent-analysis
  • copilot-session-insights
  • daily-choice-test
  • daily-code-metrics
  • daily-doc-updater
  • daily-multi-device-docs-tester
  • developer-docs-consolidator
  • example-workflow-analyzer
  • github-mcp-structural-analysis
  • github-mcp-tools-report
  • go-fan
  • go-logger
  • go-pattern-detector
  • instructions-janitor
  • lockfile-stats
  • prompt-clustering-analysis
  • safe-output-health
  • schema-consistency-checker
  • scout
  • security-fix-pr
  • semantic-function-refactor
  • smoke-claude
  • smoke-detector
  • static-analysis-report
  • typist
  • unbloat-docs

Approach

  1. Search for pattern local.*=\$( in .github/workflows/*.md source files
  2. For each occurrence, split into two statements
  3. Recompile affected workflows: make recompile
  4. Verify fixes with: actionlint .github/workflows/*.lock.yml

Files to Modify

All files are in .github/workflows/:

  • 31 .md workflow source files (edit these)
  • Corresponding .lock.yml files (regenerated via make recompile)

Acceptance Criteria

AI generated by Plan Command for discussion #7889

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 27, 2025
Split export PATH statements with command substitution into two statements
to avoid masking exit status of the ls command. This resolves all 31
SC2155 shellcheck warnings in compiled workflow files.

Changes:
- pkg/workflow/claude_engine.go: Split export PATH into variable assignment + export
- pkg/workflow/codex_engine.go: Split export PATH into variable assignment + export

Fixes #7896

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SC2155 warnings in 31 workflow files Fix SC2155: Separate export declaration from command substitution Dec 27, 2025
Copilot AI requested a review from mnkiefer December 27, 2025 16:09
@pelikhan
Copy link
Contributor

@copilot use pathSetup

Extract PATH setup logic into a pathSetup variable in claude_engine.go
to match the pattern already used in codex_engine.go. This improves
code consistency and maintainability.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 27, 2025

@copilot use pathSetup

Done in ecfb5c3. Extracted the PATH setup logic into a pathSetup variable to match the pattern used in codex_engine.go.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

✅ Firewall validation complete... Smoke Codex Firewall confirmed network sandboxing is operational. 🛡️

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

🤖 DIAGNOSTIC COMPLETE: Smoke Copilot No Firewall STATUS: ALL_UNITS_OPERATIONAL. MISSION_SUCCESS.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

🎉 Yo ho ho! Smoke Copilot Safe Inputs found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

Smoke Test Results

File Writing: Created test file successfully
Bash Tool: Verified file creation with cat
⏭️ Safe Input gh Tool: Skipped (tool not available in environment)

Overall Status: ⚠️ PARTIAL PASS (2/2 available tests passed)

Note: safeinputs-gh tool is not available in this workflow execution environment.

Ahoy! This treasure was crafted by 🏴‍☠️ Smoke Copilot Safe Inputs fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Firewall smoke test:

🔥 Firewall tested by Smoke Codex Firewall fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Smoke Test Results

  • Playwright MCP: Successfully navigated to GitHub and verified page title
  • Cache Memory: Created and verified test file at /tmp/gh-aw/cache-memory/smoke-test-20542140715.txt
  • Safe Input gh Tool: Tool exists and is callable (execution tested separately)

Overall Status: PASS

📰 BREAKING: Report filed by Smoke Copilot Playwright fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Smoke Test Results (Run 20542140706)

Last 2 Merged PRs: #7910, #7903

✅ GitHub MCP Testing
✅ File Writing Testing
✅ Bash Tool Testing
✅ Default Toolset (get_me unavailable)
✅ Cache Memory Testing
❌ MCP Gateway (not running)

Status: PARTIAL PASS (5/6)

cc @pelikhan

📰 BREAKING: Report filed by Smoke Copilot fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Smoke Test Results (Run #20542140718)

Last 2 Merged PRs:

GitHub MCP - Retrieved 2 merged PRs
File Write - Created and verified test file
Bash Tool - Read file successfully
Playwright - Page title contains "GitHub"
Safe Input gh - Tool not available (not imported)

Status: PARTIAL PASS (4/5 tests passed)

🤖 DIAGNOSTIC REPORT GENERATED BY Smoke Copilot No Firewall fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Smoke Test Results for Claude Engine

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved recent PRs
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-claude-20542140708.txt
  • ✅ Bash Tool: Verified file contents successfully
  • ✅ Playwright MCP: Navigated to GitHub, title contains "GitHub"
  • ✅ Cache Memory: Created /tmp/gh-aw/cache-memory/smoke-test-20542140708.txt
  • ❌ Safe Input gh Tool: Not available (gh CLI not authenticated)

Overall Status: PASS (5/6 tests passed, 1 tool unavailable)

💥 [THE END] — Illustrated by Smoke Claude fer issue #7905 🗺️

@github-actions
Copy link
Contributor

Merged PR titles: jsweep: Prioritize files with @ts-nocheck for type checking; Configure TypeScript type checking for all .cjs files in actions/setup/js
GitHub MCP PR check: ✅
File write /tmp/gh-aw/agent: ✅
Cache memory write: ✅
Playwright title contains "GitHub": ✅
safeinputs-gh gh issues list: ❌ (command not available)
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex fer issue #7905 🗺️

@pelikhan pelikhan marked this pull request as ready for review December 27, 2025 17:59
@pelikhan pelikhan merged commit bf682a8 into main Dec 27, 2025
16 of 18 checks passed
@pelikhan pelikhan deleted the copilot/fix-shellcheck-sc2155-warnings branch December 27, 2025 18:00
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.

[plan] Fix SC2155: Separate local declaration from assignment in 31 workflows

3 participants