Read a team's own repo labels as do-epic's picks, and treat an item a person filed sub-tasks under as split
CI / tests (pull_request) Has been cancelled

This commit is contained in:
Lilleman
2026-11-19 15:33:51 +01:00
parent 017cf33611
commit 95535b4fb3
20 changed files with 278 additions and 119 deletions
+8 -8
View File
@@ -139,7 +139,7 @@ def run(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher:
def status_printed(epic: EpicRun) -> Stop:
"""What `do-epic <EPIC-KEY> --status` does: prints a line per open issue, and doesn't start anything."""
issues = epic.store.read()
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.effects.tmux)
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.config.label_repos, epic.effects.tmux)
return Stop(1, lines.reason) if isinstance(lines, Failure) else Stop(0, "\n".join(lines) or f"the epic {epic.key} has no open issue")
@@ -149,7 +149,7 @@ def epic_written(key: str, writes: tuple[str, str, tuple[str, ...]] | None, path
if isinstance(config, Failure):
return Stop(1, config.reason)
store, record = backend(config, key)
done = findings.written(key, *writes, store, record, stdin, paths.home / scheduler.STATE / key) if writes else finish.closed(key, store, stdin)
done = findings.written(key, *writes, store, config.label_repos, record, stdin, paths.home / scheduler.STATE / key) if writes else finish.closed(key, store, config.label_repos, stdin)
return Stop(1, done.reason) if isinstance(done, Failure) else Stop(0, done)
@@ -208,7 +208,7 @@ def scheduled_epic(epic: EpicRun) -> scheduler.Epic | Failure:
seen.append(found.checkout)
return real(found.checkout), found.config.parallel_chunks
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env)
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env, epic.config.label_repos)
@dataclasses.dataclass(frozen=True)
@@ -244,8 +244,8 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
issue = None if key == epic.key else issue_read(key, epic)
if isinstance(issue, Stop):
return issue
if issue and isinstance(recorded(issue), HumanTask):
human_tasks.awaited(issue, epic.key, epic.store, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
if issue and isinstance(recorded(issue, epic.config.label_repos), HumanTask):
human_tasks.awaited(issue, epic.key, epic.store, epic.config.label_repos, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
return handed_on(key, epic)
place = chunk_root(key, issue, epic)
if isinstance(place, Stop):
@@ -355,7 +355,7 @@ def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop:
def chunk_root(key: str, issue: EpicIssue | None, epic: EpicRun) -> tuple[str, str | None] | Stop:
"""The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is. issue is None for the epic's finishing. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk."""
pick = recorded(issue) if issue else ClaudeWork()
pick = recorded(issue, epic.config.label_repos) if issue else ClaudeWork()
if isinstance(pick, Failure):
return Stop(1, pick.reason)
if isinstance(pick, ClaudeWork):
@@ -399,7 +399,7 @@ def handed_on(key: str, epic: EpicRun) -> Stop:
def split_items_closed(epic: EpicRun, issues: list[EpicIssue]) -> list[EpicIssue] | Stop:
"""The issues, with each item split by repo whose sub-tasks are all done moved to done in the tracker and read as done; the stop where one cannot move. Its last sub-task to finish closes it, and one an earlier run left open closes with it."""
for item in issues:
if split.SPLIT_LABEL in item.labels and not item.done and split.finished(issues, item.key):
if split.is_split(item, issues) and not item.done and split.finished(issues, item.key):
moved = epic.store.finish_issue(item.key)
if isinstance(moved, Failure):
return Stop(1, f"the chunk finished, but its split item {item.key} could not move to done: {moved.reason}; once it is done in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
@@ -451,7 +451,7 @@ def chunk_work(key: str, checkout: str | None, language: str, epic: EpicRun) ->
return Stop(1, issues.reason)
if not finish.due(issues):
return EpicReopened()
return finish.task(epic.key, issues, epic.launcher, language), None
return finish.task(epic.key, issues, epic.config.label_repos, epic.launcher, language), None
def repoless_models(epic: EpicRun) -> Models: