Skip to content

pm-stack: bound the invariant sweeper's subprocess calls - #11425

Merged
dezren39 merged 1 commit into
mainfrom
fix/sweeper-timeouts
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/sweeper-timeouts

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Fixes #11416

Before:
The epic-invariant sweeper ran gh api (GraphQL and REST) and docker exec … psql with no timeout. Its daily timer starts a Type=oneshot unit, which has no start timeout by default, so one stuck GitHub CLI or Postgres call could hang the sweep indefinitely.

After:
Every subprocess call is capped at 120 seconds (override with PM_SWEEPER_SUBPROCESS_TIMEOUT). A timeout raises the same RuntimeError the helpers already raise on failure, naming the call, so the existing report paths record it. The unit file also gets TimeoutStartSec=45min as an outer bound for the whole run.

How:
A small run_bounded helper wraps subprocess.run; the three call sites use it.

Testing:
New pm-stack/tests/test_invariant_sweeper_timeouts.py (5 tests, a faked subprocess.run that times out) passes. test_kaneo_sync_guard.py still passes, and invariant-sweeper.py --help runs.

The installed unit on the laptop picks up TimeoutStartSec only after the unit file is re-copied and systemctl --user daemon-reload runs.


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

gh_graphql, gh_run and kaneo_links ran gh and docker-exec psql with no
timeout, and the daily oneshot unit has no start timeout, so one wedged
call could hang the sweep forever. Each call now has a 120s timeout
(PM_SWEEPER_SUBPROCESS_TIMEOUT overrides) that surfaces as the same
RuntimeError the callers already report, and the unit gets
TimeoutStartSec=45min as an outer bound.

Fixes #11416

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 17, 2026 22:17
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 22:17
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 781be79 into main Nov 17, 2026
@dezren39
dezren39 deleted the fix/sweeper-timeouts branch November 17, 2026 22:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T22:31:23.350099Z 8e73ab3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

fix(pm-stack): bound invariant-sweeper subprocess calls

2 participants