watchpr: add --max-wait with distinct timeout exit code #25

Merged
benvin merged 2 commits from benvin/watchpr-max-wait into main 2026-10-05 22:14:50 +11:00
Member

watchpr runs as a background command that the harness kills at a 2h cap; a killed watcher looks like a crash and is not restarted, so PR watching silently stops.

  • add --max-wait <duration> (same forms as --interval, 0 = unlimited)
  • on expiry print timeout: no change within <d> plus current PR states ({"timeout":true,...} under --json) and exit 3
  • end the watch at the deadline instead of after the next interval
  • document the --max-wait 110m restart-on-3 orchestrator pattern
watchpr runs as a background command that the harness kills at a 2h cap; a killed watcher looks like a crash and is not restarted, so PR watching silently stops. - add `--max-wait <duration>` (same forms as `--interval`, 0 = unlimited) - on expiry print `timeout: no change within <d>` plus current PR states (`{"timeout":true,...}` under `--json`) and exit 3 - end the watch at the deadline instead of after the next interval - document the `--max-wait 110m` restart-on-3 orchestrator pattern
unkin-agent added 1 commit 2026-10-05 22:03:14 +11:00
watchpr: add --max-wait, exit 3 on timeout
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
639bcbda49
Author
Member
  • cmd/watchpr/main.go:98 — --once --max-wait X is accepted and silently ignored → reject it (--max-wait is incompatible with --once) or state in the flag help that --once ignores it.
  • nit: cmd/watchpr/main_test.go — nothing asserts the exit-3-vs-1 mapping (errTimedOut -> 3, parse/poll errors -> 1; only the parse-error side is covered) → test that runWatch returns errTimedOut on a closed tick channel, or factor the exit-code mapping out of main() and test it.
- cmd/watchpr/main.go:98 — `--once --max-wait X` is accepted and silently ignored → reject it (`--max-wait is incompatible with --once`) or state in the flag help that --once ignores it. - nit: cmd/watchpr/main_test.go — nothing asserts the exit-3-vs-1 mapping (`errTimedOut` -> 3, parse/poll errors -> 1; only the parse-error side is covered) → test that runWatch returns errTimedOut on a closed tick channel, or factor the exit-code mapping out of main() and test it.
unkin-agent added 1 commit 2026-10-05 22:05:11 +11:00
watchpr: reject --max-wait with --once, test exit-code mapping
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
00ba3df49c
Author
Member

No findings.

No findings.
benvin merged commit 5b6e15b50f into main 2026-10-05 22:14:50 +11:00
benvin deleted branch benvin/watchpr-max-wait 2026-10-05 22:14:50 +11:00
Sign in to join this conversation.