Skip to content

Disable uv Actions caching and isolate sandbox runtime paths - #66958

Closed
SivaKesava1 with Copilot wants to merge 8 commits into
mainfrom
copilot/fix-uv-cache-permission-issue
Closed

SivaKesava1 with Copilot wants to merge 8 commits into
mainfrom
copilot/fix-uv-cache-permission-issue

Conversation

Copilot AI commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

setup-uv exports host-only directories that uv cannot write inside the AWF sandbox. Making those paths writable while retaining Actions caching would allow agent-written content to enter repository-wide caches.

  • Cache safety

    • Generate setup-uv with enable-cache: false; prevent deduplication from overriding it.
    • Warn on preserved custom setup-uv steps without caching disabled; reject them in strict mode.
  • Sandbox paths

    • Exclude UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR unless explicitly configured through workflow, engine, or sandbox environment settings.
    • Let uv use its writable defaults under HOME, retaining the existing AWF version gate.
    • Locally git-ignore Cloud Hypervisor’s .awf-home/ to keep tool state out of normal staging and patches.
  • Coverage and documentation

    • Add regression coverage for custom steps, overrides, version gating, and all three runner topologies.
    • Update runtime documentation and regenerate affected workflow locks.

Generated setup-uv configuration:

with:
  enable-cache: false

Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix uv cache directory permissions in AWF sandbox Disable uv Actions caching and isolate sandbox runtime paths Oct 8, 2026
Copilot AI requested a review from SivaKesava1 October 8, 2026 18:03
@SivaKesava1
SivaKesava1 marked this pull request as ready for review October 8, 2026 18:17
Copilot AI balanced review requested due to automatic review settings October 8, 2026 18:17
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #66958

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-08T18:21:23Z
review_event: REQUEST_CHANGES
top_themes:
  - substring-based deduplication can remove unrelated setup-uv-like actions
files_reviewed:
  - pkg/workflow/runtime_cache_validation.go
  - pkg/workflow/runtime_deduplication.go
  - pkg/workflow/awf_env.go
  - pkg/workflow/awf_command_builder.go
  - pkg/workflow/runtime_definitions.go
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 58 AIC · ⌖ 5.62 AIC · ⊞ 19.8K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes

The new uv hardening is headed in the right direction, but the validation path still still relies on the old substring-based runtime-step deduper, so we can silently drop unrelated uses: steps that merely contain astral-sh/setup-uv in the action name.

Blocking theme

The PR tightens repo matching for host-only env detection, but validateRuntimeSetupCaches still deduplicates through DeduplicateRuntimeSetupStepsFromCustomSteps, which matches on strings.Contains. That means an impostor action such as other/astral-sh/setup-uv@... can disappear before validation and from the compiled workflow whenever uv is otherwise detected. This is a compiler correctness regression, not just a warning-quality issue.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 58 AIC · ⌖ 5.62 AIC · ⊞ 19.8K
Comment /review to run again

Comment thread pkg/workflow/runtime_cache_validation.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Secret-expression detection and nested agent-job step discovery leave gaps in the intended security protections.

2 open findings
What changed in this PR

Updates gh-aw’s compiler to address #66779 by separating uv’s sandbox storage from host paths and disabling shared Actions caching.

Changes:

  • Disable generated uv caching and validate preserved custom setup steps.
  • Exclude host-only uv paths and locally git-ignore Cloud Hypervisor tool state.
  • Add regression coverage, document behavior, and regenerate workflow locks.
File Description
pkg/​workflow/​runtime_setup_test.go Tests cache defaults and deduplication.
pkg/​workflow/​runtime_setup_integration_test.go Covers topologies, overrides, and validation.
pkg/​workflow/​runtime_definitions.go Defines uv cache and host-path defaults.
pkg/​workflow/​runtime_deduplication.go Prevents deduplicated cache overrides.
pkg/​workflow/​runtime_cache_validation.go Validates custom uv caching.
pkg/​workflow/​runtime_cache_validation_test.go Tests cache validation policies.
pkg/​workflow/​compiler_validators.go Registers runtime cache validation.
pkg/​workflow/​cloud_hypervisor_test.go Tests local tool-state exclusions.
pkg/​workflow/​awf_env.go Collects host-only environment exclusions.
pkg/​workflow/​awf_env_test.go Tests exclusions and override precedence.
pkg/​workflow/​awf_command_builder.go Locally excludes .awf-home/ from Git.
docs/​src/​content/​docs/​reference/​frontmatter.md Documents cache and sandbox behavior.
.github/​workflows/​weekly-issue-summary.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​stale-repo-identifier.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​smoke-work-queue.lock.yml Adds local tool-state exclusion.
.github/​workflows/​python-data-charts.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​prompt-clustering-analysis.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​portfolio-analyst.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​org-health-report.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​github-mcp-structural-analysis.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​detection-analysis-report.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-spending-forecast.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-security-observability.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-repo-chronicle.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-performance-summary.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-news.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-mcp-concurrency-analysis.lock.yml Adds local tool-state exclusion.
.github/​workflows/​daily-issues-report.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-fact.lock.yml Adds local tool-state exclusion.
.github/​workflows/​daily-experiment-report.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-code-metrics.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​daily-caveman-optimizer.lock.yml Adds local tool-state exclusion.
.github/​workflows/​daily-awf-spec-compiler-surfacing.lock.yml Adds local tool-state exclusion.
.github/​workflows/​daily-agentrx-trace-optimizer.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​copilot-session-insights.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​copilot-pr-nlp-analysis.lock.yml Disables uv caching; excludes host paths.
.github/​workflows/​copilot-centralization-optimizer.lock.yml Adds local tool-state exclusion.
.github/​workflows/​audit-workflows.lock.yml Applies cache, path, and tool-state protections.
.github/​workflows/​api-consumption-report.lock.yml Disables uv caching; excludes host paths.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/workflow/awf_env.go Outdated
Comment thread pkg/workflow/runtime_cache_validation.go Outdated
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (763 new lines across pkg/workflow/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/66958-disable-uv-actions-caching-and-isolate-sandbox-runtime-paths.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Evidence used
  • No docs/adr/66958-*.md on the branch; PR body contains no ADR link or ADR section.
  • Decision inferred from: pkg/workflow/runtime_definitions.go (ExtraWithFields: enable-cache=false, new HostOnlyEnvVars field), pkg/workflow/awf_env.go (runtimeHostOnlyEnvVarNames + exclusion precedence for env/engine.env/sandbox.agent.env), pkg/workflow/runtime_cache_validation.go (warn, or error in strict mode, on custom setup-uv steps with caching enabled), pkg/workflow/awf_command_builder.go (/.awf-home/ appended to .git/info/exclude), and docs/src/content/docs/reference/frontmatter.md.
📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-66958: Disable uv Actions Caching and Exclude Host-Only Runtime Paths from the Sandbox

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus50 · 54 AIC · ⌖ 54.1 AIC · ⊞ 1.8K · ◷
Comment /review to run again

@github-actions github-actions Bot mentioned this pull request Oct 8, 2026
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/runtime_cache_validation.go:14): This reuses DeduplicateRuntimeSetupStepsFromCustomSteps, but that helper still treats any uses: containing astral-sh/setup-uv as a runtime setup step, so an unrelated action like other/astral-sh/setup-uv... will be silently stripped before we validate or compile whenever uv is detected. - Disable uv Actions caching and isolate sandbox runtime paths #66958 (comment)
  3. Review (pkg/workflow/awf_env.go:201): This literal-prefix check misses valid secret expressions such as ${{secrets.CACHE}} and ${{ vars.UV_CACHE_DIR || secrets.CACHE }}. When setup-uv is present and workflow env.UV_CACHE_DIR uses either form, the continue skips its runtime exclusion, allowing --env-all to forward the resolved secret unless explicitly excluded elsewhere. Use ExtractSecretsFromValue alongside ContainsJobOutputExpr, and add regression cases for these expression forms. - Disable uv Actions caching and isolate sandbox runtime paths #66958 (comment)
  4. Review (pkg/workflow/runtime_cache_validation.go:20): Both this validator and runtimeHostOnlyEnvVarNames omit jobs.agent.setup-steps and jobs.agent.pre-steps, although applyBuiltinJobPreSteps inserts them before the agent. A setup-uv action there can pass strict compilation with caching enabled; with a sandbox-writable cache-local-path, its post action can save agent-written content to a repository-wide cache. Even with caching disabled, if uv is not otherwise detected, UV_PYTHON_INSTALL_DIR remains forwarded and managed interpreter downloads target the unwritable host directory. Include both nested sections in setup-action discovery ... - Disable uv Actions caching and isolate sandbox runtime paths #66958 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: ccd3c89
Sous-chef work: 193b7803a43ecb00a2f28cbae3e0ff5f795bdd62711599b39fef21e403609ccd 3175a1beb10e17852a448004df846fa350497d4e6f2ce47d7040ca2638d3b272 e01891bfdef02902536e6e233b586109250ba864eefc45067b70f47ce7e7864d
Sous-chef state: 59e1ae0e8e2be54a85a36787dddbd472ccd76817374cef4ae6c63785798a2aa7

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 3.79 AIC · ⌖ 6.76 AIC · ⊞ 1K · ◷
Comment /souschef to run again

…permission-issue

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@pelikhan pelikhan added the awf label Oct 8, 2026
@pelikhan

pelikhan commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

@lpcox

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 8, 2026 19:14
@SivaKesava1

Copy link
Copy Markdown
Collaborator

@copilot /pr-finisher

Verified at ab971d3c in our private sandbox (Copilot and pi engines, runtimes: uv, task runs uv sync and pytest, AWF v0.28.44):

  • The setup-uv step has enable-cache: false. Its log shows no Set UV_CACHE_DIR, no cache restore and no cache save, and --exclude-env UV_CACHE_DIR / UV_PYTHON_INSTALL_DIR are on the AWF command.
  • Inside the sandbox there were 0 Failed to initialize cache errors (previously 2–39 per run), and no agent invented its own UV_CACHE_DIR. The full test suite ran (408 passed; the 1 failure is an unrelated pre-existing test).

Copilot AI and others added 2 commits October 8, 2026 19:58
…permission-issue

Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>

Copilot AI commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

Merged latest main with make merge-main in 59836480, without conflicts. All three listed fixes are already in ab971d3; existing replies were not duplicated. Final review caught a related lowercase-secret regression, fixed with case-insensitive extraction and regression tests in 14e78d40. Targeted tests and all 333 workflow compilations/drift checks pass. Custom lint reports pre-existing diagnostics; CodeQL timed out. Two answered threads still need marking resolved: this environment has no authenticated thread-resolution tool. CI was not triggered.

@copilot /pr-finisher

Verified at ab971d3c in our private sandbox (Copilot and pi engines, runtimes: uv, task runs uv sync and pytest, AWF v0.28.44):...

Finisher pass pushed 59836480 (clean merge of latest main) and 14e78d40 (lowercase/mixed-case secret exclusion regression fix). Targeted uv/topology/secret tests, build, Go lint, and all 333 workflow drift checks pass. Remaining blockers: pre-existing custom-lint diagnostics, two already-answered threads requiring manual resolution, human review, and CI verification on the new head. CodeQL timed out; no CI was triggered.

@SivaKesava1

Copy link
Copy Markdown
Collaborator

Ready for review. Sandbox-verified at ab971d3c (Copilot and pi, runtimes: uv: no setup-uv cache restore or save, UV_* excluded, 0 uv errors in the sandbox, full pytest ran). The later commits (merge of main, lowercase-secret exclusion fix) compile to the same setup-uv and AWF exclusions. All review threads are resolved; Copilot answered each. CI on 14e78d40 needs a re-trigger.

@SivaKesava1

Copy link
Copy Markdown
Collaborator

Per @pelikhan's request to split this into smaller PRs, it's superseded by:

The UV_CACHE_DIR/UV_PYTHON_INSTALL_DIR exclusion isn't carried over: gh-aw-firewall#9705 covers it once an AWF release containing it becomes gh-aw's default. This PR can be closed.

@pelikhan pelikhan closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtimes: uv: setup-uv's UV_CACHE_DIR is unwritable inside the AWF sandbox, and agent jobs save a repo-wide setup-uv cache

5 participants