Skip to content

[agentic-token-optimizer] Optimize Daily Go Test Parallelizer: cut context rebuild and cadence (~25 AIC/run) #71459

Closed as not planned

Description

@github-actions

Target workflow

Daily Go Test Parallelizer (.github/workflows/daily-go-test-parallelizer.md). Selected as the highest-AIC workflow not optimized in the last 14 days. Avenger is excluded because it was optimized on 2026-10-15. The next entry, Matt Pocock Skills Reviewer, was optimized 2026-10-14, which is also inside the 14-day window.

Analysis period

7-day window ending 2026-10-23. Only 2 runs are in all-runs.json, so this audit is below the 5-run minimum. The workflow-run list shows 7 of the last 8 runs succeeded and 1 failed after about 46s. Run-level data comes from the 2 audited runs.

Cost profile

Metric Value
Runs audited 2 (both success)
Total AIC 107.6
Avg AIC/run 53.8 (38.5 and 69.1)
Raw tokens 2.59M (avg 1.30M/run)
Model invocations/run 23 and 37
Rebuild factor 16.7× and 20.4×
Peak input per call 61.7k and 75.5k tokens
Cumulative input 1.03M and 1.54M tokens
Excess rebuild tokens 0.97M and 1.47M (about 94–95% of input)
Action minutes about 14 per run

Ranked recommendations

1. Reduce context rebuild by batching reads (~15–20 AIC/run)

About 95% of input tokens are re-sent context across 23–37 invocations. The AIC range tracks the invocation count (23 vs 37).

  • Action: Add an explicit step: read all selected files in one parallel block, or with a single bash call such as grep -nE 'func Test|t\.(Setenv|Chdir|Parallel)|os\.(Setenv|Chdir)|\bvar\b' <files>. Use that pre-filter to classify files, and only open the full file for candidates.
  • Action: Say "do not re-read edited files; verify through git diff" to prevent repeat reads.

2. Lower the batch size or cadence (~8–12 AIC/run, or more per day)

The schedule is every 2h (about 12 runs/day) but the title, description and prompt say "daily". At 25 files per run, a single pass over the repo needs many runs, and each run costs about 54 AIC.

  • Action: Either change the schedule to daily, or keep the cadence and add early exit. Once a full wrap-around yields no safe candidates, store {"last_file":..., "no_change_streak":N} and noop immediately when the streak is long.
  • Action: Skip the run when the cache shows all files have been analyzed and no *_test.go has changed since the last pass.

3. Run go test ./... once, scoped (~3–6 AIC/run)

The prompt requires go test -race per package and then go test ./..., which overlaps. A repo-wide test run adds tool-output tokens and wall-clock time.

  • Action: Run go test -race on modified packages only. Run go test ./... only if more than one package changed. Pipe output through tail -n 40.

4. Fix prompt ambiguity that invites extra iteration (~1–2 AIC/run)

  • The "Batched analysis agent" section references a sub-agent but defines none. Replace it with a direct instruction: "Analyze the batch yourself and keep a compact JSON note".
  • Move the exclusion list above "Analyze safety" so the rules are read before analysis.

Structural optimizations

None recommended. The prompt has no repeated setup prefix, and an inline sub-agent would not pay off for a single-batch analysis that depends on main-agent edits.

Caveats

  • Only 2 runs are in the window, so the savings estimates are approximate. They assume invocation counts fall toward the lower run (about 23 calls).
  • Recommendation 2 depends on a maintainer decision about intended cadence.
  • The failure run 39939907542 (46s) was not analyzed.

References: §39971096234, §39955435424, §39939907542

Generated by Agentic Workflow AIC Usage Optimizer · copilot · auto · ~20 AIC · ⊞ 11K · ◷

  • expires on Oct 30, 2026, 6:59 AM UTC-08:00

Activity

  1. github-actions commented on Oct 26, 2026

    @github-actions
    ContributorAuthor

    This issue is being closed as outdated. A newer issue has been created: #72130

    View newer issue


    This action was performed automatically by the Agentic Workflow AIC Usage Optimizer workflow.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions