Skip to content

feat(workflows): make shell step timeout configurable (#3327)#3328

Open
Noor-ul-ain001 wants to merge 1 commit into
github:mainfrom
Noor-ul-ain001:feat/3327-shell-timeout
Open

feat(workflows): make shell step timeout configurable (#3327)#3328
Noor-ul-ain001 wants to merge 1 commit into
github:mainfrom
Noor-ul-ain001:feat/3327-shell-timeout

Conversation

@Noor-ul-ain001

Copy link
Copy Markdown
Contributor

Summary

Closes #3327. The workflow shell step hardcoded a 300-second subprocess timeout with no way to override it, so any command that legitimately runs longer than five minutes — a full build, a MegaLinter/golangci-lint aggregator, an integration-test target — was killed with TimeoutExpired and failed the entire run. There was no YAML knob to raise the limit, which made shell steps unusable as a probe/gate over real project QA commands.

Changes

  • Add an optional timeout field (seconds) to the shell step, read via config.get("timeout", 300) and threaded into subprocess.run. Defaults to 300 so existing workflows are unaffected.
  • The timeout failure message now reports the configured value instead of a hardcoded 300.
  • validate rejects a timeout that is not a positive number. bool is rejected explicitly — it is an int subclass, but timeout: true is a config error, not a duration.
- id: qa
  type: shell
  timeout: 1800        # seconds; optional, default 300
  run: make code-qa

Acceptance criteria (from the issue)

  • A timeout: value overrides the 300s default and is honored by subprocess.run.
  • Omitting timeout: preserves current behavior (300s).
  • validate rejects a non-positive or non-numeric timeout.
  • A test asserts the configured value is threaded through.

Testing

Seven new tests under TestShellStep:

  • configured timeout is passed to subprocess.run
  • default 300 preserved when omitted
  • timeout error message reflects the configured value
  • validate rejects non-positive (0, -30) and non-numeric ("30", True) values
  • validate accepts positive int/float

pytest tests/test_workflows.py::TestShellStep → 13 passed. Confirmed the behavior-changing tests fail without the source change (test-the-test via git stash).

🤖 Generated with Claude Code

The `shell` step hardcoded a 300s subprocess timeout, so any command
that legitimately runs longer than five minutes (a full build, a linter
aggregator, an integration-test target) was killed with TimeoutExpired
and failed the whole run, with no YAML knob to raise the limit.

Add an optional `timeout` field (seconds) that defaults to 300 for
backward compatibility and is threaded through to `subprocess.run`. The
timeout failure message now reports the configured value instead of a
hardcoded 300. `validate` rejects a `timeout` that is not a positive
number (bool is rejected explicitly, since it is an int subclass but a
config error rather than a duration).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Noor-ul-ain001 Noor-ul-ain001 requested a review from mnriem as a code owner July 4, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Make the shell step's execution timeout configurable (currently hardcoded to 300s)

1 participant