Park on a new review once requested changes are answered, never park a Gitea draft, and count a slot only for a window that started

This commit is contained in:
2026-11-18 23:53:28 +01:00
parent 0eea8aa10d
commit 89a7cfe65a
14 changed files with 219 additions and 71 deletions
+5 -3
View File
@@ -86,7 +86,7 @@ import sys
import time
import typing
from chunk_pr.approval import approval, approved, awaited, PARKS, unanswered
from chunk_pr.approval import approval, approved, awaited, left_to_park, PARKS, unanswered
from forge.pulls import checks_passed, merged_pull, open_pull, required_checks
from failure import Failure
from forge.commands import Forge, forge_of, gitea, Run, runner
@@ -306,7 +306,7 @@ def finishes_of(given: list[str]) -> list[list[str]] | None:
def merged(run: Run, config: Config, sleep: typing.Callable[[float], None] = time.sleep, finishes: typing.Sequence[list[str]] = (), parks: bool = False) -> str | Failure:
"""Merge the branch's pull request in the project's merge queue. Each pass of the loop is one turn in the queue; a pull request that still wants its approval leaves the queue while it waits, so the next chunk merges meanwhile, and takes a new turn once approved. Where parks, it doesn't wait for the approval: it fails at once, telling the worker that do-epic parks the chunk."""
"""Merge the branch's pull request in the project's merge queue. Each pass of the loop is one turn in the queue; a pull request that still wants its approval leaves the queue while it waits, so the next chunk merges meanwhile, and takes a new turn once approved. Where parks, it doesn't wait for the approval: it fails at once, as `left_to_park` says."""
found = pull(run)
if isinstance(found, Failure):
return found
@@ -337,8 +337,10 @@ def merged(run: Run, config: Config, sleep: typing.Callable[[float], None] = tim
taken = untaken or merge_turn(pull_request, finishes, loaded, run, sleep)
if not isinstance(taken, AwaitsApproval):
return taken if isinstance(taken, Failure) else taken + absent
if parks:
return left_to_park(number, run)
# Out of the queue, so the project's other chunks merge while this one waits.
waited = Failure(f"pull request {number} passed its checks and awaits an approval; end your run now, since do-epic parks the chunk and resumes this session once it is approved or a reviewer comments") if parks else approved(number, run, sleep)
waited = approved(number, run, sleep)
if isinstance(waited, Failure):
return waited