Skip to content

fix: add auth and error handling to build-test workflows#514

Merged
Mossaka merged 1 commit intomainfrom
fix/build-test-auth-and-errors
Feb 4, 2026
Merged

fix: add auth and error handling to build-test workflows#514
Mossaka merged 1 commit intomainfrom
fix/build-test-auth-and-errors

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 4, 2026

Summary

  • Add env.GH_TOKEN using GH_AW_GITHUB_MCP_SERVER_TOKEN secret for repository cloning
  • Change git clone to gh repo clone (uses GH_TOKEN automatically)
  • Add explicit failure handling instructions in prompts
  • Workflows now fail visibly when clone/build/test fails instead of silently succeeding

Problem

The build-test workflows were showing as "success" even when they couldn't clone the test repositories due to authentication issues. The workflows use git clone directly which doesn't have access to GitHub credentials.

Solution

  1. Add GH_TOKEN environment variable: Each workflow now passes GH_AW_GITHUB_MCP_SERVER_TOKEN as GH_TOKEN to the agent container
  2. Use gh repo clone: Changed from git clone https://... to gh repo clone owner/repo which automatically uses the GH_TOKEN environment variable
  3. Explicit error handling: Added instructions in each workflow prompt to call safeoutputs-missing_tool with clear error messages when clone fails

Affected Workflows

  • build-test-java
  • build-test-rust
  • build-test-node
  • build-test-go
  • build-test-cpp
  • build-test-deno
  • build-test-bun

Test Plan

  • Trigger each build-test workflow
  • Verify workflows can now clone the test repositories
  • Verify workflows fail with clear error messages if authentication or clone fails

🤖 Generated with Claude Code

- Add env.GH_TOKEN using GH_AW_GITHUB_MCP_SERVER_TOKEN secret
- Change git clone to gh repo clone (uses GH_TOKEN automatically)
- Add explicit failure handling instructions in prompts
- Workflows fail visibly when clone/build/test fails

Affected workflows: build-test-{java,rust,node,go,cpp,deno,bun}

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 4, 2026 21:15
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.08% 82.08% ➡️ +0.00%
Statements 82.12% 82.12% ➡️ +0.00%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 75.41% 75.41% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

❌ C++ Build Test: CLONE FAILED

Error: Unable to clone test repository Mossaka/gh-aw-firewall-test-cpp

Details:

GraphQL: Could not resolve to a Repository with the name 'Mossaka/gh-aw-firewall-test-cpp'

Possible causes:

  • Repository does not exist
  • Repository is private and requires authentication
  • Repository name is incorrect

Action required: Verify the test repository exists and is accessible before re-running this workflow.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Smoke Test: Claude Engine ✅ PASS

Last 2 Merged PRs:

  • fix: restructure smoke-chroot workflow to avoid Docker-in-Docker
  • feat: add CLI flag consistency checker agentic workflow

Test Results:

  • ✅ GitHub MCP (list PRs)
  • ✅ Playwright (navigated to github.com, title verified)
  • ✅ File Writing (created /tmp/gh-aw/agent/smoke-test-claude-21688655921.txt)
  • ✅ Bash Tool (verified file content)

Overall Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Build Test: Node.js - FAILED ❌

Status: Clone operation failed

Error: Unable to clone test repository Mossaka/gh-aw-firewall-test-node

GraphQL: Could not resolve to a Repository with the name 'Mossaka/gh-aw-firewall-test-node'.

Action Required: Verify that the test repository exists and is accessible.

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Smoke Test Results

Last 2 merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved PR data successfully
  • ✅ Playwright: Page title verified ("GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File Write: Created /tmp/gh-aw/agent/smoke-test-copilot-21688655959.txt
  • ✅ Bash Tool: File verified with cat command

Status: PASS

cc: @Mossaka

AI generated by Smoke Copilot

Copy link

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 pull request addresses authentication issues in build-test workflows that were causing silent failures when cloning test repositories. The PR adds GitHub token authentication and explicit error handling to ensure workflows fail visibly when operations cannot complete.

Changes:

  • Added GH_TOKEN environment variable using GH_AW_GITHUB_MCP_SERVER_TOKEN secret to all build-test workflows
  • Changed from git clone to gh repo clone command for repository cloning
  • Added explicit error handling instructions with calls to error reporting tool when clone/build/test operations fail

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/build-test-rust.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-rust.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-node.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-node.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-java.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-java.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-go.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-go.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-deno.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-deno.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-cpp.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-cpp.lock.yml Auto-generated with updated frontmatter hash and env section
.github/workflows/build-test-bun.md Added GH_TOKEN env, updated clone command to gh repo clone, added error handling section
.github/workflows/build-test-bun.lock.yml Auto-generated with updated frontmatter hash and env section
Comments suppressed due to low confidence (7)

.github/workflows/build-test-go.md:51

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. This instruction should be: "If clone fails, immediately call missing_tool with reason 'CLONE_FAILED: Unable to clone test repository' and stop execution".
   - **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution

.github/workflows/build-test-rust.md:80

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"

.github/workflows/build-test-node.md:51

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. This instruction should be: "If clone fails, immediately call missing_tool with reason 'CLONE_FAILED: Unable to clone test repository' and stop execution".
   - **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution

.github/workflows/build-test-deno.md:85

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
2. **Deno install failure**: Call `safeoutputs-missing_tool` with "DENO_INSTALL_FAILED: [error message]"

.github/workflows/build-test-java.md:80

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"

.github/workflows/build-test-cpp.md:47

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. This instruction should be: "If clone fails, immediately call missing_tool with reason 'CLONE_FAILED: Unable to clone test repository' and stop execution".
   - **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution

.github/workflows/build-test-bun.md:84

  • The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
2. **Bun install failure**: Call `safeoutputs-missing_tool` with "BUN_INSTALL_FAILED: [error message]"

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


1. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-java.git /tmp/test-java`
1. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-java /tmp/test-java`
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. This instruction should be: "If clone fails, immediately call missing_tool with reason 'CLONE_FAILED: Unable to clone test repository' and stop execution".

Copilot uses AI. Check for mistakes.

**CRITICAL**: This workflow MUST fail visibly when errors occur:

1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 506 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Suggested change
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
env: {}

Copilot uses AI. Check for mistakes.

1. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-rust.git /tmp/test-rust`
1. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-rust /tmp/test-rust`
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. This instruction should be: "If clone fails, immediately call missing_tool with reason 'CLONE_FAILED: Unable to clone test repository' and stop execution".

Copilot uses AI. Check for mistakes.

**CRITICAL**: This workflow MUST fail visibly when errors occur:

1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The tool name safeoutputs-missing_tool is incorrect. According to the codebase conventions (see .github/aw/debug-agentic-workflow.md:192-193), safe-output tools should NOT have a "safeoutputs-" prefix. The correct tool name is simply missing_tool. Update all references in this Error Handling section to use missing_tool instead of safeoutputs-missing_tool.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 506 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 506 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +45
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}

Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 506 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Suggested change
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 506 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

After adding GH_TOKEN to the workflow environment (lines 43-44), the gh CLI will now be authenticated within the container. However, the auto-generated prompt around line 512 of this file still states "The gh CLI is NOT authenticated. Do NOT use gh commands for GitHub operations." This creates a contradiction with the new instructions in the .md file that tell the agent to use gh repo clone. The file needs to be recompiled with updated logic that recognizes when GH_TOKEN is set and adjusts the authentication message accordingly.

Copilot uses AI. Check for mistakes.
@Mossaka Mossaka merged commit 5563ec3 into main Feb 4, 2026
79 checks passed
@Mossaka Mossaka deleted the fix/build-test-auth-and-errors branch February 4, 2026 22:07
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.

1 participant