fix: emit sbx credential refresh step before agent execution#45146
Conversation
Docker Hub OAuth tokens obtained by `sbx login` during the daemon-setup step can expire or be invalidated by the policy-reset cycle. By the time AWF calls `sbx create`, the sbx daemon no longer has valid Docker Hub credentials, causing 'user is not authenticated to Docker' errors. Add a `generateDockerSbxCredentialRefreshStep()` that runs `sbx login` immediately before the agent execution step, ensuring the daemon has fresh credentials when AWF creates the microVM sandbox. The step is emitted in `compiler_yaml_ai_execution.go` (the common compilation path for all engines) so it applies to Copilot, Claude, Codex, and any future engine using docker-sbx runtime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a Docker sbx credential refresh immediately before agent execution, preventing stale authentication failures.
Changes:
- Emits a conditional
sbx loginrefresh step. - Passes Docker credentials through environment variables.
- Tests step generation and execution ordering.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/docker_sbx_install.go |
Generates the credential refresh step. |
pkg/workflow/compiler_yaml_ai_execution.go |
Inserts refresh before engine execution. |
pkg/workflow/docker_sbx_test.go |
Verifies content and ordering. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Medium
|
✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready. |
|
🚀 Smoke Gemini MISSION COMPLETE! Gemini has spoken. ✨ |
|
🌑 The shadows whisper... Smoke Codex failed to deliver outputs. The oracle requires further meditation... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧 |
|
🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨ |
|
❌ Smoke Copilot Small failed. Please review the logs for details. |
|
📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing... |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing... |
Smoke Test Results
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Agent Container Tool Check
Result: 12/12 tools available ✅ Overall Status: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
Caution agentic threat detected DetailsThe threat detection engine failed to produce results. Review the workflow run logs for details. Pull request created: #45150
|
|
Smoke test for PR: fix: emit sbx credential refresh step before agent execution Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment. Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
💨 Smoke Test: Claude — Run 29215927006Core #1-12: ✅ All passed Overall: PARTIAL — all executed tests passed. 💥 Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
Warning
Firewall blocked 6 domains
The following domains were blocked by the firewall during workflow execution:
accounts.google.comandroid.clients.google.comclients2.google.comcontentautofill.googleapis.comsafebrowsingohttpgateway.googleapis.comwww.google.com
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
💥 [THE END] — Illustrated by Smoke Claude · 75.3 AIC · ⌖ 31.3 AIC · ⊞ 8.4K
Comment /smoke-claude to run again
| // Refresh sbx credentials immediately before AWF execution. Docker Hub OAuth | ||
| // tokens obtained during the daemon-setup step can expire between workflow steps, | ||
| // causing "user is not authenticated to Docker" errors when AWF calls `sbx create`. | ||
| if isDockerSbxRuntime(data) { |
There was a problem hiding this comment.
Nice — gating the credential refresh on isDockerSbxRuntime keeps this cleanly scoped to the docker-sbx runtime. 👍
| // sbx daemon with Docker Hub immediately before AWF runs the agent. OAuth tokens | ||
| // obtained by `sbx login` during the daemon-setup step can expire or be invalidated | ||
| // by the policy-reset cycle, so a fresh login right before execution prevents | ||
| // "user is not authenticated to Docker" errors when AWF calls `sbx create`. |
There was a problem hiding this comment.
Clear doc comment explaining why the token can expire — helpful context for future maintainers.
|
PR: fix: emit sbx credential refresh step before agent execution Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment. Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
Smoke validation review comments attached.
Warning
Firewall blocked 6 domains
The following domains were blocked by the firewall during workflow execution:
accounts.google.comandroid.clients.google.comclients2.google.comcontentautofill.googleapis.comsafebrowsingohttpgateway.googleapis.comwww.google.com
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
📰 BREAKING: Report filed by Smoke Copilot · 91.3 AIC · ⌖ 3.11 AIC · ⊞ 19K
Comment /smoke-copilot to run again
Add label smoke to run again
|
Hey @lpcox 👋 — great fix for the The PR is well-structured: focused change, clear Problem/Solution/Testing breakdown, tests included for both the new step generation and step ordering. This looks ready for review. 🚀
|
|
🎉 This pull request is included in a new release. Release: |
Summary
Fixes intermittent
"user is not authenticated to Docker"errors that occur when AWF callssbx createduring agent execution. Docker Hub OAuth tokens obtained bysbx loginduring the daemon-setup step can expire or be invalidated between workflow steps. This PR emits a credential-refresh step immediately before agent execution for allsbx-runtime workflows.Changes
pkg/workflow/compiler_yaml_ai_execution.gogenerateAgentRunSteps, added a conditional block: whenisDockerSbxRuntime(data)is true, emits the new credential-refresh step after the CLI proxy step and before agent execution.pkg/workflow/docker_sbx_install.gogenerateDockerSbxCredentialRefreshStep()— returns aGitHubActionStepthat emits a GitHub Actions step named "Refresh sbx credentials".DOCKER_PATandDOCKER_USERNAMEsecrets to env vars (DOCKER_PAT_VAL,DOCKER_USERNAME_VAL) and callssbx login --username "$DOCKER_USERNAME_VAL" --password-stdinviaprintf.${{ secrets.* }}from appearing in shell commands.pkg/workflow/docker_sbx_test.gogenerateDockerSbxCredentialRefreshStep(): verifies step name,sbx loginpresence, correct env var mapping, and that raw secret expressions are absent from therun:body.agentic_execution.Root Cause
Docker Hub OAuth tokens have a limited TTL. When a workflow has multiple steps between
sbx login(daemon setup) andsbx create(agent execution), the token can expire, causing authentication failures at runtime.Behaviour
sbx createfails with auth errorsbx loginruns immediately before executionisDockerSbxRuntime)Testing
TestGenerateDockerSbxInstallSteps/credential_refresh_step