fix: configurable compose startup timeout via SHIELDCLAW_COMPOSE_START_TIMEOUT - #52
Merged
Merged
Conversation
…T_TIMEOUT env var - Raise default _START_WAIT_SECONDS from 60s to 120s - Add _compose_start_timeout() to read SHIELDCLAW_COMPOSE_START_TIMEOUT env var - Update DockerOrchestrator.__init__ to accept None sentinel and use env var - Remove hardcoded start_wait_seconds=120 from integration tests - Add @pytest.mark.integration to test_full_stack_detonate_and_teardown - Add 4 unit tests for env var timeout configuration behavior - Set SHIELDCLAW_COMPOSE_START_TIMEOUT=240 in CI workflow for integration tests Agent-Logs-Url: https://github.com/blondres04/shieldclaw/sessions/c11be971-5bf9-4bce-b6b6-fcc15c5a4621 Co-authored-by: blondres04 <91551702+blondres04@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CI job by addressing Docker compose startup timeouts
fix: configurable compose startup timeout via SHIELDCLAW_COMPOSE_START_TIMEOUT
May 4, 2026
blondres04
marked this pull request as ready for review
May 4, 2026 02:09
There was a problem hiding this comment.
Pull request overview
This PR makes Docker compose startup readiness waiting configurable via an environment variable to reduce flaky CI integration failures on slow runners.
Changes:
- Add
SHIELDCLAW_COMPOSE_START_TIMEOUTsupport (with module default raised to 120s) and wire it intoDockerOrchestrator.__init__whenstart_wait_secondsis unset. - Update integration tests to rely on the env-var timeout (and mark the full-stack test as
@pytest.mark.integration). - Set
SHIELDCLAW_COMPOSE_START_TIMEOUT=240for the integration job in CI.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
shield-claw/src/shieldclaw/sandbox/docker_orchestrator.py |
Adds env-var-driven startup wait timeout and updates constructor default behavior. |
shield-claw/tests/test_docker_orchestrator.py |
Adds unit tests for env var default/override/precedence/invalid parsing. |
shield-claw/tests/test_docker_orchestrator_integration.py |
Marks the test as integration-only; removes hardcoded timeout to allow CI env var to apply. |
shield-claw/tests/test_docker_orchestrator_concurrency.py |
Removes hardcoded timeout to allow CI env var to apply. |
.github/workflows/ci.yml |
Sets SHIELDCLAW_COMPOSE_START_TIMEOUT for integration pytest step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+59
| def _compose_start_timeout() -> float: | ||
| """Return the compose startup wait timeout from ``SHIELDCLAW_COMPOSE_START_TIMEOUT``. | ||
|
|
||
| Falls back to ``_START_WAIT_SECONDS`` when the variable is unset or invalid. | ||
| """ | ||
| raw = os.environ.get("SHIELDCLAW_COMPOSE_START_TIMEOUT", "") | ||
| if raw: | ||
| try: | ||
| return float(raw) | ||
| except ValueError: | ||
| _LOG.warning( | ||
| "SHIELDCLAW_COMPOSE_START_TIMEOUT=%r is not a valid float; using default %s s", | ||
| raw, | ||
| _START_WAIT_SECONDS, | ||
| ) | ||
| return _START_WAIT_SECONDS |
Comment on lines
+98
to
+115
| start_wait_seconds: float | None = None, | ||
| start_poll_interval: float = _START_POLL_INTERVAL, | ||
| post_up_grace_seconds: float = 2.0, | ||
| ) -> None: | ||
| """Create an orchestrator with configurable startup polling. | ||
|
|
||
| Args: | ||
| start_wait_seconds: Maximum time to wait for compose services after ``up``. | ||
| When ``None`` (the default), the value is read from the | ||
| ``SHIELDCLAW_COMPOSE_START_TIMEOUT`` environment variable, falling back | ||
| to ``120`` seconds when the variable is unset. | ||
| start_poll_interval: Sleep interval between readiness probes. | ||
| post_up_grace_seconds: Extra sleep after healthcheck gating completes. | ||
| Reduced from 10 s to 2 s now that readiness is healthcheck-gated. | ||
| """ | ||
| self._start_wait = start_wait_seconds | ||
| self._start_wait = ( | ||
| _compose_start_timeout() if start_wait_seconds is None else start_wait_seconds | ||
| ) |
Comment on lines
71
to
78
| orch_a = DockerOrchestrator( | ||
| start_wait_seconds=120.0, | ||
| start_poll_interval=1.0, | ||
| post_up_grace_seconds=0.0, | ||
| ) | ||
| orch_b = DockerOrchestrator( | ||
| start_wait_seconds=120.0, | ||
| start_poll_interval=1.0, | ||
| post_up_grace_seconds=0.0, | ||
| ) |
Comment on lines
+60
to
+64
| def test_orchestrator_start_wait_invalid_env_var_uses_default( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| """An invalid ``SHIELDCLAW_COMPOSE_START_TIMEOUT`` value falls back to the module default.""" | ||
| monkeypatch.setenv("SHIELDCLAW_COMPOSE_START_TIMEOUT", "not-a-number") |
blondres04
pushed a commit
that referenced
this pull request
May 4, 2026
…able timeout) Unify resolve_compose_start_wait_seconds to read SHIELDCLAW_COMPOSE_START_TIMEOUT (same env var as main's _compose_start_timeout) so both code paths honour the same CI override. Update unit test to use the unified env var name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI integration tests were failing because compose services consistently exceeded the hardcoded 120s startup window on GitHub-hosted runners (cold pulls, slow init). Cleanup isolation was also a concern for concurrent runs.
Core change — env-var-driven timeout
DockerOrchestrator.__init__now acceptsstart_wait_seconds: float | None = None. WhenNone, the value is resolved at construction time fromSHIELDCLAW_COMPOSE_START_TIMEOUT, falling back to 120s:Test fixes
test_docker_orchestrator_integration.py/test_docker_orchestrator_concurrency.py: removed hardcodedstart_wait_seconds=120.0so CI env var takes effect.test_docker_orchestrator_integration.py: added missing@pytest.mark.integrationmarker — the test was leaking into unit runs and failing due to no attacker image.test_docker_orchestrator.py: four new unit tests covering default, env-var override, explicit-arg precedence, and invalid-value fallback.CI
Original prompt
This pull request was created from Copilot chat.