Files
werkrevisor/docs/prs/2026-10-22-PR#131-slow-handshake.md
claude-code e44836d6a0
werkator build succeeded after 00:17
werkator/werkrevisor-statistics build succeeded after 00:36
werkator/release build succeeded after 00:16
werkrevisor 0.60.1: reviews wait longer for a slow Gitea, and hs-review names the cause of a failure (#131)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-23 06:28:25 +02:00

60 lines
2.6 KiB
Markdown

# PR#131: Reviews Wait Longer for a Slow Gitea, and hs-review Names the Cause of a Failure
Version: patch
> **WARNING:** This document describes only the change applied in this PR.
> It may already be outdated once the next PR is merged.
> Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
## Problem
On 2026-10-20 and 2026-10-22 the TLS handshake of dev.hostsharing.net took 15 to 22 s, once more than 40 s;
TCP connects took 0.04 s, and git.javagil.de shook hands in 0.1 s.
werkrevisor opens a connection per request and gives up after 30 s, `tools/review-report` after 60 s,
so one slow handshake ended `hs-review 342` and `hs-review 343` without a result.
`hs-review` then printed the first line of the error, "werkrevisor: operator config from …",
an info line, instead of the cause "cannot read the PR: … The handshake operation timed out".
## Non-Goals
- No retries and no reuse of connections.
## Specification
### Feature: a slow Gitea ends fewer reviews, and a failure names its cause
#### Scenario#131.01: the summary of hs-review names the cause of a failure
&hellip; so that the human sees why the review did not complete without opening the draft.
- **Given** a review by `hs-review` that fails, e.g. because Gitea does not answer in time
- **When** `hs-review` shows its summary
- **Then** the summary names the cause of the failure, not a line about the config in use
##### Verified by
- [test_reviewreport.ErrorTextTest.test_the_cause_of_a_failure_comes_first](../../tests/test_reviewreport.py)
#### Scenario#131.02: a Gitea request waits 90 s
&hellip; so that a TLS handshake of up to a minute does not end the review.
- **Given** a Gitea client of werkrevisor or of `tools/review-report`
- **When** it sends a request
- **Then** it waits up to 90 s for the answer, before 30 s and 60 s
##### Verified by
- [test_reviewreport.ErrorTextTest.test_a_gitea_request_waits_90_seconds](../../tests/test_reviewreport.py)
## Solution
- `werkrevisor/gitea.py`: `TIMEOUT_SECONDS = 90` is the default timeout of `GiteaClient`, before 30 s.
A request that hangs costs at most 90 s; the ai-review build has 15 minutes.
- `werkrevisor/reviewreport.py`: its two Gitea clients take that default instead of 60 s.
`error_text` drops the lines "werkrevisor: operator config from …" and "werkrevisor: config: …"
from the stderr of a failed dry run; the summary line of `hs-review` shows the first line that is left.
- `tests/test_reviewreport.py`: `ErrorTextTest` checks both scenarios.
- `werkrevisor/__init__.py` and `statistics/build.gradle.kts`: version 0.60.1.