feat(harness): distinguish long-run vs startup Copilot CLI failures via token-count classification#46557
Conversation
|
@copilot apply changes |
…ia token-count classification Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Applied all changes described in the PR. Commits:
|
The CI failure is a TypeScript error in - const metadataLabel = /** @type {{name?: string}} */ l;
+ const metadataLabel = /** @type {{name?: string}} */ (l);Fix committed in 8b9d775. Typecheck now passes cleanly. |
|
@copilot please run the Failed checks: Run: https://github.com/github/gh-aw/actions/runs/29683215651 Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "pi.dev"See Network Configuration for more information.
|
|
@copilot make the 10000 threshold configurable through an env var |
…ARNESS_LONG_RUN_TOKEN_THRESHOLD env var Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done. |
|
@copilot please run the Failed checks: Run: https://github.com/github/gh-aw/actions/runs/29684195741 Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "pi.dev"See Network Configuration for more information.
|
…li-failures Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Fixed. The |
The Copilot harness treats two structurally different 0-turn failures identically: startup crashes (negligible cost) and long-run exits where the CLI wrapper exits non-zero after the agent completed substantial work (30+ min, 119–210 AIC lost with no recovery path).
Changes
copilot_harness.cjsLONG_RUN_TOKEN_THRESHOLD = 10000constantextractTokenCountFromOutput(output)— sums"total_tokens"fields from CLI stdout/stderr (emitted in debug JSON response blocks); returns 0 when no token data is present (startup failures)classifyCopilotFailure()now accepts optionaltokenCount; returns"long_run_exit"whenhasOutput=true && tokenCount > 10000. All named error classes (auth,quota, etc.) continue to outrank thistokenCount=N attemptDurationMs=Nfor audit visibility"long_run_exit"in addition to"partial_execution"copilot_harness.test.cjsextractTokenCountFromOutputedge cases andlong_run_exitclassification boundary/priorityClassification logic
Retry behavior is unchanged —
long_run_exitfollows the same retry path aspartial_execution. The classification distinction is surfaced in run logs and enables audit tooling to report wasted AIC by failure class.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
pi.devSee Network Configuration for more information.