Skip to content

feat(purelock): process 3 functions/run via parallel test-writer sub-agents - #51164

Merged
pelikhan merged 1 commit into
mainfrom
copilot/optimize-purelock-tests
Aug 7, 2026
Merged

feat(purelock): process 3 functions/run via parallel test-writer sub-agents#51164
pelikhan merged 1 commit into
mainfrom
copilot/optimize-purelock-tests

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

PureLock previously processed one function per run sequentially. This restructures it as an orchestrator + parallel sub-agent pipeline to process up to 3 functions per run.

Architecture changes

  • Orchestrator selects up to 3 unprocessed candidates from candidates.json, writes each to /tmp/gh-aw/agent/purelock-<name>/input.json, then fans out to all test-writer sub-agents simultaneously
  • test-writer sub-agent (model: large) owns the full single-function pipeline: Serena purity confirmation → baseline coverage → table-driven testify suite → fuzz escalation → gofmt/go vet/-race validation → structured result.json
  • Orchestrator aggregates results, drops failures into cache as noop, and creates one combined draft PR for all succeeded functions

Frontmatter

  • max-patch-files: 4 → 8 (3 functions × up to 2 files each)

Expected gains vs baseline run (31190616566: 57 AIC, 15.6 min, 1 function)

  • 3× throughput per run
  • Sub-agent context is scoped to a single function — less ambient token overhead per function than the monolithic approach

…t, process up to 3 functions per run

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title feat(purelock): parallelize test generation with test-writer sub-agent, process up to 3 functions per run feat(purelock): process 3 functions/run via parallel test-writer sub-agents Aug 7, 2026
Copilot AI requested a review from pelikhan August 7, 2026 19:07
@pelikhan
pelikhan marked this pull request as ready for review August 7, 2026 19:08
Copilot AI balanced review requested due to automatic review settings August 7, 2026 19:08
@pelikhan
pelikhan merged commit 307107b into main Aug 7, 2026
@pelikhan
pelikhan deleted the copilot/optimize-purelock-tests branch August 7, 2026 19:08

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.

Pull request overview

Restructures PureLock into a parallel orchestrator/sub-agent pipeline for processing up to three Go functions per run.

Changes:

  • Adds parallel test-writer sub-agents and result aggregation.
  • Expands the safe-output file limit.
  • Regenerates the compiled workflow.
Show a summary per file
File Description
.github/workflows/purelock.md Defines candidate fan-out, test generation, validation, and aggregation.
.github/workflows/purelock.lock.yml Updates generated metadata and safe-output configuration.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Suppressed comments (5)

.github/workflows/purelock.md:217

  • The PR body requires the sub-agent's Serena verification, but the declared result schema has no field carrying it. Because aggregation reads result.json, a successful run cannot reliably provide the requested evidence. Add an explicit field; the final instruction to populate all fields will then require the writer to return it.
  "residual_uncovered": "",
  "reason": ""

.github/workflows/purelock.md:223

  • A sub-agent can terminate or fail before creating valid JSON, but this step assumes every result file exists and is readable. One failed invocation can therefore abort aggregation and discard successful agents instead of following the intended partial-success path. Treat missing, malformed, and key-mismatched results as noop failures with a reason.
After all agents finish, read every `result.json`. Separate results into `succeeded` (outcome=pr) and `failed` (outcome=noop).

.github/workflows/purelock.md:266

  • The Serena CLI requires named tool parameters; the repository's Copilot smoke workflows use serena activate_project --path .... Passing the workspace positionally can make activation fail before purity analysis begins.
serena activate_project /home/runner/work/gh-aw/gh-aw

.github/workflows/purelock.md:273

  • This early-stop branch writes a relative result.json, but setup only assigns WORK_DIR and never changes the current directory. The orchestrator looks under $WORK_DIR, so an impure candidate can leave no collectable result. Write to the same absolute work-dir path used by the final reporting step.
If the function turns out to be impure, write `result.json` with `"outcome":"noop"` and a descriptive `reason`, then stop.

.github/workflows/purelock.md:188

  • name is not a unique candidate identifier: functions in different packages and methods on different receiver types may have the same name. Those candidates would overwrite the same input.json and result.json, causing duplicate work and lost results. Include a selection index (or an encoded full key) in every per-agent directory path.
For each selected candidate, write its JSON entry to `/tmp/gh-aw/agent/purelock-<name>/input.json` (creating the directory first).
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

1. Read `/tmp/gh-aw/cache-memory/purelock/state.json` when it exists. Shape:
`{"processed":[{"key":"pkg/x/y.go:120:FuncName","date":"YYYY-MM-DD","outcome":"pr|noop"}]}`.
2. Walk `candidates.json` in order (already sorted by score) and pick the first candidate whose `key` (`file:line:name`) is absent from `processed`, or was processed more than 60 days ago.
2. Walk `candidates.json` in order (already sorted by score) and pick the first **up to 3** candidates whose `key` (`file:line:name`) is absent from `processed`, or was processed more than 60 days ago.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants