Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/skills/agentic-workflows/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Load these files from `github/gh-aw` (they are not available locally).
- `.github/aw/test-coverage.md`
- `.github/aw/test-expression.md`
- `.github/aw/token-optimization-caching-budgets.md`
- `.github/aw/token-optimization-observability.md`
- `.github/aw/token-optimization.md`
- `.github/aw/triggers.md`
- `.github/aw/update-agentic-workflow.md`
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/daily-go-test-parallelizer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 29 additions & 10 deletions .github/workflows/daily-go-test-parallelizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ safe-outputs:
protected-files: blocked
allowed-files:
- "**/*_test.go"
max-patch-files: 1
max-patch-files: 25
max-patch-size: 2048
Comment on lines +38 to 39
noop:
evals:
Expand All @@ -47,20 +47,29 @@ evals:

# Daily Go Test Parallelizer

Analyze one Go test file per run and add `t.Parallel()` only where parallel execution is demonstrably safe.
Analyze up to twenty-five Go test files per run and add `t.Parallel()` only where parallel execution is demonstrably safe.

## Select a file

1. Use `grep` to list tracked `*_test.go` files containing top-level `Test` functions. Exclude `vendor/` and generated files, then sort paths lexicographically.
2. Read `/tmp/gh-aw/cache-memory/go-test-parallelizer/state.json` when it exists. It has this shape:
`{"last_file":"path/to/file_test.go"}`.
3. Select the path after `last_file`, wrapping to the first path. If the cache is absent, malformed, or names a removed file, select the first path.
4. Analyze and modify at most that one file.
3. Select up to 25 consecutive paths starting after `last_file`, wrapping to the first path. If the cache is absent, malformed, or names a removed file, start from the first path.
4. Analyze and modify only this selected batch (maximum 25 files).
5. Minimize token usage: avoid re-reading files you already analyzed, and do not paste full file contents into notes or outputs.

## Analyze safety

Add `t.Parallel()` at the start of eligible top-level tests. Also add it to eligible table-driven subtests when loop variables are safely captured.

## Inline analysis agents (small context)

1. For each selected path, call `parallel-safety-checker` exactly once with only that file path and the safety rules from this workflow.
2. Dispatch these inline agent calls in one parallel tool-use block when possible. If not possible, dispatch in small batches of 5.
3. Require compact JSON output from each sub-agent:
`{"file":"...","safe":true|false,"reasons":["..."],"candidate_tests":["TestName"]}`.
4. Use the JSON results to decide which files to edit. Keep aggregation notes short and avoid repeating unchanged rule text.

Do not parallelize tests that use or may conflict through:

- `t.Setenv`, `os.Setenv`, `os.Chdir`, or other process-wide state
Expand All @@ -72,15 +81,25 @@ Do not change assertions, test behavior, production code, dependencies, generate

## Validate

After editing:
After editing the selected batch:

1. Run the selected package with the race detector.
2. Run `go test ./...`.
3. Inspect the diff and confirm it contains only safe `t.Parallel()` additions in the selected file.
4. Revert the edit and use `noop` if either test command fails or the diff contains any other change.
1. Run `go test -race` once per unique modified package (deduplicate package paths across edited files).
2. Run `go test ./...` once after all candidate edits.
3. Inspect the diff and confirm it contains only safe `t.Parallel()` additions in selected files.
4. Revert the edit and use `noop` if any test command fails or the diff contains any other change.

## Persist and report

Always create `/tmp/gh-aw/cache-memory/go-test-parallelizer/` and write the selected path to `state.json`, even when no edit is safe, so the next daily run advances round-robin.
Always create `/tmp/gh-aw/cache-memory/go-test-parallelizer/` and write the last path from the selected batch to `state.json`, even when no edit is safe, so the next daily run advances round-robin.

If validation succeeds with a change, create one draft pull request describing the safety analysis and test results. Otherwise use `noop` with the selected path and a short reason.

## agent: `parallel-safety-checker`
---
description: Review one Go test file for safe t.Parallel additions with minimal context
model: gpt-5-mini
---
Given one `*_test.go` file path, read only that file and apply this workflow's safety rules.
Return compact JSON only in this exact shape:
`{"file":"...","safe":true|false,"reasons":["..."],"candidate_tests":["TestName"]}`.
Set `safe` to false when uncertain.