feat: add upload-artifact safe output type for run-scoped GitHub Actions artifact uploads#25002
feat: add upload-artifact safe output type for run-scoped GitHub Actions artifact uploads#25002
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… artifact support Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… artifact support Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot keep working |
|
@copilot remove "enabled: true" |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e2c3d991-4ccd-4c47-8a7b-53d9905e1444 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed the remaining code review feedback (consolidating split template literals into single template literals in 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:
|
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8dce883a-59fd-437b-a8ba-9dc9587acc98 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in 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:
|
|
@copilot use runner_temp env var like other temp folders |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/05ddc6f7-ae5e-4faa-9423-6f551a67af06 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in
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:
|
|
@copilot update smoke-copilot to upload the gh-aw binary as artifact using the safe output and set a 1 day retention, skip-artifact. |
…load_artifact job permissions and duplicate step bug Agent-Logs-Url: https://github.com/github/gh-aw/sessions/c901fdd4-ee9b-47d2-a4e6-ebe13975e3a4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in
Also fixed two bugs found during testing: the 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:
|
|
@copilot creation of artifacts does not require actions: write since it uses this secret: ACTIONS_RUNTIME_TOKEN Review source code of @actions/upload-artifact for reference |
…TIME_TOKEN instead Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4404709a-1bdd-4947-b526-9edf180e24cc Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The agent was using missing_tool for upload_artifact because it inferred the tool "wasn't available" (reading PR #25002 that adds it). Added an explicit note to the step 10 prompt making clear that upload_artifact IS configured and available in this run — agents must use it directly, not report it as missing. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ec3258ef-7bfb-40b6-a4b7-db15e0eab9db Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Validated in From run 24091825630:
The handler infrastructure is fully wired. The agent incorrectly inferred the tool wasn't available because it was reviewing this PR. Fixed the 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:
|
|
@copilot ensure the Upload Artifact tool is included in the prompt when safe-outputs is enabled, and ensure it can be imported from a shared agentic workflow. |
- `imports.go`: add `upload-artifact` case to `hasSafeOutputType()` so conflict detection catches duplicate import definitions - `imports.go`: add `UploadArtifact` field merge in `mergeSafeOutputConfig()` so `upload-artifact` configured in a shared workflow is correctly propagated to the compiled output - `shared/safe-output-upload-artifact.md`: new shared workflow file that workflows can import to enable the `upload_artifact` tool (max-uploads: 3, 7-day default retention, allow skip-archive) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9b0a2995-8016-4ea7-aaed-43f1d35d1fe5 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in Two fixes in
New shared workflow imports:
- shared/safe-output-upload-artifact.mdThe tool is included in the prompt automatically (via 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:
|
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready. |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
Agent Container Tool Check
Result: 12/12 tools available ✅ PASS
|
|
Commit pushed:
|
|
Smoke test results for run §24107238093 Merged PRs: #25172 Overall: FAIL
|
|
Smoke test #24107238086 results (
Overall:
|
There was a problem hiding this comment.
🤖 Smoke test review for run §24107238086. The upload-artifact feature looks well-structured — inline handler pattern is consistent with other safe output types.
📰 BREAKING: Report filed by Smoke Copilot · ● 1.5M
| @@ -0,0 +1,408 @@ | |||
| // @ts-check | |||
There was a problem hiding this comment.
🤖 Smoke test agent checking in! Good use of @ts-check for type safety in this new handler. The JSDoc comment block on the handler is thorough and follows the established pattern. Confirmed working in run §24107238086.
| description: 'Install @actions/github for handlers that use a per-handler github-token (creates Octokit via getOctokit)' | ||
| required: false | ||
| default: 'false' | ||
| safe-output-artifact-client: |
There was a problem hiding this comment.
🤖 Smoke test agent here! The safe-output-artifact-client input is well-designed — conditional install of @actions/artifact keeps setup lean. Confirmed working in run §24107238086. ✅
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
Smoke Test Run §24107238119 — PARTIAL Core tests #1-12: ✅✅✅✅✅❌✅✅✅✅✅✅ ❌ #6 Tavily: tool not available
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal! This PR adds native artifact storage support with clean, minimal changes to the action inputs and smoke workflow configuration.
💥 [THE END] — Illustrated by Smoke Claude · ● 282.9K
| @@ -49,6 +49,12 @@ runtimes: | |||
| version: "1.25" | |||
There was a problem hiding this comment.
The safe-outputs block is well-structured. The upload-artifact config with retention-days: 1 and max-uploads: 1 is appropriately scoped for a smoke test workflow — avoids unnecessary artifact accumulation.
| @@ -10,6 +10,10 @@ inputs: | |||
| description: 'Install @actions/github for handlers that use a per-handler github-token (creates Octokit via getOctokit)' | |||
There was a problem hiding this comment.
The new safe-output-artifact-client input is cleanly named and follows the existing pattern with required: false and default: 'false'. This is a good minimal addition that keeps the action composable.
Adds a new
upload-artifactsafe output type that lets AI agents declaratively request GitHub Actions artifact uploads — distinct from the existingupload-asset(git orphan branch) path. Returns a temporary opaque artifact ID rather than a raw download URL, keeping authorization and auditing centralized.Design
The model stages files to
$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/and emitsupload_artifactrecords. Thesafe_outputsjob runs theupload_artifacthandler inline in the unified handler loop (same as all other safe output types). The handler uploads approved files directly via the@actions/artifactREST API client (DefaultArtifactClient.uploadArtifact()) — no compiled YAML slot steps and no separate standalone job required.Temporary IDs use the format
tmp_artifact_<26 uppercase alphanumeric chars>and are written to a resolver file for downstream steps.All staging and resolver paths use
process.env.RUNNER_TEMPin JavaScript — consistent with all other temp folders in the codebase.No special workflow permissions are required —
@actions/artifactauthenticates viaACTIONS_RUNTIME_TOKENwhich is automatically available to the runner.The staging directory (
$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/) is pre-created before the agent starts and mounted read-write into the agent container, overriding the parent:romount so the agent can stage files without silent failures.Front matter
The feature is enabled simply by including the
upload-artifact:section (noenabled: truerequired — same pattern asupload-asset):It can also be enabled via import from the new shared workflow:
Output payload (model-emitted)
{ "type": "upload_artifact", "path": "dist/report.json", "retention_days": 14 } { "type": "upload_artifact", "filters": { "include": ["reports/**/*.json"], "exclude": ["reports/private/**"] } } { "type": "upload_artifact", "path": "dist/app.bin", "skip_archive": true }Changes
pkg/workflow/publish_artifacts.go—UploadArtifactConfig(withArtifactFiltersConfig,ArtifactDefaultsConfig,ArtifactAllowConfig), frontmatter parser, staging artifact upload step generatoractions/setup/js/upload_artifact.cjs— per-message handler:main(config)returns a handler function called once perupload_artifactmessage; handles path/filter resolution against staging dir, allowed-paths policy, skip-archive single-file constraint, size validation, direct upload viaDefaultArtifactClient.uploadArtifact()(injectable viaglobal.__createArtifactClientfor tests), temp ID generation + resolver file writeactions/setup/action.yml— addedsafe-output-artifact-clientinput; whentrue, setup installs@actions/artifactinto the actions destination directorypkg/workflow/mcp_setup_generator.go— pre-creates the staging directory and adds a read-write--mountfor it so the agent container can write staged filespkg/workflow/awf_helpers.go— adds--mountforupload-artifactsstaging dir whenupload_artifactis configuredpkg/workflow/imports.go— addedupload-artifacttohasSafeOutputType()(conflict detection) andUploadArtifactpropagation tomergeSafeOutputConfig()so the tool can be imported from shared workflows.github/workflows/shared/safe-output-upload-artifact.md— new shared workflow file; import it to enableupload_artifactwith sensible defaults (max-uploads: 3, 7-day retention, allow skip-archive)smoke-copilot.md— updated to useupload-artifactsafe output and upload thegh-awbinary as a 1-day retention artifactChangeset
upload-artifactsafe output type for run-scoped GitHub Actions artifact uploads, including frontmatter/config support, inline handler processing, staging/mount wiring, and shared workflow import support.✨ PR Review Safe Output Test - Run 24107238119