You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: run closed-enabled cleanup as first teamleader pass
Process closed prdb:enabled issues in a dedicated pre-pass, remove the enabled label only after successful cleanup, and then continue with normal open-issue decision handling.
Copy file name to clipboardExpand all lines: src/Workflow/docs/workflow.md
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,10 +31,11 @@ A cron job (cron management itself is out of scope) periodically launches the **
31
31
32
32
The Teamleader Agent Messenger Handler is a **deterministic coordinator** (not LLM-backed). For the `ProductConfig` it was dispatched for, it:
33
33
34
-
1. Uses `GithubIntegration` to retrieve all GitHub issues carrying the `prdb:enabled` label
35
-
2. Ensures the GitHub user authenticated by the product token is assigned to each open enabled issue (best effort)
36
-
3. Evaluates each issue's current labels
37
-
4. Takes the first matching action per issue and moves on
34
+
1. Runs a dedicated **closed-enabled cleanup pre-pass**: fetches `prdb:enabled` issues in `closed` state, performs full workspace sweep cleanup, then removes `prdb:enabled` on successful cleanup (keeps label on failure for retry).
35
+
2. Fetches `prdb:enabled` issues in `open` state for normal decision processing.
36
+
3. Ensures the GitHub user authenticated by the product token is assigned to each open enabled issue (best effort).
37
+
4. Evaluates each open issue's current labels.
38
+
5. Takes the first matching action per issue and moves on.
38
39
39
40
### Concurrency Contract
40
41
@@ -58,19 +59,19 @@ The Teamleader evaluates each issue against the following conditions in priority
58
59
59
60
| # | Condition | Action |
60
61
|---|---|---|
61
-
| 1 | Issue is closed (while still carrying `prdb:enabled`) |**Cleanup workspace**: trigger full workspace sweep cleanup (matching containers/images/workspace directory), then skip further processing for this issue |
62
-
| 2 | Has `prdb:reset-locks`|**Reset issue locks/state + cleanup workspace**: clear issue-scoped DB lock artifacts + run claims, trigger full workspace sweep cleanup, remove `prdb:coordination-ongoing`, `prdb:planning-ongoing`, `prdb:implementation-ongoing`, then remove `prdb:reset-locks`|
63
-
| 3 | Has `prdb:coordination-ongoing`|**Skip** — issue is currently being processed by another run |
64
-
| 4 | Has `prdb:planning-ongoing` or `prdb:implementation-ongoing`|**Skip** — work is already in progress |
65
-
| 5 | Has `prdb:enabled` but no `prdb:planning-*`, `prdb:plan-approved`, or `prdb:implementation-*` labels |**Initiate planning**: add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message |
66
-
| 6 | Has `prdb:planning-feedback-needed` AND a user comment newer than the label's timestamp |**Resume planning**: remove `prdb:planning-feedback-needed`, add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message |
67
-
| 7 | Has `prdb:plan-approved` but no `prdb:implementation-*` labels |**Initiate implementation**: add `prdb:coordination-ongoing` + `prdb:implementation-ongoing`, dispatch Implementation Agent message |
68
-
| 8 | Has `prdb:planning-done` but no `prdb:plan-approved` or `prdb:implementation-*` labels AND a non-bot comment newer than the `prdb:planning-done` label's timestamp |**Revise plan**: remove `prdb:planning-done`, add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message (resume mode) |
69
-
| 9 | Has `prdb:implementation-done` AND the linked PR is still open AND there is newer non-bot PR feedback than the latest code state |**Resume implementation**: remove `prdb:implementation-done`, add `prdb:coordination-ongoing` + `prdb:implementation-ongoing`, dispatch Implementation Agent message with revision context (PR branch name, PR number) |
70
-
| 10 | Has `prdb:planning-done` (with no new feedback) or `prdb:implementation-done` (with no new PR feedback) |**Skip** — awaiting human review or PR merge |
71
-
| 11 | Has `prdb:planning-errored` or `prdb:implementation-errored`|**Skip** — requires manual intervention (see [Error Handling](#error-handling)) |
62
+
| 1 | Has `prdb:reset-locks`|**Reset issue locks/state + cleanup workspace**: clear issue-scoped DB lock artifacts + run claims, trigger full workspace sweep cleanup, remove `prdb:coordination-ongoing`, `prdb:planning-ongoing`, `prdb:implementation-ongoing`, then remove `prdb:reset-locks`|
63
+
| 2 | Has `prdb:coordination-ongoing`|**Skip** — issue is currently being processed by another run |
64
+
| 3 | Has `prdb:planning-ongoing` or `prdb:implementation-ongoing`|**Skip** — work is already in progress |
65
+
| 4 | Has `prdb:enabled` but no `prdb:planning-*`, `prdb:plan-approved`, or `prdb:implementation-*` labels |**Initiate planning**: add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message |
66
+
| 5 | Has `prdb:planning-feedback-needed` AND a user comment newer than the label's timestamp |**Resume planning**: remove `prdb:planning-feedback-needed`, add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message |
67
+
| 6 | Has `prdb:plan-approved` but no `prdb:implementation-*` labels |**Initiate implementation**: add `prdb:coordination-ongoing` + `prdb:implementation-ongoing`, dispatch Implementation Agent message |
68
+
| 7 | Has `prdb:planning-done` but no `prdb:plan-approved` or `prdb:implementation-*` labels AND a non-bot comment newer than the `prdb:planning-done` label's timestamp |**Revise plan**: remove `prdb:planning-done`, add `prdb:coordination-ongoing` + `prdb:planning-ongoing`, dispatch Planning Agent message (resume mode) |
69
+
| 8 | Has `prdb:implementation-done` AND the linked PR is still open AND there is newer non-bot PR feedback than the latest code state |**Resume implementation**: remove `prdb:implementation-done`, add `prdb:coordination-ongoing` + `prdb:implementation-ongoing`, dispatch Implementation Agent message with revision context (PR branch name, PR number) |
70
+
| 9 | Has `prdb:planning-done` (with no new feedback) or `prdb:implementation-done` (with no new PR feedback) |**Skip** — awaiting human review or PR merge |
71
+
| 10 | Has `prdb:planning-errored` or `prdb:implementation-errored`|**Skip** — requires manual intervention (see [Error Handling](#error-handling)) |
72
72
73
73
For open enabled issues, assignee enforcement runs before decision routing: if the token-authenticated GitHub user is not already assigned, Teamleader assigns that user (best effort; failures are logged and processing continues).
74
+
If an issue closes between the open-issue fetch and per-issue processing, Teamleader falls back to the same cleanup behavior as the closed pre-pass.
@@ -256,7 +259,7 @@ All ProductBuilder labels use the `prdb:` prefix to avoid collisions with projec
256
259
257
260
| Label | Set by | Removed by | Description |
258
261
|---|---|---|---|
259
-
|`prdb:enabled`| User (manually) | User (manually) | Marks an issue for ProductBuilder processing. Issues without this label are completely ignored by the system. If an enabled issue is already closed, Teamleader performs workspace cleanup and skips further processing for that issue. |
262
+
|`prdb:enabled`| User (manually) |Teamleader (closed cleanup success) or User (manually) | Marks an issue for ProductBuilder processing. Issues without this label are completely ignored by the system. At the start of each Teamleader run, closed enabled issues are sweep-cleaned first; after successful cleanup Teamleader removes `prdb:enabled`. If cleanup fails, the label is kept so the next run retries. |
260
263
|`prdb:reset-locks`| User (manually, human only) | Teamleader | Emergency issue-scoped recovery trigger. On next Teamleader pass it clears issue-scoped DB lock artifacts and active run claims, performs workspace cleanup for the issue workspace, removes `prdb:coordination-ongoing`/`prdb:planning-ongoing`/`prdb:implementation-ongoing`, then removes this label. |
261
264
|`prdb:coordination-ongoing`| Teamleader | Planning / Implementation Handler | Concurrency guard — prevents concurrent Teamleader runs from double-dispatching work for the same issue. Set before dispatching an agent, removed when the agent handler completes. |
262
265
|`prdb:planning-ongoing`| Teamleader | Planning Handler | A Planning Agent is currently working on this issue. |
0 commit comments