Skip to content

feat(ci): the Static Analysis gate ends before its step limit #5047

Open

Description

@dan-petty

Problem or Motivation

The owner rule of 2026-11-11 says that each inner time limit ends before the limit around it, so that the inner limit exits with a diagnostic (row < step < job).

Proposed Solution & Architectural Design

  • Run the gate step under coreutils timeout in its default mode, which sends the signal to the process group: timeout <N> uv run devops ci --check --no-cache --skip test,outdated,actionlint. N plus the stop time of the rows must be less than 180 s. The stop takes at most 9 s (three steps of DEFAULT_SHELL_STOP_GRACE_SECONDS), so N = 160 fits. Choose N from the step times at the time of the change.
  • Add a structural test to tests/invariants/test_workflow_contracts.py. It reads .github/workflows/ci.yml and finds the Static Analysis gate step. It fails when the run line has no timeout <N> prefix, or when N plus the stop time is not less than the step limit.
  • fix(ci): give the test row and the index build own timeouts #4683 owns the limit of the test step of a --shard run.
  • The CI audit work owns .github/workflows/*.

Target Subsystem

SDLC, Git & PR Governance (.github/workflows/ci.yml, tests/invariants/test_workflow_contracts.py).

Existing Tool Considered

coreutils timeout, as the pre-push hooks of PR #5031 use it. No new option and no new setting. Cost (estimate): about 40,000 tokens and 1 hour to build, near 0 to keep.

Acceptance Criteria

  • The Static Analysis gate step runs under timeout <N>, and N plus the stop time is less than the step limit.
  • The structural test fails for a gate step with no timeout prefix and for timeout 900 in a step of 15 minutes. It passes on the new ci.yml.
  • Static Analysis passes with the new value.

Dependencies

PR #5031 (#4775): with it, a SIGTERM from timeout stops each row and names it. Related: #4683, #4779.

Source: #4775

Alternatives check of 2026-11-27: covers.
Tool: coreutils/coreutils (https://github.com/coreutils/coreutils), GPL-3.0, last activity 2026-11-27, maintained.
Reason: Searches and the repository facts show coreutils timeout sends SIGTERM to the whole process group, which stops the gate and its devops ci rows; the issue already uses it in the pre-push hooks, so it covers the need.

Covers:

  • Outer time limit on the gate step command
  • Default mode signals the whole process group
  • SIGTERM reaches uv and the devops ci rows
  • Already used around devops ci in pre-push hooks

Lacks:

  • No per-row limit; rows keep the 1,800 s default
  • No structural test tying N to the step limit
  • No computed N or step-limit check
  • No per-row stopped-after line of its own

Proposed design

Problem statement

The Static Analysis Quality Gate step has a 3-minute limit inside a 6-minute job. Its devops ci rows keep the 1,800 s default, so the step limit ends a hung row and prints no per-row diagnostic. That breaks the rule that each inner limit ends before the limit around it. The change runs the gate step under coreutils timeout 160 and adds a structural test that holds N plus the row stop time below the step limit.

Acceptance criteria

Requirement: The workflow stays valid with the timeout prefix

.github/workflows/ci.yml SHALL pass the static workflow validators with the timeout 160 prefix on the gate step.

Scenario: The workflow validators on the change

  • WHEN a maintainer runs uv run devops ci --check --only actionlint,zizmor
  • THEN actionlint and zizmor pass and report no problem with .github/workflows/ci.yml

Requirement: The gate step runs under an outer timeout

The Static Analysis Quality Gate step of .github/workflows/ci.yml SHALL run its command as timeout 160 uv run devops ci --check --no-cache --skip test,outdated,actionlint.

Scenario: The gate step of a pull request

  • WHEN the Static Analysis job runs on a pull request that changes .github/workflows/ci.yml
  • THEN the log of the Static Analysis Quality Gate step shows the command timeout 160 uv run devops ci --check --no-cache --skip test,outdated,actionlint and the step exits 0 inside its 3-minute limit

Requirement: The check refuses a gate step with no timeout prefix

The structural check in tests/invariants/test_workflow_contracts.py MUST report a problem when the run line of the Static Analysis gate step has no timeout <N> prefix.

Scenario: A gate step with no timeout prefix

  • WHEN the test test_static_analysis_gate_timeout passes the check a workflow text whose gate step run line has no timeout <N> prefix, and a maintainer runs uv run pytest tests/invariants/test_workflow_contracts.py -k static_analysis_gate_timeout
  • THEN the check returns a problem that names the gate step and the missing timeout prefix, and the test passes

Requirement: The check refuses a timeout that leaves no room

The structural check MUST report a problem when N plus three times DEFAULT_SHELL_STOP_GRACE_SECONDS is not less than the step limit in seconds.

Scenario: A timeout equal to the step limit

  • WHEN the test passes the check a gate step of timeout 900 in a step of timeout-minutes: 15, and a maintainer runs uv run pytest tests/invariants/test_workflow_contracts.py -k static_analysis_gate_timeout
  • THEN the check returns a problem that names the step limit of 900 s, and the test passes

Requirement: The check accepts a timeout with room

The structural check MUST report no problem when N plus three times DEFAULT_SHELL_STOP_GRACE_SECONDS is less than the step limit in seconds.

Scenario: A timeout with room under the step limit

  • WHEN the test passes the check a gate step of timeout 160 in a step of timeout-minutes: 3, and a maintainer runs uv run pytest tests/invariants/test_workflow_contracts.py -k static_analysis_gate_timeout
  • THEN the check returns no problem, and the test passes

Requirement: The real workflow passes the check

The structural test MUST run the check on .github/workflows/ci.yml and report no problem for the Static Analysis gate step.

Scenario: The gate step of the repository

  • WHEN a maintainer runs uv run pytest tests/invariants/test_workflow_contracts.py -k static_analysis_gate_timeout
  • THEN the test passes and reports no problem for the gate step

Existing Tool Considered

coreutils timeout, verdict covers; the alternatives check in the issue body states what it covers and lacks. It lacks a per-row limit, the structural test that ties N to the step limit, a per-row (stopped after <time>) line of its own, and a computed N. The change adds the timeout 160 prefix on the gate step and the structural test in tests/invariants/test_workflow_contracts.py; devops ci prints the per-row line. The issue body estimates about 40,000 tokens and 1 hour to build, and near 0 to keep.

Key questions

  • The alternatives check found that coreutils/coreutils covers this item. Adopt the tool, or keep the item and give the reason?: Adopt coreutils timeout in its default mode around the gate step, as the person decided on the issue. AGENTS.md rule 3 requires an open tool before code that the project builds, the project already runs devops ci under timeout in its pre-push hooks, and no ADR or AGENTS.md rule rejects the tool. (best practice) [sources: AGENTS.md, .pre-commit-config.yaml, .github/workflows/ci.yml]
    • Chosen: Adopt coreutils timeout. The person adopted it, AGENTS.md rule 3 requires it, and the pre-push hooks already use it around devops ci.
    • Rejected: Keep the item and give the reason. No ADR or AGENTS.md rule rejects the tool, and the step limit as the outer limit leaves the broken nested limit.
  • What limits hold the Static Analysis Quality Gate step and its job?: The gate step has timeout-minutes: 3, which is 180 s. Its job has timeout-minutes: 6, which is 360 s. N plus the row stop time must stay below 180 s, and the step limit stays below 360 s. [sources: .github/workflows/ci.yml, tests/invariants/test_workflow_contracts.py:46]
  • What limit do the devops ci rows of the gate step keep?: Each row keeps DEFAULT_SUBPROCESS_TIMEOUT_SECONDS, which is 1,800 s, because a check sets no bound of its own. That row limit is far above the 180 s step limit, so the step limit is the outer limit today. [sources: src/devops_cli/config/defaults.py:408, src/devops_cli/commands/ci.py]
  • Which N does the timeout wrapper use?: N = 160. Three grace steps of DEFAULT_SHELL_STOP_GRACE_SECONDS take at most 9 s, so 160 s plus 9 s is 169 s, below the 180 s step limit. It also leaves 56 s above the slowest of the last 8 runs on main, which took 104 s. (best practice) [sources: .github/workflows/ci.yml, src/devops_cli/config/defaults.py:1413, src/devops_cli/core/process.py]
    • Chosen: N = 160. 160 s plus the 9 s stop is 169 s, below the 180 s step limit, with 56 s of room above the slowest measured run.
    • Rejected: N = 170. 170 s plus the 9 s stop is 179 s, only 1 s below the step limit, so a slow stop passes the limit.
    • Rejected: N = 150. 150 s fits, but it gives less room for a slower runner and no benefit.
  • How does the structural check get the row stop margin?: The check imports DEFAULT_SHELL_STOP_GRACE_SECONDS and uses three times its value, so a change of the constant moves the check with it. (best practice) [sources: src/devops_cli/config/defaults.py:1413, src/devops_cli/core/process.py]
    • Chosen: Import DEFAULT_SHELL_STOP_GRACE_SECONDS. The check follows a change of the constant and never states a stale 9 s.
    • Rejected: Hard-code 9 s in the check. It drifts from the constant and passes a stop that got longer.
  • In which mode does the gate step run coreutils timeout?: The default mode, with no option. The default mode puts the command in its own process group and signals the whole group, so the SIGTERM reaches the gate run and its rows. (best practice) [sources: .pre-commit-config.yaml, .github/workflows/ci.yml]
    • Chosen: Default mode, timeout <N>. It signals the whole process group, the same form the pre-push hooks use, and it needs no extra option.
    • Rejected: timeout --foreground <N>. It signals only uv and depends on uv forwarding the signal.
    • Rejected: timeout --kill-after=<M> <N>. devops ci already escalates to SIGKILL within its own stop, and the extra M must fit in the same 180 s margin.
  • Where does the new structural test live?: It joins tests/invariants/test_workflow_contracts.py, beside the step-limit test and the SUITE_STEP_LIMIT_MINUTES map. That file already holds the workflow loading helpers and the TIMEOUT_LIMIT pattern at line 441, so the new test reuses them. (best practice) [sources: tests/invariants/test_workflow_contracts.py:46, tests/invariants/test_workflow_contracts.py:441]
    • Chosen: Add to tests/invariants/test_workflow_contracts.py. It reuses the workflow loading helpers and sits beside the step-limit test.
    • Rejected: Add a new test file. It duplicates the workflow loading helpers and the step-limit map.
  • Does the item depend on an open change that stops each row on SIGTERM?: No. main holds the behavior of PR feat(ci): devops ci stops its rows when timeout ends it #5031: devops ci stops each running row on SIGTERM, prints (stopped after <time>) for the row, and exits 130. The item therefore has no open dependency. [sources: src/devops_cli/commands/ci.py, src/devops_cli/core/process.py, CHANGELOG.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/ci
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: covers

    Reason: The searches and the facts of coreutils/coreutils show that GNU coreutils timeout already provides exactly the wall-clock guard the issue asks for: it runs a command with a limit and, in its default mode, sends the signal to the command's process group, so a hung devops ci row and its children end before the step limit. The issue itself names it as the existing tool, already used by the pre-push hooks, and no ADR rejects it.

    Tool: coreutils/coreutils (https://github.com/coreutils/coreutils)

    • License: GPL-3.0
    • Last activity: 2026-11-15
    • Maintained: yes

    Covers:

    • Runs a command under a hard time limit and stops it when the limit expires
    • In its default mode it puts the command in its own process group and signals the group, so the whole devops ci run and its child rows get the SIGTERM
    • Needs no new option or setting and no new dependency: it is part of coreutils on the GitHub Actions runner
    • Already used by the project's pre-push hooks, so the same mechanism is consistent with PR feat(ci): devops ci stops its rows when timeout ends it #5031

    Lacks:

    Tools considered:

    Searches run:

    • coreutils timeout command manual --foreground process group, results: 5
    • GNU coreutils timeout send signal to process group default behavior, results: 5
    • timeout coreutils gnu.org manual "start COMMAND" kill after DURATION, results: 5
    • timeout command documentation, results: 5
    • "timeout" coreutils run a command with a time limit, results: 5
    • GNU coreutils timeout, results: 5

    Sources:

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

  6. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Owner question: The alternatives check found that https://github.com/coreutils/coreutils covers this item. Adopt the tool, or keep the item and give the reason. (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. dan-petty commented on Nov 24, 2026

    @dan-petty
    OwnerAuthor

    Adopt the tool: coreutils timeout. AGENTS.md rule 3 requires using an open tool before building.

  9. added
    status/ready
    and removed
    status/new
    on Nov 24, 2026
  10. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

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

    effort/lowpriority/p2-mediumscope/cisource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions