Skip to content

[Code Quality] Add diagnostic output to copilot engine 0-turn failures to reduce wasted token spend #46480

Description

@github-actions

Description\n\nThe workflow audit report (2026-07-17, discussion #46310) shows that the copilot engine has a persistent failure family: 8 runs in the window consumed real tokens (~387K total) then failed at 0 recorded turns. This is a cost leak — tokens are being spent on runs that produce no output.\n\nThe affected workflows include: CLI Consistency Checker (82.7K tokens), daily-experiment-report (68.6K), Daily Project Performance Summary (56.5K), The Daily Repository Chronicle (30.1K), Discussion Task Miner (23.3K), Smoke Copilot Sub Agents (19.3K), Copilot PR Conversation NLP Analysis (104K).\n\nThis matches the known issue . Adding diagnostic output to the copilot driver's entry point would help identify whether the failure is an API timeout, a context-limit issue, a driver crash, or something else.\n\n## Suggested Changes\n\n1. Add a fast-fail diagnostic step to the copilot agent job template in the compiler that dumps the exit code, last few lines of stdout/stderr, and any available metrics before marking the step failed\n2. Log the failure reason to the run's field so audit workflows can classify failures automatically\n3. Consider a startup timeout separate from the execution timeout to distinguish "never started" from "started but failed mid-run"\n\n## Files Affected\n\n- Copilot engine driver/job template in the compiler (likely pkg/workflow/ or pkg/compiler/)\n- Audit workflow to consume the new failure-reason field\n\n## Success Criteria\n\n- Failed 0-turn copilot runs emit a structured failure reason in logs\n- The workflow audit report can distinguish failure subtypes (startup failure vs mid-run failure)\n- Cost-leaking runs are identifiable without manual log inspection\n\n## Source\n\nExtracted from Workflow Audit #46310 (2026-07-17) — P1 action item #2.\n\n## Priority\n\nHigh — recurring cost leak (~387K tokens burned per audit window on failed copilot runs); root-cause tooling enables targeted fixes.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 75.7 AIC · ⌖ 7.67 AIC · ⊞ 7K ·

  • expires on Jul 19, 2026, 11:16 AM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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