@teamclaws/teamclaw 2026.11.5 → 2026.11.7
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/README.md +17 -11
- package/dist/src/config.js +3 -3
- package/dist/src/controller/config-routes.js +7 -3
- package/dist/src/controller/controller-service.js +12 -1
- package/dist/src/controller/http-server.js +2 -2
- package/dist/src/controller/managed-gateway-process.js +17 -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 +23 -1
- package/dist/src/controller/provisioning-config.js +8 -0
- package/dist/src/controller/route-table.js +2 -2
- package/dist/src/controller/security.js +30 -15
- package/dist/src/controller/task-assignment.js +126 -2
- package/dist/src/controller/task-results.js +34 -3
- package/dist/src/controller/task-routes.js +63 -3
- package/dist/src/controller/tunnel-manager.js +11 -0
- package/dist/src/controller/tunnel-routes.js +11 -0
- package/dist/src/controller/worker-provisioning.js +35 -0
- package/dist/src/controller/worker-routes.js +21 -6
- package/dist/src/controller/workspace-routes.js +16 -2
- package/dist/src/openclaw-workspace.js +39 -20
- package/dist/src/task-executor.js +44 -3
- package/dist/src/teamauto/github-client.js +107 -5
- package/dist/src/teamauto/repo-sync.js +172 -26
- package/dist/src/teamauto/scanner.js +22 -1
- package/dist/src/teamauto/scheduler.js +988 -190
- package/dist/src/teamauto/store.js +171 -3
- package/dist/src/teamauto/write-payload-guard.js +209 -0
- package/dist/src/types.js +11 -3
- package/dist/src/ui/app.js +2 -2
- package/dist/src/worker/tools.js +5 -0
- package/dist/src/worker/worker-service.js +13 -1
- package/dist/src/workspace-browser.js +14 -0
- package/openclaw.plugin.json +5 -5
- package/package.json +4 -2
- package/src/config.ts +3 -3
- package/src/controller/config-routes.ts +7 -3
- package/src/controller/controller-service.ts +12 -1
- package/src/controller/http-server.ts +2 -2
- package/src/controller/managed-gateway-process.ts +17 -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 +23 -1
- package/src/controller/provisioning-config.ts +9 -0
- package/src/controller/route-table.ts +2 -2
- package/src/controller/security.ts +30 -15
- package/src/controller/task-assignment.ts +128 -1
- package/src/controller/task-results.ts +33 -3
- package/src/controller/task-routes.ts +64 -2
- package/src/controller/tunnel-manager.ts +12 -1
- package/src/controller/tunnel-routes.ts +11 -0
- package/src/controller/worker-provisioning.ts +35 -0
- package/src/controller/worker-routes.ts +21 -7
- package/src/controller/workspace-routes.ts +17 -2
- package/src/openclaw-workspace.ts +43 -23
- package/src/task-executor.ts +46 -3
- package/src/teamauto/github-client.ts +103 -5
- package/src/teamauto/repo-sync.ts +158 -23
- package/src/teamauto/scanner.ts +23 -2
- package/src/teamauto/scheduler.ts +883 -113
- package/src/teamauto/store.ts +205 -3
- package/src/teamauto/write-payload-guard.ts +222 -0
- package/src/types.ts +30 -7
- package/src/ui/app.js +2 -2
- package/src/worker/tools.ts +5 -0
- package/src/worker/worker-service.ts +15 -1
- package/src/workspace-browser.ts +15 -0
|
@@ -118,22 +118,125 @@ export function createRepoSync(auth, logger) {
|
|
|
118
118
|
async function createWorkBranch(dir, name) {
|
|
119
119
|
await run(["checkout", "-B", name], dir);
|
|
120
120
|
}
|
|
121
|
+
/** #5815: deliverable must mean commits beyond the REMOTE base tip. A
|
|
122
|
+
* stale local baseline makes a zero-commit branch look deliverable; the
|
|
123
|
+
* PR then 422s (zero diff) deterministically six times. */
|
|
124
|
+
async function branchHasCommits(dir, defaultBranch, cloneUrl) {
|
|
125
|
+
if (!defaultBranch)
|
|
126
|
+
return false;
|
|
127
|
+
try {
|
|
128
|
+
if (cloneUrl) {
|
|
129
|
+
const authed = await tokenizedUrl(cloneUrl);
|
|
130
|
+
await run(["fetch", authed, defaultBranch], dir).catch(() => { });
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await run(["fetch", "origin", defaultBranch], dir).catch(() => { });
|
|
134
|
+
}
|
|
135
|
+
const out = await run(["rev-list", "--count", `origin/${defaultBranch}..HEAD`], dir);
|
|
136
|
+
return Number(out.trim()) > 0;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** #5815: is the branch an ancestor of the remote base (zero-diff shape)? */
|
|
143
|
+
async function branchIsAncestorOfRemoteBase(dir, branch, defaultBranch) {
|
|
144
|
+
await run(["fetch", "origin", defaultBranch], dir).catch(() => { });
|
|
145
|
+
const head = (await run(["rev-parse", `origin/${branch}`], dir).catch(() => "")).trim();
|
|
146
|
+
const base = (await run(["rev-parse", `origin/${defaultBranch}`], dir).catch(() => "")).trim();
|
|
147
|
+
if (!head || !base)
|
|
148
|
+
return false;
|
|
149
|
+
return run(["merge-base", "--is-ancestor", head, base], dir).then(() => true, () => false);
|
|
150
|
+
}
|
|
151
|
+
/** #5788: does the branch exist on the remote? (422 disambiguation probe) */
|
|
152
|
+
async function branchExistsRemotely(dir, branch) {
|
|
153
|
+
const out = await run(["ls-remote", "origin", `refs/heads/${branch}`], dir).catch(() => "");
|
|
154
|
+
return out.trim().length > 0;
|
|
155
|
+
}
|
|
121
156
|
async function commitAll(dir, message, authorName, authorEmail) {
|
|
122
157
|
const status = await run(["status", "--porcelain"], dir);
|
|
123
158
|
if (!status.trim()) {
|
|
124
159
|
return false;
|
|
125
160
|
}
|
|
126
161
|
await run(["add", "-A"], dir);
|
|
127
|
-
await run(["-c", `user.name=${authorName}`, "-c", `user.email=${authorEmail}`, "commit", "-m", message], dir);
|
|
162
|
+
await run(["-c", `user.name=${authorName}`, "-c", `user.email=${authorEmail}`, "-c", "core.hooksPath=", "commit", "-m", message], dir);
|
|
128
163
|
return true;
|
|
129
164
|
}
|
|
130
|
-
async function pushBranch(repoId, dir, cloneUrl, branch) {
|
|
165
|
+
async function pushBranch(repoId, dir, cloneUrl, branch, onPushError) {
|
|
131
166
|
const authed = await tokenizedUrl(cloneUrl);
|
|
167
|
+
// #stale-base follow-up: the remote task branch may ALREADY carry the
|
|
168
|
+
// delivery (previous incarnation pushed it; the PR got merged). Blindly
|
|
169
|
+
// pushing HEAD again is a permanent non-fast-forward (6x retry spam,
|
|
170
|
+
// task mwfzy51j 2026-11-14). Fetch the remote tip first: when local
|
|
171
|
+
// HEAD is an ancestor of it, the work is already on the remote - report
|
|
172
|
+
// instead of pushing.
|
|
173
|
+
try {
|
|
174
|
+
await run(["fetch", authed, `refs/heads/${branch}`], dir);
|
|
175
|
+
const remoteTip = (await run(["rev-parse", "FETCH_HEAD"], dir)).trim();
|
|
176
|
+
const localHead = (await run(["rev-parse", "HEAD"], dir)).trim();
|
|
177
|
+
if (remoteTip && localHead && remoteTip !== localHead) {
|
|
178
|
+
const ancestor = await run(["merge-base", "--is-ancestor", localHead, remoteTip], dir).then(() => true, () => false);
|
|
179
|
+
if (ancestor) {
|
|
180
|
+
logger.warn(`TeamAuto: ${repoId}#${branch} already delivered (remote tip ${remoteTip.slice(0, 8)} contains local ${localHead.slice(0, 8)}) - skipping push`);
|
|
181
|
+
return { alreadyDelivered: true };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch { /* branch absent remotely or fetch failed - plain push below */ }
|
|
132
186
|
try {
|
|
133
187
|
await run(["push", authed, `HEAD:refs/heads/${branch}`], dir);
|
|
188
|
+
// #5788: verify the push LANDED - a "successful" push whose ref is
|
|
189
|
+
// missing remotely (auth edge, proxy quirk) strands the branch exactly
|
|
190
|
+
// like a failed one, and createPR would 422 on the missing head.
|
|
191
|
+
const ls = await run(["ls-remote", authed, `refs/heads/${branch}`], dir).catch(() => "");
|
|
192
|
+
const localHead = (await run(["rev-parse", "HEAD"], dir)).trim();
|
|
193
|
+
if (ls && localHead && !ls.includes(localHead)) {
|
|
194
|
+
const msg = `post-push ref verification failed: remote refs/heads/${branch} does not contain local HEAD ${localHead.slice(0, 8)}`;
|
|
195
|
+
logger.warn(`TeamAuto: ${msg}`);
|
|
196
|
+
try {
|
|
197
|
+
onPushError?.(msg);
|
|
198
|
+
}
|
|
199
|
+
catch { /* observability only */ }
|
|
200
|
+
throw new Error(msg);
|
|
201
|
+
}
|
|
202
|
+
return { alreadyDelivered: false };
|
|
134
203
|
}
|
|
135
204
|
catch (err) {
|
|
136
|
-
|
|
205
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
206
|
+
logger.warn(`TeamAuto: push failed for ${repoId}#${branch}: ${msg}`);
|
|
207
|
+
// #5788: the push leg was the ONLY delivery step with zero activity
|
|
208
|
+
// surface - its failure only ever showed as downstream createPR 422
|
|
209
|
+
// noise (two stranded self-fix legs). Surface it via the callback.
|
|
210
|
+
try {
|
|
211
|
+
onPushError?.(msg);
|
|
212
|
+
}
|
|
213
|
+
catch { /* observability only */ }
|
|
214
|
+
// #5651 (ggcode, 2026-11-15): a NON-FAST-FORWARD rejection is
|
|
215
|
+
// deterministic - the generic retry ladder burned 6 attempts / ~25min
|
|
216
|
+
// on it twice (#5268 family). The task branch is exclusively ours, so
|
|
217
|
+
// rebase onto the fetched remote tip and push ONCE more; if the rebase
|
|
218
|
+
// conflicts (base rewritten underneath us) give up immediately - the
|
|
219
|
+
// caller's failure path is the correct terminal state, not 5 more
|
|
220
|
+
// doomed retries of the same push.
|
|
221
|
+
const NON_FF = /non-fast-forward|behind its remote counterpart|fetch first|reject/i;
|
|
222
|
+
if (NON_FF.test(msg)) {
|
|
223
|
+
try {
|
|
224
|
+
logger.warn(`TeamAuto: non-fast-forward on ${repoId}#${branch} - rebasing onto remote tip and retrying once`);
|
|
225
|
+
await run(["rebase", "FETCH_HEAD"], dir);
|
|
226
|
+
await run(["push", authed, `HEAD:refs/heads/${branch}`], dir);
|
|
227
|
+
logger.warn(`TeamAuto: ${repoId}#${branch} delivered after rebase`);
|
|
228
|
+
return { alreadyDelivered: false };
|
|
229
|
+
}
|
|
230
|
+
catch (rebaseErr) {
|
|
231
|
+
// Leave the worktree clean for the next pass: abort a half-done
|
|
232
|
+
// rebase so the retry (or dead-letter) sees a sane tree.
|
|
233
|
+
await run(["rebase", "--abort"], dir).catch(() => { });
|
|
234
|
+
const rmsg = rebaseErr instanceof Error ? rebaseErr.message : String(rebaseErr);
|
|
235
|
+
logger.warn(`TeamAuto: rebase self-heal failed for ${repoId}#${branch}: ${rmsg}`);
|
|
236
|
+
const permanent = new Error(`push rejected (non-fast-forward) and rebase self-heal failed: ${rmsg}`);
|
|
237
|
+
throw permanent;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
137
240
|
throw err;
|
|
138
241
|
}
|
|
139
242
|
}
|
|
@@ -205,16 +308,67 @@ export function createRepoSync(auth, logger) {
|
|
|
205
308
|
* branched from HEAD. Reuses an existing worktree (resume-safe) so the
|
|
206
309
|
* checkpoint/retry path lands in the same tree.
|
|
207
310
|
*/
|
|
208
|
-
async function ensureTaskWorktree(repoId, taskId) {
|
|
311
|
+
async function ensureTaskWorktree(repoId, taskId, defaultBranch, cloneUrl) {
|
|
209
312
|
const base = await repoDir(repoId);
|
|
210
313
|
const wtName = taskWorktreeDirName(repoId, taskId);
|
|
211
314
|
// wtName carries the teamauto/ level for the REL path; the physical dir is
|
|
212
315
|
// a SIBLING of the base checkout (path.join would nest teamauto/ twice).
|
|
213
316
|
const wtPath = path.join(path.dirname(base), path.basename(wtName));
|
|
214
|
-
|
|
317
|
+
const wtExists = await fs.access(path.join(wtPath, ".git")).then(() => true, () => false);
|
|
318
|
+
if (!wtExists) {
|
|
319
|
+
// #stale-base (user report 2026-11-14): ensureCloned (fetch + reset to
|
|
320
|
+
// the default-branch tip) only ran at BIND time (learnNorms), so the
|
|
321
|
+
// base checkout's HEAD drifted days behind origin/main and EVERY new
|
|
322
|
+
// task worktree branched from stale code. Refresh the base right
|
|
323
|
+
// before creating a new branch off it - same fetch+reset as
|
|
324
|
+
// ensureCloned.
|
|
325
|
+
if (defaultBranch && cloneUrl) {
|
|
326
|
+
try {
|
|
327
|
+
const authed = await tokenizedUrl(cloneUrl);
|
|
328
|
+
await run(["fetch", authed, defaultBranch], base);
|
|
329
|
+
await run(["reset", "--hard", "FETCH_HEAD"], base);
|
|
330
|
+
}
|
|
331
|
+
catch (err) {
|
|
332
|
+
logger.warn(`TeamAuto: base refresh failed for ${repoId} (continuing on current HEAD): ${err instanceof Error ? err.message : String(err)}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
215
335
|
await run(["worktree", "add", "-b", taskBranchName(taskId), wtPath, "HEAD"], base);
|
|
216
336
|
logger.warn(`TeamAuto: worktree ${wtName} (branch ${taskBranchName(taskId)}) for ${taskId}`);
|
|
217
337
|
}
|
|
338
|
+
else {
|
|
339
|
+
// #resume-sync (user 2026-11-18): a RESUMED task (retry / review
|
|
340
|
+
// follow-up) used to continue on the ORIGINAL base untouched - the
|
|
341
|
+
// comment above explicitly left resume paths stale. On repos that
|
|
342
|
+
// move fast, a worktree alive for hours is guaranteed behind, all
|
|
343
|
+
// retried work lands on a superseded base, and the divergence only
|
|
344
|
+
// surfaces at push (single-shot #5651 rebase self-heal or dead
|
|
345
|
+
// letter). Sync BEFORE resuming: fetch the main tree, count how far
|
|
346
|
+
// behind this branch is, rebase when behind (dirty trees via
|
|
347
|
+
// autostash). Best-effort: on any failure we continue on the current
|
|
348
|
+
// base exactly as before - delivery-time self-heal still applies.
|
|
349
|
+
try {
|
|
350
|
+
await run(["fetch", "origin", "+refs/heads/main:refs/remotes/origin/main"], base).catch(async () => {
|
|
351
|
+
const db = defaultBranch || (await run(["symbolic-ref", "--short", "refs/remotes/origin/HEAD"], base).then((o) => o.trim(), () => ""));
|
|
352
|
+
if (db)
|
|
353
|
+
await run(["fetch", "origin", `+refs/heads/${db}:refs/remotes/origin/${db}`], base);
|
|
354
|
+
});
|
|
355
|
+
const behindOut = await run(["rev-list", "--count", "HEAD..origin/main"], wtPath).catch(() => "");
|
|
356
|
+
const behind = Number(behindOut.trim()) || 0;
|
|
357
|
+
if (behind > 0) {
|
|
358
|
+
logger.warn(`TeamAuto: resume-sync ${repoId}#${taskId}: branch is ${behind} commit(s) behind main - rebasing before work continues`);
|
|
359
|
+
try {
|
|
360
|
+
await run(["rebase", "--autostash", "origin/main"], wtPath);
|
|
361
|
+
}
|
|
362
|
+
catch (rebaseErr) {
|
|
363
|
+
await run(["rebase", "--abort"], wtPath).catch(() => { });
|
|
364
|
+
logger.warn(`TeamAuto: resume-sync rebase failed for ${repoId}#${taskId} (continuing on current base; delivery-time self-heal applies): ${rebaseErr instanceof Error ? rebaseErr.message : String(rebaseErr)}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (err) {
|
|
369
|
+
logger.warn(`TeamAuto: resume-sync skipped for ${repoId}#${taskId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
218
372
|
// Refresh the in-use sentinel on create AND resume (#173 follow-up 2).
|
|
219
373
|
await writeTaskLock(wtPath);
|
|
220
374
|
return wtPath;
|
|
@@ -245,7 +399,7 @@ export function createRepoSync(auth, logger) {
|
|
|
245
399
|
* matches) or nonexistent (no commits of its own). Undelivered local work
|
|
246
400
|
* is retained and reported - never silently destroyed.
|
|
247
401
|
*/
|
|
248
|
-
async function safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle) {
|
|
402
|
+
async function safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle, isUnknownTask) {
|
|
249
403
|
const base = await repoDir(repoId);
|
|
250
404
|
const wtName = taskWorktreeDirName(repoId, taskId);
|
|
251
405
|
const wtPath = path.join(path.dirname(base), path.basename(wtName));
|
|
@@ -273,6 +427,15 @@ export function createRepoSync(auth, logger) {
|
|
|
273
427
|
if (inUsePid !== null) {
|
|
274
428
|
return { removed: false, reason: `retained: in use by live process (pid ${inUsePid})` };
|
|
275
429
|
}
|
|
430
|
+
// #gc3 (user policy 2026-11-14: "全删"): a worktree whose task has NO
|
|
431
|
+
// record left in team-state (task history pruned) can never be judged
|
|
432
|
+
// by delivery/target oracles and was retained forever. The owner
|
|
433
|
+
// ruled: delete outright, no archive. Still placed AFTER the in-use
|
|
434
|
+
// sentinel - a live foreign controller may be finishing work in it.
|
|
435
|
+
if (isUnknownTask?.(taskId)) {
|
|
436
|
+
await removeTaskWorktree(repoId, taskId);
|
|
437
|
+
return { removed: true, reason: "orphaned: no task record (delete policy)" };
|
|
438
|
+
}
|
|
276
439
|
// #orphan-gc: the target issue/PR is CLOSED - no delivery this worktree
|
|
277
440
|
// could ever produce would be wanted (the issue was fixed/rejected
|
|
278
441
|
// elsewhere, the PR superseded). This is the authoritative orphan
|
|
@@ -340,7 +503,7 @@ export function createRepoSync(auth, logger) {
|
|
|
340
503
|
* sibling whose task is terminal (or unknown), apply the delivery-safety
|
|
341
504
|
* removal. Heals the historical backlog that pre-dates terminal cleanup.
|
|
342
505
|
*/
|
|
343
|
-
async function gcTaskWorktrees(repoId, isTerminal, deliveryOracle, targetClosedOracle) {
|
|
506
|
+
async function gcTaskWorktrees(repoId, isTerminal, deliveryOracle, targetClosedOracle, isUnknownTask) {
|
|
344
507
|
const base = await repoDir(repoId);
|
|
345
508
|
const siblings = path.dirname(base);
|
|
346
509
|
// taskWorktreeDirName(repoId, "x") = "teamauto/<slug>__task-x"; the
|
|
@@ -351,7 +514,7 @@ export function createRepoSync(auth, logger) {
|
|
|
351
514
|
const retained = [];
|
|
352
515
|
let stale = 0;
|
|
353
516
|
const apply = async (taskId) => {
|
|
354
|
-
const r = await safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle);
|
|
517
|
+
const r = await safeRemoveTaskWorktree(repoId, taskId, deliveryOracle, targetClosedOracle, isUnknownTask);
|
|
355
518
|
if (r.removed) {
|
|
356
519
|
removed.push(taskId);
|
|
357
520
|
logger.warn(`TeamAuto: worktree GC removed ${taskId} (${r.reason})`);
|
|
@@ -415,22 +578,5 @@ export function createRepoSync(auth, logger) {
|
|
|
415
578
|
function taskWorktreeRelDir(repoId, taskId) {
|
|
416
579
|
return taskWorktreeDirName(repoId, taskId);
|
|
417
580
|
}
|
|
418
|
-
|
|
419
|
-
async function branchHasCommits(dir, baseBranch) {
|
|
420
|
-
try {
|
|
421
|
-
const out = await run(["rev-list", "--count", "HEAD", "--not", baseBranch], dir);
|
|
422
|
-
return Number(out.trim()) > 0;
|
|
423
|
-
}
|
|
424
|
-
catch {
|
|
425
|
-
// Base branch name unknown/unfetched - fall back to diff against first parent chain
|
|
426
|
-
try {
|
|
427
|
-
const root = await run(["rev-list", "--max-parents=0", "HEAD"], dir);
|
|
428
|
-
return root.trim().length > 0;
|
|
429
|
-
}
|
|
430
|
-
catch {
|
|
431
|
-
return false;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
return { ensureCloned, currentSha, recentCommitMessages, readFileIfPresent, safeRepoPath, createWorkBranch, commitAll, pushBranch, ensureTaskWorktree, removeTaskWorktree, safeRemoveTaskWorktree, gcTaskWorktrees, taskWorktreeRelDir, taskBranchName, branchHasCommits, repoDir };
|
|
581
|
+
return { ensureCloned, currentSha, recentCommitMessages, readFileIfPresent, safeRepoPath, createWorkBranch, commitAll, pushBranch, branchExistsRemotely, branchIsAncestorOfRemoteBase, ensureTaskWorktree, removeTaskWorktree, safeRemoveTaskWorktree, gcTaskWorktrees, taskWorktreeRelDir, taskBranchName, branchHasCommits, repoDir };
|
|
436
582
|
}
|
|
@@ -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;
|