Skip to content

[agentic-token-optimizer] PR Sous Chef: 64% of AIC spent on failed (driver_exit) runs #74876

Not planned

Description

@github-actions

Target workflow

PR Sous Chef (.github/workflows/pr-sous-chef.md, engine pi, model copilot/claude-haiku-4.5). It is the highest-AIC workflow that was not optimized in the last 14 days. The PR Finisher variants were optimized on 2026-11-03, and PureLock on 2026-10-26 (9 days ago, so inside the 14-day window). Sous Chef has 13 runs in the window, which gives the best sample.

Analysis period

7-day window ending 2026-11-04. All 13 runs were audited. Every one was a scheduled run on main.

Cost profile

Metric Value
Runs 13 (4 success, 9 failure)
Total AIC 72.62
Avg AIC/run 5.59 (range 2.76–9.80)
Raw tokens 30,812 (avg ~2,370/run)
Turns not reported (0 in the data)
Cache efficiency not reported
Action minutes 124 (~9.5 min/run)
AIC on failed runs 46.21 (64%)
AIC on successful runs 26.41 (36%)

Ranked recommendations

1. Fix the driver_exit failures (est. ~3.5 AIC/run, ~3.5 of 5.6 average)

  • Evidence: 9 of 13 runs ended in failure_kind: driver_exit, with the conclusion job's "Handle agent failure" step failing. These runs cost 46.2 AIC, and each one still spent ~8–10 min of Actions time.
  • The failure cluster failure-e121990520ae929c (10 runs across the repo, 91% of failed runs) also hits issue-triage-agent on the codex engine. That suggests a shared driver or runtime problem, not a Sous Chef prompt problem.
  • Action: Run gh aw audit on §41850136147 and §41846843119 to find why the pi driver exits. Candidates are the model provider and the copilot-requests path.
  • Failed runs show 5–19 model invocations for very few tokens. If the driver retries a failing call, add a bounded fail-fast so a failed run does not burn ~9 min and AIC.
  • Failing runs are not cheaper than successful ones (avg ~5.1 vs ~6.6 AIC), so failure is not cutting costs.

2. Cut the working-set rebuild (est. 0.5–1 AIC/run)

  • Evidence: working_set.rebuild_factor is 4–16 (median ~8.4) across runs. Invocations range from 5 to 19, and cumulative input grows with invocation count. The most expensive runs (§41846843119 at 9.80 AIC, §41837601034 at 9.76 AIC) have the most invocations and rebuild factors above 15.
  • Action: The prompt already tells the agent to read the compact queue first. Add an explicit instruction to batch the per-PR refresh and simulate calls in one bash call per PR, for example node scripts/pr-sous-chef.mjs <N> && node scripts/pr-sous-chef.mjs <N> --simulate. The prompt says to run the refresh "immediately before" the first write and again "immediately before" dispatching. Those are usually back-to-back, so allow the single --simulate output to serve both.

3. Trim the prompt (est. ~0.2–0.4 AIC/run)

  • Eligibility and rate-limit prose, such as "Before any PR lookup...", "GitHub CLI reads retry...", and the fingerprint rules, duplicates what scripts/pr-sous-chef.mjs already enforces deterministically. Compress it to the rules the agent must actually act on, and leave the full rules as comments in the script.
  • Keep the security language and the write-only-via-safe-outputs rules unchanged.

4. Narrow bash: ["*"] (reliability and safety, no AIC claim)

  • The workflow only needs node scripts/pr-sous-chef.mjs and gh api repos/github/gh-aw/actions/runs/<id>. The github toolset (pull_requests, repos, issues) is also unused for the main path, because the prefilter already gathers the data. I'd consider a restricted bash allowlist, with github toolsets kept unless several more runs confirm they are unused. I did not audit per-tool usage for this workflow, so this is low-confidence.

Structural optimizations

None recommended. The prompt already forbids launching sub-agents ("do not launch sub-agents"), and its sections are sequential, so the setup-prefix and inline sub-agent checks do not apply.

Caveats

  • The failure root cause is not established from the aggregated data. The tool-usage fields for the sampled runs were null, so per-tool Keep/Remove verdicts are not possible.
  • The Sous Chef run log files were not downloaded, so cache efficiency and turns are unavailable.
  • The 7-day sample covers a single day of runs (2026-11-04), which may reflect a transient provider incident. Check whether the failure rate persists before changing the prompt.
  • The savings estimates are conservative. Recommendation 1 assumes the failures are fixed with no change in cost on success runs.

References:

Generated by Agentic Workflow AIC Usage Optimizer · copilot · auto · ~27 AIC · ⊞ 11.6K · ◷

  • expires on Nov 11, 2026, 6:59 AM UTC-08:00

Activity

  1. github-actions commented on Nov 5, 2026

    @github-actions
    ContributorAuthor

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

    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