Commit cba737b
feat(quality-gate): hung-reviewer retry policy with configurable constants (#413)
* feat(quality-gate): hung-reviewer retry policy with configurable constants
Reviewers that return with 0 tool uses (API overload / dropped connection)
are now surfaced with explicit retry instructions rather than being silently
passed or requiring manual intervention.
- Add REVIEWER_MAX_RETRIES (default: 1) and REVIEWER_FAST_FAIL_SECONDS
(default: 30) module-level constants to quality_gate.py
- Extend _build_review_guidance() with a "Handling Hung Reviewers" section
that instructs Claude to detect 0-tool-use returns, retry once, and — after
exhausting retries — call mark_review_as_passed with a skip note so the
workflow proceeds without blocking indefinitely
- Fast-fail detection: if elapsed time < REVIEWER_FAST_FAIL_SECONDS the
reviewer never got an API response; retry immediately
- _build_review_guidance() now accepts max_retries and fast_fail_seconds
kwargs for test overriding and future caller configuration
- Add JOBS-REQ-004.9 to spec and 9 new tests covering all acceptance criteria
Closes #408
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(quality-gate): address reviewer feedback on hung-reviewer policy
- Fix hardcoded "once"/"If the retry also" — now parameterized via
retry_instruction/exhaust_condition locals so the prose stays correct
for any value of max_retries
- Fix mark_review_as_passed guidance: the tool only accepts review_id;
skip note is now communicated to the user separately, not as a phantom
tool argument
- Add slow-hang path: guidance now explicitly describes both fast-fail
(elapsed < REVIEWER_FAST_FAIL_SECONDS, retry immediately) and slow-hang
(elapsed >= threshold, retry after brief pause)
- Fix JOBS-REQ-004.9 spec: moved to end of file (after 004.8), corrected
requirement 4 and 5 to match implementation
- Strengthen test_guidance_specifies_max_retries: checks "max N retry/ies"
not just presence of "retry"
- Fix test_build_review_guidance_accepts_override_params: checks specific
formatted strings "max 3 retries" / "4 failed attempts" / "60"
- Add test_guidance_describes_slow_hang_path (REQ-004.9.5)
- Add test_guidance_instructs_separate_user_message_not_tool_comment
(REQ-004.9.4)
- Add JOBS-REQ-004.8 and JOBS-REQ-004.9 to module docstring
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* style: apply ruff auto-formatting to quality_gate and test file
Wrap two long ternary expressions in quality_gate.py and one long
assert expression in test_quality_gate.py into parenthesized
multi-line form per ruff line-length rules.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 3ca7453 commit cba737b
4 files changed
Lines changed: 171 additions & 4 deletions
File tree
- doc/specs/deepwork/jobs
- src/deepwork/jobs/mcp
- tests/unit/jobs/mcp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
34 | 47 | | |
35 | 48 | | |
36 | 49 | | |
| |||
480 | 493 | | |
481 | 494 | | |
482 | 495 | | |
483 | | - | |
484 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
485 | 517 | | |
486 | 518 | | |
487 | 519 | | |
| |||
490 | 522 | | |
491 | 523 | | |
492 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
493 | 537 | | |
494 | 538 | | |
495 | | - | |
| 539 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
1897 | 1901 | | |
1898 | 1902 | | |
1899 | 1903 | | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
0 commit comments