Add push-to-orphaned-branch safe output type with SHA-based filenames, configurable branches, flexible validation, MCP compliance, file-based architecture, environment-driven paths, and robust configuration#833
Conversation
…erver, and job builder Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…validation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…phaned-branch Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
|
||
| // Generate GitHub raw URLs | ||
| for (const filename of uploadedFiles) { | ||
| const rawUrl = `https://raw.githubusercontent.com/${owner}/${repo.repo}/${commitSha}/${filename}`; |
There was a problem hiding this comment.
Can you use the branch instead of commit sha? @copilot
There was a problem hiding this comment.
Changed to use branch name instead of commit SHA in raw URLs in commit adbd59b. URLs now use the format https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{filename} which provides more stable URLs that don't change with each commit.
| content: [ | ||
| { | ||
| type: "text", | ||
| text: `File uploaded successfully. SHA: ${fileSha}, Original filename: ${path.basename(filename)}`, |
There was a problem hiding this comment.
Also return the rawUrl that will result to pushing this file to the branch. @copilot
There was a problem hiding this comment.
Added expected URL template to the MCP server response in commit adbd59b. The response now includes the URL format that will result from pushing the file, showing the branch configuration and SHA-based filename: https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{sha-filename}
…L to MCP response Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
||
| fs.writeFileSync(safeFilename, fileBuffer); | ||
| const originalName = original_filename || filename; | ||
| const fileSha = sha || "unknown"; |
There was a problem hiding this comment.
@copilot
Fail is sha is not equal to compute sha of file buffer
There was a problem hiding this comment.
Added SHA validation in commit b0bf19e. The upload process now computes the SHA256 of the file buffer and fails the workflow if it doesn't match the expected SHA from the agent output, ensuring file integrity.
…d-branch Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
left a comment
There was a problem hiding this comment.
- enable playwright tool on dev agnetic workflow
- update prompt to build docs and take a screenshot and post it as an issue
- update description of new tool to tell LLM to use expected URL
- enable safe outputs to push to orphaned branch and create issue
| const originalExtension = path.extname(filename); | ||
|
|
||
| // Validate file extension is reasonable | ||
| const allowedExtensions = [ |
There was a problem hiding this comment.
- allowed extension has up to 5 alpha-numerical characters.
There was a problem hiding this comment.
Updated file extension validation in commit c2b4746. Now allows any extension with up to 5 alphanumeric characters instead of a hardcoded allowlist, providing more flexibility while maintaining security.
| text: `File uploaded successfully. SHA: ${fileSha}, Original filename: ${path.basename(filename)}, Expected URL: ${templateUrl}`, | ||
| }, | ||
| ], | ||
| url: templateUrl, |
There was a problem hiding this comment.
@copilot remove url field, not supported in MCP
There was a problem hiding this comment.
Removed the unsupported url field from MCP response in commit c2b4746. The response now only includes the text content with expected URL information for MCP protocol compliance.
…m MCP response Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated dev workflow in commit c2b4746 to enable playwright tool, add safe outputs for push-to-orphaned-branch and create-issue, and updated the prompt to build docs, take screenshots, and create issues with guidance on using the expected URL from the upload response. |
|
@copilot instead of bundling the file contents in the safe_outputs JSONL, copy the file to a known folder in a temp folder (/temp/aw/safe-outputs/) that will get uploaded as part of the safe outputs artifact. Use the sha-based filename.
|
…ontent in JSONL Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented file-based safe outputs architecture in commit 0577df8. Files are now copied to |
|
…aths Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented all requested changes in commit 7d2696f: Files are now stored in nested subdirectory |
pkg/workflow/claude_engine.go
Outdated
| if workflowData.SafeOutputs != nil { | ||
| stepLines = append(stepLines, " GITHUB_AW_SAFE_OUTPUTS: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}") | ||
| stepLines = append(stepLines, " GITHUB_AW_SAFE_OUTPUTS_DIR: ${{ steps.setup_agent_output.outputs.output_dir }}") | ||
| stepLines = append(stepLines, " GITHUB_AW_SAFE_OUTPUTS_FILES_DIR: ${{ steps.setup_agent_output.outputs.files_dir }}") |
There was a problem hiding this comment.
Updated to use environment variable reference in commit 6bd077d. Now uses ${{ env.GITHUB_AW_SAFE_OUTPUTS_FILES_DIR }} instead of step output reference for consistent environment variable usage across all engines.
pkg/workflow/compiler.go
Outdated
| yaml.WriteString(" with:\n") | ||
| fmt.Fprintf(yaml, " name: %s\n", OutputArtifactName) | ||
| yaml.WriteString(" path: ${{ env.GITHUB_AW_SAFE_OUTPUTS }}\n") | ||
| yaml.WriteString(" path: /tmp/gh-aw/safe-outputs/\n") |
There was a problem hiding this comment.
Use the env variable that points to the directory
There was a problem hiding this comment.
Updated artifact upload path to use environment variable in commit 6bd077d. Now uses ${{ env.GITHUB_AW_SAFE_OUTPUTS_DIR }} instead of hardcoded path for dynamic path resolution.
… references Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…lidation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implementing requested changes to push-to-orphaned-branch safe output type:
Environment Variable Consistency Updates
Improved Environment Variable Usage
${{ env.GITHUB_AW_SAFE_OUTPUTS_DIR }}and${{ env.GITHUB_AW_SAFE_OUTPUTS_FILES_DIR }}instead of step outputsEnhanced Configuration and Validation
Robust Environment Variable Validation
GITHUB_AW_SAFE_OUTPUTS_CONFIG,GITHUB_AW_SAFE_OUTPUTS,GITHUB_AW_SAFE_OUTPUTS_DIR, andGITHUB_AW_SAFE_OUTPUTS_FILES_DIRImproved File Naming Convention
outputs.jsonltosafe_outputs.jsonlfor better identificationChanges Made
Engine Environment Configuration
${{ env.GITHUB_AW_SAFE_OUTPUTS_DIR }}and${{ env.GITHUB_AW_SAFE_OUTPUTS_FILES_DIR }}MCP Server Environment
Artifact Upload Path
${{ env.GITHUB_AW_SAFE_OUTPUTS_DIR }}instead of hardcoded pathBenefits
Enhanced Reliability
Consistency
Maintainability
Testing
Technical Implementation
Environment Variable Flow
core.exportVariable()sets environment variables for subsequent steps${{ env.VARIABLE_NAME }}Configuration Validation Pattern
Consistency Pattern
The implementation ensures all path references use environment variables consistently while providing robust configuration validation, better naming conventions, and improved error handling for a more reliable and maintainable system.
💡 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.