Skip to content

fix: move wazero cache outside mcp-logs to prevent artifact upload EACCES failures #5697

@lpcox

Description

@lpcox

Problem

The wazero compilation cache defaults to <log-dir>/wazero-cache (i.e. /tmp/gh-aw/mcp-logs/wazero-cache/). The gh-aw compiler uploads the entire /tmp/gh-aw/mcp-logs/ directory as part of the unified agent artifact. wazero creates cache files with restrictive permissions (0600), which causes actions/upload-artifact to fail with:

Error: EACCES: permission denied, open '/tmp/gh-aw/mcp-logs/wazero-cache/wazero-v1.11.0-amd64-linux/905c94902e...'
Error: An error has occurred during zip creation for the artifact

This cascades: the agent artifact is never uploaded, so the downstream detection job can't find prompt.txt and fails with "No Safe Outputs Generated".

Example failure: github/gh-aw#32169 (Smoke Gemini detection job)

Root Cause

  • internal/cmd/wasm_cache.go:defaultWasmCacheDir() returns filepath.Join(logDir, config.DefaultWasmCacheDirName)
  • With default logDir=/tmp/gh-aw/mcp-logs, this resolves to /tmp/gh-aw/mcp-logs/wazero-cache/
  • gh-aw's compiler_yaml_main_job.go uploads /tmp/gh-aw/mcp-logs/ as an artifact glob
  • wazero's NewCompilationCacheWithDir() creates files with 0600 permissions
  • The upload action runs as the runner user and can't read these files → zip fails → artifact missing

Proposed Fix

Change defaultWasmCacheDir() to place the cache as a sibling of the log directory rather than inside it:

// Before:
func defaultWasmCacheDir(logDir string) string {
    return filepath.Join(logDir, config.DefaultWasmCacheDirName)
}

// After:
func defaultWasmCacheDir(logDir string) string {
    if logDir == "" {
        return config.DefaultWasmCacheDirName
    }
    return filepath.Join(filepath.Dir(logDir), config.DefaultWasmCacheDirName)
}

This changes the default from /tmp/gh-aw/mcp-logs/wazero-cache to /tmp/gh-aw/wazero-cache, keeping it out of the artifact upload glob while preserving the same parent directory structure.

Files to change

  • internal/cmd/wasm_cache.go — update defaultWasmCacheDir()
  • internal/cmd/flags_logging.go — update help text
  • internal/cmd/flags_logging_test.go — update TestDefaultWasmCacheDir assertion

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions