Skip to content

porch: per-check timeout_ms in protocol.json (checks die at the fixed 5-minute cap) #1814

Closed

Description

@waleedkadous

Problem

porch kills any check still running after a fixed five minutes (DEFAULT_TIMEOUT_MS in porch's checks module). Nothing in a protocol.json can change it. In a repo whose Python test suite has ~17,000 tests, the suite at eight xdist workers takes 239 s on an idle machine and is killed at the cap as soon as the machine carries any other load (measured today: killed at 280 s at 1-minute load 7 to 15; killed four times in one afternoon on four lanes). Every lane that touches that package is now blocked at porch.

Root cause

The check runner already accepts a per-call timeout, but porch never passes one; the constant is the only value.

Proposed fix

Each check in protocol.json may carry an optional timeout_ms; porch passes it to the runner; absent, the default stays five minutes so existing protocols are byte-identical. Small guards keep the default so a hung check still dies fast; long suites set what they need.

"tests_py": { "command": "...", "timeout_ms": 900000 }

Also observed (same area)

When a check times out, porch SIGTERMs only its direct child; a grandchild test worker keeps running and porch done waits forever. Repos work around it with a timeout-wrapped check command that ends before porch's cap. A process-group kill on timeout would remove the workaround.

Filed by the Shannon main architect on the owner's ruling 2026-10-16.

Activity

  1. added
    area/porch
    on Oct 17, 2026
  2. waleedkadous commented on Oct 17, 2026

    @waleedkadous
    ContributorAuthor

    Baked decisions (architect)

    Verified in packages/codev/src/commands/porch/checks.ts: runCheck and runPhaseChecks already accept timeoutMs (default DEFAULT_TIMEOUT_MS = 5 min) and no caller passes one; on timeout the runner sends SIGTERM then SIGKILL to the direct child only. Both halves of the issue are in scope.

    1. Schema. A check object in protocol.json may carry an optional timeout_ms (positive integer). The per-check override map in .codev/config.json porch.checks (see types.ts) accepts the same key and wins over protocol.json, so an adopter can lengthen a check without forking the protocol. Absent both, the default stays 5 min; existing protocols must behave byte-identically.
    2. Plumbing. runPhaseChecks resolves the effective timeout per check and passes it to runCheck. The timeout message keeps reporting the effective value.
    3. Process-group kill. Spawn checks with detached: true and on timeout signal the group (process.kill(-pid, 'SIGTERM'), then SIGKILL after the existing grace). Keep stdio behaviour unchanged. Guard the negative-pid call so a group that is already gone does not throw.
    4. Validation. A non-positive or non-integer timeout_ms fails protocol loading loudly with the check name; no silent fallback.
    5. Docs. Document timeout_ms in the porch check docs in both trees (codev/ and codev-skeleton/), and in the porch skill if it lists check fields.
    6. Tests. Default unchanged when the key is absent; protocol.json value honoured; config override wins; invalid value rejected; a check whose child spawns a grandchild that ignores SIGTERM is fully dead after timeout and runCheck returns.

    Protocol: BUGFIX.

  3. waleedkadous commented on Oct 17, 2026

    @waleedkadous
    ContributorAuthor

    On it! Working on a fix now.

  4. added 9 commits that reference this issue on Oct 17, 2026
    a66717a
    4c33d37
    82f236e
    fabc9f5
    8281d9d
    53df5fa
    f3c1e56
    67b553c
    7b781a5
  5. added a commit that references this issue on Oct 17, 2026
    ec16498
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

    area/porch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions