@teamclaws/teamclaw 2026.11.5 → 2026.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/controller/config-routes.js +7 -3
- package/dist/src/controller/controller-service.js +12 -1
- package/dist/src/controller/provisioning/container-shared.js +6 -1
- package/dist/src/controller/provisioning/docker.js +1 -1
- package/dist/src/controller/provisioning/kubernetes.js +1 -1
- package/dist/src/controller/provisioning/process-supervisor.js +12 -1
- package/dist/src/controller/provisioning-config.js +8 -0
- package/dist/src/controller/task-assignment.js +65 -2
- package/dist/src/controller/task-results.js +34 -3
- package/dist/src/controller/task-routes.js +24 -1
- package/dist/src/controller/worker-provisioning.js +35 -0
- package/dist/src/controller/worker-routes.js +21 -6
- package/dist/src/openclaw-workspace.js +39 -20
- package/dist/src/task-executor.js +44 -3
- package/dist/src/teamauto/github-client.js +88 -5
- package/dist/src/teamauto/repo-sync.js +77 -5
- package/dist/src/teamauto/scanner.js +22 -1
- package/dist/src/teamauto/scheduler.js +556 -180
- package/dist/src/teamauto/store.js +46 -0
- package/dist/src/teamauto/write-payload-guard.js +209 -0
- package/dist/src/types.js +6 -0
- package/dist/src/worker/tools.js +5 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/controller/config-routes.ts +7 -3
- package/src/controller/controller-service.ts +12 -1
- package/src/controller/provisioning/backend-contract.ts +4 -0
- package/src/controller/provisioning/container-shared.ts +6 -1
- package/src/controller/provisioning/docker.ts +1 -1
- package/src/controller/provisioning/kubernetes.ts +1 -1
- package/src/controller/provisioning/process-supervisor.ts +12 -1
- package/src/controller/provisioning-config.ts +9 -0
- package/src/controller/task-assignment.ts +71 -1
- package/src/controller/task-results.ts +33 -3
- package/src/controller/task-routes.ts +25 -1
- package/src/controller/worker-provisioning.ts +35 -0
- package/src/controller/worker-routes.ts +21 -7
- package/src/openclaw-workspace.ts +43 -23
- package/src/task-executor.ts +46 -3
- package/src/teamauto/github-client.ts +83 -5
- package/src/teamauto/repo-sync.ts +75 -4
- package/src/teamauto/scanner.ts +23 -2
- package/src/teamauto/scheduler.ts +472 -103
- package/src/teamauto/store.ts +72 -0
- package/src/teamauto/write-payload-guard.ts +222 -0
- package/src/types.ts +21 -0
- package/src/worker/tools.ts +5 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sanitizeGithubWriteBody } from "./write-payload-guard.js";
|
|
1
2
|
/**
|
|
2
3
|
* Minimal GitHub REST client for TeamAuto: ETag-conditional GETs, light
|
|
3
4
|
* pagination, and the write endpoints we need. All requests ride the stored
|
|
@@ -30,7 +31,16 @@ export function createGithubClient(auth) {
|
|
|
30
31
|
if (options.body !== undefined) {
|
|
31
32
|
headers["Content-Type"] = "application/json";
|
|
32
33
|
}
|
|
33
|
-
const etagKey = options.etagKey ? `${method} ${urlPath}` : undefined;
|
|
34
|
+
const etagKey = options.etagKey && !urlPath.includes("/issues?") ? `${method} ${urlPath}` : undefined;
|
|
35
|
+
// #5706 (ggcode, 2026-11-16): the ISSUE-SCAN URL must not use conditional
|
|
36
|
+
// requests. Live evidence: the gateway process received 304 for
|
|
37
|
+
// state=open&sort=updated&since=<cursor> while the byte-identical request
|
|
38
|
+
// (same etag, same plugin token) from a shell returned 200 with 13 items -
|
|
39
|
+
// GitHub's weak-validation on since-filtered, updated-sorted lists can
|
|
40
|
+
// serve a stale 304 to the long-lived process, starving EVERY sweep to
|
|
41
|
+
// "fetched 0" (three re-opened issues starved 3h, historical cases 4h20m).
|
|
42
|
+
// The scan fetches <=50 items; 304 savings are negligible. Pulls/commits
|
|
43
|
+
// and all write paths keep their etag handling.
|
|
34
44
|
if (etagKey && options.etags?.[etagKey]) {
|
|
35
45
|
headers["If-None-Match"] = options.etags[etagKey];
|
|
36
46
|
}
|
|
@@ -47,6 +57,12 @@ export function createGithubClient(auth) {
|
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
if (response.status === 304) {
|
|
60
|
+
// #5706: a 304 on the ISSUE SCAN URL while the identical request from
|
|
61
|
+
// a shell (same etag) returns 200/12 items is the live divergence -
|
|
62
|
+
// log it loudly so the next sweep pins the layer.
|
|
63
|
+
if (urlPath.includes("/issues?")) {
|
|
64
|
+
console.warn(`[teamclaw#5706] issues scan 304: ${urlPath.slice(0, 140)}`);
|
|
65
|
+
}
|
|
50
66
|
return { status: 304, data: null, notModified: true };
|
|
51
67
|
}
|
|
52
68
|
const text = await response.text();
|
|
@@ -65,6 +81,11 @@ export function createGithubClient(auth) {
|
|
|
65
81
|
}
|
|
66
82
|
if (response.status >= 200 && response.status < 300) {
|
|
67
83
|
etagCounters.hits += 1; // #267-3: "hits" = calls that returned fresh data (non-304 successes)
|
|
84
|
+
// #5706: empty-array 200s on the scan URL are suspicious in exactly
|
|
85
|
+
// the starvation scenario - make them visible.
|
|
86
|
+
if (urlPath.includes("/issues?") && Array.isArray(data) && data.length === 0) {
|
|
87
|
+
console.warn(`[teamclaw#5706] issues scan 200-but-EMPTY: ${urlPath.slice(0, 140)}`);
|
|
88
|
+
}
|
|
68
89
|
}
|
|
69
90
|
return { status: response.status, data, notModified: false };
|
|
70
91
|
}
|
|
@@ -162,15 +183,47 @@ export function createGithubClient(auth) {
|
|
|
162
183
|
},
|
|
163
184
|
// ---- write side (require Contents/Issues/PR write on the App) ----
|
|
164
185
|
async postIssueComment(owner, repo, issueNumber, body) {
|
|
165
|
-
|
|
186
|
+
// #5704: LLM envelope frames must never land as comment bodies.
|
|
187
|
+
const safeBody = sanitizeGithubWriteBody(body, `issue comment ${owner}/${repo}#${issueNumber}`);
|
|
188
|
+
const { data } = await request("POST", `/repos/${owner}/${repo}/issues/${issueNumber}/comments`, { body: { body: safeBody } });
|
|
166
189
|
return Number(data.id ?? 0);
|
|
167
190
|
},
|
|
168
191
|
async postPullReviewComment(owner, repo, pullNumber, body) {
|
|
169
|
-
|
|
192
|
+
// #5704: same write-channel guard on the PR review surface.
|
|
193
|
+
const safeBody = sanitizeGithubWriteBody(body, `pull review ${owner}/${repo}#${pullNumber}`);
|
|
194
|
+
await request("POST", `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`, { body: { event: "COMMENT", body: safeBody } });
|
|
195
|
+
},
|
|
196
|
+
/** #5660: normalized feedback bodies already on a PR - review bodies AND
|
|
197
|
+
* issue-style comments (a worker may post through either surface during
|
|
198
|
+
* its execution window while the write-back ladder delivers the same
|
|
199
|
+
* text moments later). Whitespace-collapsed so footer spacing cannot
|
|
200
|
+
* defeat the comparison. */
|
|
201
|
+
async getPullFeedbackBodies(owner, repo, pullNumber) {
|
|
202
|
+
const bodies = [];
|
|
203
|
+
const norm = (raw) => String(raw ?? "").replace(/\s+/g, " ").trim();
|
|
204
|
+
try {
|
|
205
|
+
const { data } = await request("GET", `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews?per_page=30`);
|
|
206
|
+
if (Array.isArray(data)) {
|
|
207
|
+
for (const r of data)
|
|
208
|
+
bodies.push(norm(r.body));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch { /* reviews listing failed - degrade to comments-only check */ }
|
|
212
|
+
try {
|
|
213
|
+
const { data } = await request("GET", `/repos/${owner}/${repo}/issues/${pullNumber}/comments?per_page=30`);
|
|
214
|
+
if (Array.isArray(data)) {
|
|
215
|
+
for (const c of data)
|
|
216
|
+
bodies.push(norm(c.body));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch { /* comments listing failed - degrade to reviews-only check */ }
|
|
220
|
+
return bodies.filter(Boolean);
|
|
170
221
|
},
|
|
171
222
|
async createIssue(owner, repo, title, body, labels) {
|
|
223
|
+
// #5704: umbrella/section bodies get the same frame guard.
|
|
224
|
+
const safeBody = sanitizeGithubWriteBody(body, `create issue ${owner}/${repo}`);
|
|
172
225
|
const { data } = await request("POST", `/repos/${owner}/${repo}/issues`, {
|
|
173
|
-
body: { title, body, ...(labels?.length ? { labels } : {}) },
|
|
226
|
+
body: { title, body: safeBody, ...(labels?.length ? { labels } : {}) },
|
|
174
227
|
});
|
|
175
228
|
return Number(data.number ?? 0);
|
|
176
229
|
},
|
|
@@ -183,6 +236,33 @@ export function createGithubClient(auth) {
|
|
|
183
236
|
async removeIssueAssignees(owner, repo, issueNumber, assignees) {
|
|
184
237
|
await request("DELETE", `/repos/${owner}/${repo}/issues/${issueNumber}/assignees`, { body: { assignees } });
|
|
185
238
|
},
|
|
239
|
+
/** #claim-dequeue: comments on an issue since a timestamp, for the
|
|
240
|
+
* dequeue-time external-collaboration check (authors + times only). */
|
|
241
|
+
async getIssueCommentsSince(owner, repo, issueNumber, sinceIso) {
|
|
242
|
+
try {
|
|
243
|
+
const { data } = await request("GET", `/repos/${owner}/${repo}/issues/${issueNumber}/comments?since=${encodeURIComponent(sinceIso)}&per_page=20`);
|
|
244
|
+
if (!Array.isArray(data))
|
|
245
|
+
return [];
|
|
246
|
+
return data.map((c) => ({
|
|
247
|
+
user: String(c.user?.login ?? ""),
|
|
248
|
+
createdAt: String(c.created_at ?? ""),
|
|
249
|
+
})).filter((c) => c.user);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return []; // listing failed - degrade to assignee check only
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
async getIssueCommentBodies(owner, repo, issueNumber) {
|
|
256
|
+
try {
|
|
257
|
+
const { data } = await request("GET", `/repos/${owner}/${repo}/issues/${issueNumber}/comments?per_page=30`);
|
|
258
|
+
if (!Array.isArray(data))
|
|
259
|
+
return [];
|
|
260
|
+
return data.map((c) => String(c.body ?? ""));
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return []; // listing failed - degrade to posting (duplicate risk < lost delivery)
|
|
264
|
+
}
|
|
265
|
+
},
|
|
186
266
|
/** Fresh issue state for claim-time re-checks (#268): the scan-time
|
|
187
267
|
* assignee snapshot is seconds stale by enqueue time - a human may have
|
|
188
268
|
* self-assigned in between, and claiming over a human is worse than not
|
|
@@ -205,8 +285,11 @@ export function createGithubClient(auth) {
|
|
|
205
285
|
},
|
|
206
286
|
/** Open a PR from a task worktree branch (collaboration contract delivery). */
|
|
207
287
|
async createPullRequest(owner, repo, head, base, title, body) {
|
|
288
|
+
// #5704 case 3: a bare frame as the whole PR body consumed the deliverable
|
|
289
|
+
// surface (ggcode #5703) - guard the PR body like every other write.
|
|
290
|
+
const safeBody = sanitizeGithubWriteBody(body, `create PR ${owner}/${repo} head=${head}`);
|
|
208
291
|
const { data } = await request("POST", `/repos/${owner}/${repo}/pulls`, {
|
|
209
|
-
body: { title, head, base, body },
|
|
292
|
+
body: { title, head, base, body: safeBody },
|
|
210
293
|
});
|
|
211
294
|
const item = data;
|
|
212
295
|
return { number: Number(item.number ?? 0), url: String(item.html_url ?? "") };
|
|
@@ -129,11 +129,58 @@ export function createRepoSync(auth, logger) {
|
|
|
129
129
|
}
|
|
130
130
|
async function pushBranch(repoId, dir, cloneUrl, branch) {
|
|
131
131
|
const authed = await tokenizedUrl(cloneUrl);
|
|
132
|
+
// #stale-base follow-up: the remote task branch may ALREADY carry the
|
|
133
|
+
// delivery (previous incarnation pushed it; the PR got merged). Blindly
|
|
134
|
+
// pushing HEAD again is a permanent non-fast-forward (6x retry spam,
|
|
135
|
+
// task mwfzy51j 2026-11-14). Fetch the remote tip first: when local
|
|
136
|
+
// HEAD is an ancestor of it, the work is already on the remote - report
|
|
137
|
+
// instead of pushing.
|
|
138
|
+
try {
|
|
139
|
+
await run(["fetch", authed, `refs/heads/${branch}`], dir);
|
|
140
|
+
const remoteTip = (await run(["rev-parse", "FETCH_HEAD"], dir)).trim();
|
|
141
|
+
const localHead = (await run(["rev-parse", "HEAD"], dir)).trim();
|
|
142
|
+
if (remoteTip && localHead && remoteTip !== localHead) {
|
|
143
|
+
const ancestor = await run(["merge-base", "--is-ancestor", localHead, remoteTip], dir).then(() => true, () => false);
|
|
144
|
+
if (ancestor) {
|
|
145
|
+
logger.warn(`TeamAuto: ${repoId}#${branch} already delivered (remote tip ${remoteTip.slice(0, 8)} contains local ${localHead.slice(0, 8)}) - skipping push`);
|
|
146
|
+
return { alreadyDelivered: true };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch { /* branch absent remotely or fetch failed - plain push below */ }
|
|
132
151
|
try {
|
|
133
152
|
await run(["push", authed, `HEAD:refs/heads/${branch}`], dir);
|
|
153
|
+
return { alreadyDelivered: false };
|
|
134
154
|
}
|
|
135
155
|
catch (err) {
|
|
136
|
-
|
|
156
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
157
|
+
logger.warn(`TeamAuto: push failed for ${repoId}#${branch}: ${msg}`);
|
|
158
|
+
// #5651 (ggcode, 2026-11-15): a NON-FAST-FORWARD rejection is
|
|
159
|
+
// deterministic - the generic retry ladder burned 6 attempts / ~25min
|
|
160
|
+
// on it twice (#5268 family). The task branch is exclusively ours, so
|
|
161
|
+
// rebase onto the fetched remote tip and push ONCE more; if the rebase
|
|
162
|
+
// conflicts (base rewritten underneath us) give up immediately - the
|
|
163
|
+
// caller's failure path is the correct terminal state, not 5 more
|
|
164
|
+
// doomed retries of the same push.
|
|
165
|
+
const NON_FF = /non-fast-forward|behind its remote counterpart|fetch first|reject/i;
|
|
166
|
+
if (NON_FF.test(msg)) {
|
|
167
|
+
try {
|
|
168
|
+
logger.warn(`TeamAuto: non-fast-forward on ${repoId}#${branch} - rebasing onto remote tip and retrying once`);
|
|
169
|
+
await run(["rebase", "FETCH_HEAD"], dir);
|
|
170
|
+
await run(["push", authed, `HEAD:refs/heads/${branch}`], dir);
|
|
171
|
+
logger.warn(`TeamAuto: ${repoId}#${branch} delivered after rebase`);
|
|
172
|
+
return { alreadyDelivered: false };
|
|
173
|
+
}
|
|
174
|
+
catch (rebaseErr) {
|
|
175
|
+
// Leave the worktree clean for the next pass: abort a half-done
|
|
176
|
+
// rebase so the retry (or dead-letter) sees a sane tree.
|
|
177
|
+
await run(["rebase", "--abort"], dir).catch(() => { });
|
|
178
|
+
const rmsg = rebaseErr instanceof Error ? rebaseErr.message : String(rebaseErr);
|
|
179
|
+
logger.warn(`TeamAuto: rebase self-heal failed for ${repoId}#${branch}: ${rmsg}`);
|
|
180
|
+
const permanent = new Error(`push rejected (non-fast-forward) and rebase self-heal failed: ${rmsg}`);
|
|
181
|
+
throw permanent;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
137
184
|
throw err;
|
|
138
185
|
}
|
|
139
186
|
}
|
|
@@ -205,13 +252,29 @@ export function createRepoSync(auth, logger) {
|
|
|
205
252
|
* branched from HEAD. Reuses an existing worktree (resume-safe) so the
|
|
206
253
|
* checkpoint/retry path lands in the same tree.
|
|
207
254
|
*/
|
|
208
|
-
async function ensureTaskWorktree(repoId, taskId) {
|
|
255
|
+
async function ensureTaskWorktree(repoId, taskId, defaultBranch, cloneUrl) {
|
|
209
256
|
const base = await repoDir(repoId);
|
|
210
257
|
const wtName = taskWorktreeDirName(repoId, taskId);
|
|
211
258
|
// wtName carries the teamauto/ level for the REL path; the physical dir is
|
|
212
259
|
// a SIBLING of the base checkout (path.join would nest teamauto/ twice).
|
|
213
260
|
const wtPath = path.join(path.dirname(base), path.basename(wtName));
|
|
214
261
|
if (!(await fs.access(path.join(wtPath, ".git")).then(() => true, () => false))) {
|
|
262
|
+
// #stale-base (user report 2026-11-14): ensureCloned (fetch + reset to
|
|
263
|
+
// the default-branch tip) only ran at BIND time (learnNorms), so the
|
|
264
|
+
// base checkout's HEAD drifted days behind origin/main and EVERY new
|
|
265
|
+
// task worktree branched from stale code. Refresh the base right
|
|
266
|
+
// before creating a new branch off it - same fetch+reset as
|
|
267
|
+
// ensureCloned. Existing worktrees (resume path) are left untouched.
|
|
268
|
+
if (defaultBranch && cloneUrl) {
|
|
269
|
+
try {
|
|
270
|
+
const authed = await tokenizedUrl(cloneUrl);
|
|
271
|
+
await run(["fetch", authed, defaultBranch], base);
|
|
272
|
+
await run(["reset", "--hard", "FETCH_HEAD"], base);
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
logger.warn(`TeamAuto: base refresh failed for ${repoId} (continuing on current HEAD): ${err instanceof Error ? err.message : String(err)}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
215
278
|
await run(["worktree", "add", "-b", taskBranchName(taskId), wtPath, "HEAD"], base);
|
|
216
279
|
logger.warn(`TeamAuto: worktree ${wtName} (branch ${taskBranchName(taskId)}) for ${taskId}`);
|
|
217
280
|
}
|
|
@@ -245,7 +308,7 @@ export function createRepoSync(auth, logger) {
|
|
|
245
308
|
* matches) or nonexistent (no commits of its own). Undelivered local work
|
|
246
309
|
* is retained and reported - never silently destroyed.
|
|
247
310
|
*/
|
|
248
|
-
async function safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle) {
|
|
311
|
+
async function safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle, isUnknownTask) {
|
|
249
312
|
const base = await repoDir(repoId);
|
|
250
313
|
const wtName = taskWorktreeDirName(repoId, taskId);
|
|
251
314
|
const wtPath = path.join(path.dirname(base), path.basename(wtName));
|
|
@@ -273,6 +336,15 @@ export function createRepoSync(auth, logger) {
|
|
|
273
336
|
if (inUsePid !== null) {
|
|
274
337
|
return { removed: false, reason: `retained: in use by live process (pid ${inUsePid})` };
|
|
275
338
|
}
|
|
339
|
+
// #gc3 (user policy 2026-11-14: "全删"): a worktree whose task has NO
|
|
340
|
+
// record left in team-state (task history pruned) can never be judged
|
|
341
|
+
// by delivery/target oracles and was retained forever. The owner
|
|
342
|
+
// ruled: delete outright, no archive. Still placed AFTER the in-use
|
|
343
|
+
// sentinel - a live foreign controller may be finishing work in it.
|
|
344
|
+
if (isUnknownTask?.(taskId)) {
|
|
345
|
+
await removeTaskWorktree(repoId, taskId);
|
|
346
|
+
return { removed: true, reason: "orphaned: no task record (delete policy)" };
|
|
347
|
+
}
|
|
276
348
|
// #orphan-gc: the target issue/PR is CLOSED - no delivery this worktree
|
|
277
349
|
// could ever produce would be wanted (the issue was fixed/rejected
|
|
278
350
|
// elsewhere, the PR superseded). This is the authoritative orphan
|
|
@@ -340,7 +412,7 @@ export function createRepoSync(auth, logger) {
|
|
|
340
412
|
* sibling whose task is terminal (or unknown), apply the delivery-safety
|
|
341
413
|
* removal. Heals the historical backlog that pre-dates terminal cleanup.
|
|
342
414
|
*/
|
|
343
|
-
async function gcTaskWorktrees(repoId, isTerminal, deliveryOracle, targetClosedOracle) {
|
|
415
|
+
async function gcTaskWorktrees(repoId, isTerminal, deliveryOracle, targetClosedOracle, isUnknownTask) {
|
|
344
416
|
const base = await repoDir(repoId);
|
|
345
417
|
const siblings = path.dirname(base);
|
|
346
418
|
// taskWorktreeDirName(repoId, "x") = "teamauto/<slug>__task-x"; the
|
|
@@ -351,7 +423,7 @@ export function createRepoSync(auth, logger) {
|
|
|
351
423
|
const retained = [];
|
|
352
424
|
let stale = 0;
|
|
353
425
|
const apply = async (taskId) => {
|
|
354
|
-
const r = await safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle);
|
|
426
|
+
const r = await safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle, isUnknownTask);
|
|
355
427
|
if (r.removed) {
|
|
356
428
|
removed.push(taskId);
|
|
357
429
|
logger.warn(`TeamAuto: worktree GC removed ${taskId} (${r.reason})`);
|
|
@@ -142,7 +142,28 @@ export async function sweepRepo(repo, client, now = Date.now()) {
|
|
|
142
142
|
if ((repo.cursors.seen[key] ?? 0) >= updatedAtMs) {
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
|
-
//
|
|
145
|
+
// #pr-rework (user 2026-11-15, live case ggcode#5653): OUR OWN open PRs
|
|
146
|
+
// were exempted below to avoid self-review loops - but that also made
|
|
147
|
+
// external review feedback (GO/NO GO, rework requests) DEAD: delivery
|
|
148
|
+
// write-back completes at PR creation, nothing ever re-picks the thread,
|
|
149
|
+
// and a NO GO'd PR sat idle 12h+ until a human coordinator intervened.
|
|
150
|
+
// Same-ecosystem communication IS the GitHub surface - close the loop:
|
|
151
|
+
// our own PR with fresh activity becomes a prRework task (the worker
|
|
152
|
+
// reads the review thread and continues in the original branch).
|
|
153
|
+
if (pull.head.startsWith("teamclaw/") && !pull.draft && repo.policy.actions.prRework) {
|
|
154
|
+
candidates.push({
|
|
155
|
+
repoId: repo.id,
|
|
156
|
+
key,
|
|
157
|
+
kind: "prRework",
|
|
158
|
+
number: pull.number,
|
|
159
|
+
role: "developer",
|
|
160
|
+
writeMode: "write",
|
|
161
|
+
title: truncate(`Rework from review: PR #${pull.number}: ${pull.title}`, 120),
|
|
162
|
+
reason: "our delivered PR received new review activity",
|
|
163
|
+
context: `Our delivery PR #${pull.number} received new review activity (comments/review/edits at ${pull.updated_at}).\nLink: ${pull.htmlUrl}\nHead branch: ${pull.head}\n\nRead the review thread on the PR, address the feedback, and push follow-up commits to the same branch.\n\nPR description:\n${truncate(pull.body, 2000)}`,
|
|
164
|
+
});
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
146
167
|
// Skip our own PRs and drafts.
|
|
147
168
|
if (pull.head.startsWith("teamclaw/") || pull.draft || TEAMCLAW_MARKER_RE.test(pull.title)) {
|
|
148
169
|
continue;
|