Skip to content

[ci-coach] ci: add timeout and fail-fast settings to CI workflow #177

@github-actions

Description

@github-actions

Summary

Two targeted, low-risk CI optimizations that improve cost protection and debugging visibility for the cross-platform test matrix.

Optimizations

1. Job Timeout (timeout-minutes: 15)

Type: Resource Sizing
Impact: Prevents runaway macOS/Windows runners from consuming excess minutes
Risk: Low

Changes:

  • Added timeout-minutes: 15 to the build job

Rationale: VS Code extension tests including compile, lint, and test should complete well under 15 minutes. Without an explicit timeout, the GitHub default is 6 hours — a stuck job on macOS (which costs ~10× more than Ubuntu) could burn significant runner minutes before expiring. A 15-minute cap acts as a cost safety net.

Detailed Analysis

The CI matrix runs on 3 OSes. macOS runner pricing ($0.16/min) is approximately 10× Ubuntu ($0.016/min). A stuck job at the default 6-hour timeout on macOS = ~$57.60 per occurrence. With a 15-minute cap, worst-case exposure is ~$2.40 per occurrence.

Typical VS Code extension CI runs are observed to complete in 3–8 minutes across all platforms.

2. Matrix fail-fast: false

Type: Visibility / Debugging
Impact: All OS jobs complete in a single run — full failure picture without re-running
Risk: Low

Changes:

  • Added fail-fast: false to the matrix strategy

Rationale: The default fail-fast: true cancels all sibling matrix jobs as soon as one fails. For a cross-platform extension this obscures whether a failure is OS-specific or universal, forcing additional re-runs to gather complete data. Setting fail-fast: false ensures all three OS results are always available in a single workflow run, which is especially valuable when triaging tree-sitter native binding failures that can be OS-specific.

Detailed Analysis

With fail-fast: true (current): if the macOS job fails early, Ubuntu and Windows jobs are cancelled. The developer must push another commit or manually re-run to see if the failure is macOS-specific.

With fail-fast: false (proposed): all three jobs complete, giving an immediate complete picture of cross-platform health.

Cost impact of fail-fast: false: negligible — jobs that were previously cancelled still run, but typically only for the remaining minutes of their normal execution time (not the full 15-minute timeout).

Expected Impact

  • Cost protection: Eliminates runaway job cost exposure (6h → 15min timeout cap)
  • Debug efficiency: Eliminates need for extra CI re-runs to see full OS failure matrix
  • Risk Level: Low — both changes are additive safety measures with no functional impact on passing workflows

Testing Recommendations

  • Review workflow YAML syntax
  • Monitor first few runs after merge to confirm jobs complete within timeout
  • Compare runtime data before/after to validate 15-minute bound is sufficient

Generated by CI Optimization Coach

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/ci-coach.md@442992eda2ccb11ee75a39c019ec6d38ae5a84a2
  • expires on Mar 4, 2026, 1:13 PM UTC

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 22577429898 -n agent-artifacts -D /tmp/agent-artifacts-22577429898

# Create a new branch
git checkout -b ci-coach/optimize-ci-workflow-70b3353349b93821

# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22577429898/aw-ci-coach-optimize-ci-workflow.patch

# Push the branch to origin
git push origin ci-coach/optimize-ci-workflow-70b3353349b93821

# Create the pull request
gh pr create --title '[ci-coach] ci: add timeout and fail-fast settings to CI workflow' --base main --head ci-coach/optimize-ci-workflow-70b3353349b93821 --repo askpt/code-metrics
Show patch (35 lines)
From bfce04464be7d3038b9ca3d0131e896533d34475 Mon Sep 17 00:00:00 2001
From: GitHub Copilot <copilot@github.com>
Date: Mon, 2 Mar 2026 13:12:14 +0000
Subject: [PATCH] ci: add timeout and fail-fast settings to CI workflow

- Add timeout-minutes: 15 to prevent runaway jobs consuming excess runner
  minutes (especially costly on macOS runners at ~10x Ubuntu price)
- Add fail-fast: false so all OS matrix jobs complete, giving full
  visibility into cross-platform failures in a single run

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2663fed..5c48745 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,9 +31,11 @@ concurrency:
 jobs:
   build:
     strategy:
+      fail-fast: false # Allow all OS jobs to complete even if one fails
       matrix:
         os: [macos-latest, ubuntu-latest, windows-latest]
     runs-on: ${{ matrix.os }}
+    timeout-minutes: 15 # Prevent runaway jobs from consuming excess runner minutes
     steps:
       - name: Checkout
         uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
-- 
2.53.0

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions