@teamclaws/teamclaw 2026.7.1 → 2026.8.1
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 +8 -0
- package/dist/api.js +1 -0
- package/dist/index.js +325 -0
- package/dist/src/config.js +381 -0
- package/dist/src/controller/controller-capacity.js +14 -0
- package/dist/src/controller/controller-service.js +393 -0
- package/dist/src/controller/controller-tools.js +582 -0
- package/dist/src/controller/delivery-report.js +458 -0
- package/dist/src/controller/github-auth.js +564 -0
- package/dist/src/controller/http-server.js +6032 -0
- package/dist/src/controller/kickoff-orchestrator.js +220 -0
- package/dist/src/controller/managed-gateway-process.js +286 -0
- package/dist/src/controller/message-router.js +38 -0
- package/dist/src/controller/orchestration-manifest.js +173 -0
- package/dist/src/controller/preview-manager.js +586 -0
- package/dist/src/controller/prompt-injector.js +187 -0
- package/dist/src/controller/role-inference.js +35 -0
- package/dist/src/controller/task-router.js +67 -0
- package/dist/src/controller/tunnel-manager.js +548 -0
- package/dist/src/controller/websocket.js +42 -0
- package/dist/src/controller/worker-provisioning.js +1648 -0
- package/dist/src/discovery.js +86 -0
- package/dist/src/git-collaboration.js +694 -0
- package/dist/src/identity.js +131 -0
- package/dist/src/install-defaults.js +1 -0
- package/dist/src/interaction-contracts.js +531 -0
- package/dist/src/networking.js +91 -0
- package/dist/src/openclaw-workspace.js +903 -0
- package/dist/src/prompt-policy.js +373 -0
- package/dist/src/protocol.js +58 -0
- package/dist/src/roles.js +349 -0
- package/dist/src/state.js +183 -0
- package/dist/src/task-executor.js +1033 -0
- package/dist/src/teamauto/github-client.js +192 -0
- package/dist/src/teamauto/norms.js +85 -0
- package/dist/src/teamauto/repo-sync.js +201 -0
- package/dist/src/teamauto/scanner.js +179 -0
- package/dist/src/teamauto/schedule.js +123 -0
- package/dist/src/teamauto/scheduler.js +688 -0
- package/dist/src/teamauto/store.js +133 -0
- package/dist/src/types.js +243 -0
- package/dist/src/ui/app.js +4292 -0
- package/dist/src/ui/assets/teamclaw-app-icon.png +0 -0
- package/dist/src/ui/github-login.html +296 -0
- package/dist/src/ui/index.html +414 -0
- package/dist/src/ui/style.css +2611 -0
- package/dist/src/worker/http-handler.js +146 -0
- package/dist/src/worker/message-queue.js +24 -0
- package/dist/src/worker/prompt-injector.js +42 -0
- package/dist/src/worker/skill-installer.js +253 -0
- package/dist/src/worker/tools.js +541 -0
- package/dist/src/worker/worker-service.js +234 -0
- package/dist/src/workspace-browser.js +269 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +9 -7
- package/src/controller/http-server.ts +26 -1
- package/src/controller/tunnel-manager.ts +139 -15
- package/src/ui/app.js +97 -20
- package/src/ui/index.html +16 -4
- package/src/ui/style.css +49 -0
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { createGithubClient } from "./github-client.js";
|
|
3
|
+
import { learnNorms, renderNormsBlock } from "./norms.js";
|
|
4
|
+
import { createRepoSync, teamAutoProjectDir } from "./repo-sync.js";
|
|
5
|
+
import { nextFireMs } from "./schedule.js";
|
|
6
|
+
import { advanceCursors, sweepRepo } from "./scanner.js";
|
|
7
|
+
import { consumeDailyBudget, defaultCursors, defaultPolicy, loadTeamAutoStore, pushTeamAutoActivity, saveTeamAutoStore, } from "./store.js";
|
|
8
|
+
/**
|
|
9
|
+
* TeamAuto scheduler: per-repo cron sweeps -> TeamClaw tasks -> GitHub
|
|
10
|
+
* write-backs. Fully autonomous per the user's decisions (TEAMAUTO_DESIGN.md):
|
|
11
|
+
* comments/PRs/issues are posted directly; ambiguous work goes through the
|
|
12
|
+
* normal clarification blocking flow.
|
|
13
|
+
*/
|
|
14
|
+
const MARKER_FOOTER = (role) => `\n---\n[teamclaw:${role}] autonomous via TeamClaw`;
|
|
15
|
+
function newId(prefix) {
|
|
16
|
+
return `${prefix}-${Date.now().toString(36)}-${randomBytes(4).toString("hex")}`;
|
|
17
|
+
}
|
|
18
|
+
export { nextFireMs, ScheduleParseError } from "./schedule.js";
|
|
19
|
+
/** Max HARD (non-transient) failures before a candidate is dead-lettered. */
|
|
20
|
+
export const TEAMAUTO_DEAD_LETTER_ATTEMPTS = 3;
|
|
21
|
+
/** Max TOTAL failures (transient included) before a candidate is dead-lettered. */
|
|
22
|
+
export const TEAMAUTO_DEAD_LETTER_TRANSIENT_ATTEMPTS = 6;
|
|
23
|
+
/**
|
|
24
|
+
* Failure signatures that are environmental, not the task's fault - the same
|
|
25
|
+
* candidate is likely to succeed on a later sweep. Observed live (92-task
|
|
26
|
+
* dump): upstream rate limiting ("AI service needs a short break"), shared
|
|
27
|
+
* workspace snapshot races ("Workspace filesystem changed"), worker gateway
|
|
28
|
+
* lifecycle races ("Gateway request entry is closed"). These get a wider
|
|
29
|
+
* retry allowance than hard failures so they do not dead-letter good work.
|
|
30
|
+
*/
|
|
31
|
+
export const TRANSIENT_FAILURE_RE = /workspace filesystem changed|ai service needs a short break|gateway request entry is closed|rate.?limit|timed? ?out|econnreset|socket hang up|bad gateway|service unavailable/i;
|
|
32
|
+
/** The dedup marker for a candidate as embedded in task descriptions. */
|
|
33
|
+
export function idempotencyMarker(candidate) {
|
|
34
|
+
return `Idempotency-Key: ${candidate.key}:${candidate.kind}`;
|
|
35
|
+
}
|
|
36
|
+
/** Failed task attempts for a candidate (task history is the attempt log). */
|
|
37
|
+
export function failedAttemptCount(state, candidate) {
|
|
38
|
+
const marker = idempotencyMarker(candidate);
|
|
39
|
+
return Object.values(state.tasks).filter((t) => t.description.includes(marker) && t.status === "failed").length;
|
|
40
|
+
}
|
|
41
|
+
/** Failed attempts whose error is NOT a known transient signature. */
|
|
42
|
+
export function hardAttemptCount(state, candidate) {
|
|
43
|
+
const marker = idempotencyMarker(candidate);
|
|
44
|
+
return Object.values(state.tasks).filter((t) => t.description.includes(marker) && t.status === "failed" && !(t.error && TRANSIENT_FAILURE_RE.test(t.error))).length;
|
|
45
|
+
}
|
|
46
|
+
/** Auto-pause retry backoff: 30m after the 1st failure, doubling, capped at 4h. */
|
|
47
|
+
export const SWEEP_RETRY_BASE_MINUTES = 30;
|
|
48
|
+
export const SWEEP_RETRY_MAX_MINUTES = 240;
|
|
49
|
+
export function sweepBackoffMinutes(failures) {
|
|
50
|
+
return Math.min(SWEEP_RETRY_BASE_MINUTES * 2 ** Math.max(0, failures - 1), SWEEP_RETRY_MAX_MINUTES);
|
|
51
|
+
}
|
|
52
|
+
/** Epoch ms when an auto-paused repo becomes due for its next retry attempt. */
|
|
53
|
+
export function sweepRetryDueAt(failures, lastErrorAt) {
|
|
54
|
+
return lastErrorAt + sweepBackoffMinutes(failures) * 60_000;
|
|
55
|
+
}
|
|
56
|
+
/** Auto-pauses (set by the sweep catch block) are cooldowns; user pauses are not. */
|
|
57
|
+
export function isAutoPause(reason) {
|
|
58
|
+
return !!reason && reason.startsWith("sweep failed:");
|
|
59
|
+
}
|
|
60
|
+
export function createTeamAutoScheduler(deps) {
|
|
61
|
+
const { logger, auth } = deps;
|
|
62
|
+
function recordActivity(store, entry) {
|
|
63
|
+
pushTeamAutoActivity(store, entry);
|
|
64
|
+
deps.onActivity?.(entry);
|
|
65
|
+
}
|
|
66
|
+
const client = createGithubClient(auth);
|
|
67
|
+
const sync = createRepoSync(auth, logger);
|
|
68
|
+
const timers = new Map();
|
|
69
|
+
const sweeping = new Set();
|
|
70
|
+
let running = false;
|
|
71
|
+
let store = null;
|
|
72
|
+
let writebackTimer = null;
|
|
73
|
+
async function ensureStore() {
|
|
74
|
+
if (!store) {
|
|
75
|
+
store = await loadTeamAutoStore();
|
|
76
|
+
}
|
|
77
|
+
return store;
|
|
78
|
+
}
|
|
79
|
+
// ---------- public repo management ----------
|
|
80
|
+
async function addRepo(repoId, options = {}) {
|
|
81
|
+
const s = await ensureStore();
|
|
82
|
+
const normalized = repoId.trim().replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
|
|
83
|
+
if (!/^[\w.-]+\/[\w.-]+$/.test(normalized)) {
|
|
84
|
+
throw new Error(`invalid repo id: ${repoId} (expected owner/repo)`);
|
|
85
|
+
}
|
|
86
|
+
if (s.repos.some((r) => r.id === normalized)) {
|
|
87
|
+
throw new Error(`${normalized} is already bound`);
|
|
88
|
+
}
|
|
89
|
+
const [owner, name] = normalized.split("/");
|
|
90
|
+
const info = await client.getRepoInfo(owner, name);
|
|
91
|
+
if (!info.permissions.pull) {
|
|
92
|
+
throw new Error(`no read access to ${normalized}`);
|
|
93
|
+
}
|
|
94
|
+
const schedule = options.schedule?.trim() || "*/30 * * * *";
|
|
95
|
+
nextFireMs(schedule); // validates: throws ScheduleParseError for unsupported expressions
|
|
96
|
+
const repo = {
|
|
97
|
+
id: normalized,
|
|
98
|
+
enabled: true,
|
|
99
|
+
schedule,
|
|
100
|
+
addedAt: Date.now(),
|
|
101
|
+
lastSweepAt: 0,
|
|
102
|
+
lastSweepSummary: null,
|
|
103
|
+
pausedReason: null,
|
|
104
|
+
dryRunDone: !s.budget.firstSweepDryRun,
|
|
105
|
+
policy: defaultPolicy(),
|
|
106
|
+
cursors: defaultCursors(),
|
|
107
|
+
norms: null,
|
|
108
|
+
};
|
|
109
|
+
if (options.keywordInclude?.length) {
|
|
110
|
+
repo.policy.keywordFilter.include = options.keywordInclude;
|
|
111
|
+
}
|
|
112
|
+
if (options.keywordExclude?.length) {
|
|
113
|
+
repo.policy.keywordFilter.exclude = options.keywordExclude;
|
|
114
|
+
}
|
|
115
|
+
// Provision (clone + norms learning) runs in the background so bind
|
|
116
|
+
// returns immediately; sweeps stay gated until provision completes.
|
|
117
|
+
repo.provision = { status: "provisioning", message: "cloning repo", startedAt: Date.now(), updatedAt: Date.now() };
|
|
118
|
+
s.repos.push(repo);
|
|
119
|
+
recordActivity(s, { at: Date.now(), repoId: normalized, kind: "bind", text: `bound (schedule ${repo.schedule})` });
|
|
120
|
+
await saveTeamAutoStore(s);
|
|
121
|
+
scheduleRepo(repo);
|
|
122
|
+
void provisionRepoInBackground(normalized, info.cloneUrl, info.defaultBranch);
|
|
123
|
+
logger.info(`TeamAuto: bound ${normalized} (schedule ${repo.schedule}${repo.dryRunDone ? "" : ", first sweep dry-run"}; provisioning in background)`);
|
|
124
|
+
return repo;
|
|
125
|
+
}
|
|
126
|
+
async function provisionRepoInBackground(repoId, cloneUrl, defaultBranch) {
|
|
127
|
+
try {
|
|
128
|
+
const s0 = await ensureStore();
|
|
129
|
+
const repoRef = s0.repos.find((r) => r.id === repoId);
|
|
130
|
+
if (!repoRef) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
await updateRepoProvision(repoId, { status: "provisioning", message: "learning repo norms" });
|
|
134
|
+
const norms = await learnNorms(repoRef, client, sync, cloneUrl, defaultBranch);
|
|
135
|
+
await updateRepoProvision(repoId, { status: "ready", message: "ready", norms });
|
|
136
|
+
const sReady = await ensureStore();
|
|
137
|
+
recordActivity(sReady, { at: Date.now(), repoId, kind: "provision", text: "ready (clone + norms done)" });
|
|
138
|
+
logger.info(`TeamAuto: provisioned ${repoId} (clone + norms done)`);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
142
|
+
logger.warn(`TeamAuto: provisioning failed for ${repoId}: ${message}`);
|
|
143
|
+
await updateRepoProvision(repoId, { status: "failed", message });
|
|
144
|
+
const sFailed = await ensureStore();
|
|
145
|
+
recordActivity(sFailed, { at: Date.now(), repoId, kind: "provision", text: `failed: ${message}` });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function updateRepoProvision(repoId, patch) {
|
|
149
|
+
const s = await ensureStore();
|
|
150
|
+
const repo = s.repos.find((r) => r.id === repoId);
|
|
151
|
+
if (!repo) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
repo.provision = { status: patch.status ?? repo.provision?.status ?? "provisioning", message: patch.message ?? repo.provision?.message ?? "", startedAt: repo.provision?.startedAt ?? Date.now(), updatedAt: Date.now() };
|
|
155
|
+
if (patch.norms) {
|
|
156
|
+
repo.norms = patch.norms;
|
|
157
|
+
}
|
|
158
|
+
await saveTeamAutoStore(s);
|
|
159
|
+
}
|
|
160
|
+
async function removeRepo(repoId) {
|
|
161
|
+
const s = await ensureStore();
|
|
162
|
+
s.repos = s.repos.filter((r) => r.id !== repoId);
|
|
163
|
+
await saveTeamAutoStore(s);
|
|
164
|
+
const timer = timers.get(repoId);
|
|
165
|
+
if (timer) {
|
|
166
|
+
clearTimeout(timer);
|
|
167
|
+
timers.delete(repoId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function setRepoEnabled(repoId, enabled) {
|
|
171
|
+
const s = await ensureStore();
|
|
172
|
+
const repo = s.repos.find((r) => r.id === repoId);
|
|
173
|
+
if (!repo) {
|
|
174
|
+
throw new Error(`${repoId} not bound`);
|
|
175
|
+
}
|
|
176
|
+
repo.enabled = enabled;
|
|
177
|
+
repo.pausedReason = enabled ? null : (repo.pausedReason ?? "disabled by user");
|
|
178
|
+
await saveTeamAutoStore(s);
|
|
179
|
+
if (enabled) {
|
|
180
|
+
scheduleRepo(repo);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async function updateRepo(repoId, patch = {}) {
|
|
184
|
+
const s = await ensureStore();
|
|
185
|
+
const repo = s.repos.find((r) => r.id === repoId);
|
|
186
|
+
if (!repo) {
|
|
187
|
+
throw new Error(`${repoId} not bound`);
|
|
188
|
+
}
|
|
189
|
+
if (patch.schedule?.trim()) {
|
|
190
|
+
const schedule = patch.schedule.trim();
|
|
191
|
+
nextFireMs(schedule); // validates before persisting
|
|
192
|
+
repo.schedule = schedule;
|
|
193
|
+
}
|
|
194
|
+
if (typeof patch.maxTasksPerSweep === "number" && patch.maxTasksPerSweep > 0) {
|
|
195
|
+
repo.policy.maxTasksPerSweep = Math.min(20, Math.floor(patch.maxTasksPerSweep));
|
|
196
|
+
}
|
|
197
|
+
if (patch.fullReview) {
|
|
198
|
+
repo.policy.actions.fullReview = patch.fullReview;
|
|
199
|
+
}
|
|
200
|
+
if (typeof patch.takeOwnership === "boolean") {
|
|
201
|
+
repo.policy.actions.takeOwnership = patch.takeOwnership;
|
|
202
|
+
}
|
|
203
|
+
await saveTeamAutoStore(s);
|
|
204
|
+
scheduleRepo(repo);
|
|
205
|
+
return repo;
|
|
206
|
+
}
|
|
207
|
+
async function runSweepNow(repoId, force = true) {
|
|
208
|
+
const s = await ensureStore();
|
|
209
|
+
const repo = s.repos.find((r) => r.id === repoId);
|
|
210
|
+
if (!repo) {
|
|
211
|
+
throw new Error(`${repoId} not bound`);
|
|
212
|
+
}
|
|
213
|
+
return runSweep(repo, force);
|
|
214
|
+
}
|
|
215
|
+
// ---------- sweep engine ----------
|
|
216
|
+
async function runSweep(repo, force) {
|
|
217
|
+
// Sweeps stay gated until bind-time provisioning (clone + norms) settles.
|
|
218
|
+
if (repo.provision?.status === "provisioning") {
|
|
219
|
+
const summary = `skipped: still provisioning (${repo.provision.message})`;
|
|
220
|
+
logger.debug?.(`TeamAuto: ${repo.id} ${summary}`);
|
|
221
|
+
return summary;
|
|
222
|
+
}
|
|
223
|
+
if (repo.provision?.status === "failed") {
|
|
224
|
+
const summary = `skipped: provisioning failed (${repo.provision.message})`;
|
|
225
|
+
logger.warn(`TeamAuto: ${repo.id} ${summary}`);
|
|
226
|
+
return summary;
|
|
227
|
+
}
|
|
228
|
+
const s = await ensureStore();
|
|
229
|
+
if (sweeping.has(repo.id)) {
|
|
230
|
+
return "sweep already in progress";
|
|
231
|
+
}
|
|
232
|
+
sweeping.add(repo.id);
|
|
233
|
+
try {
|
|
234
|
+
const { candidates, issues, pulls } = await sweepRepo(repo, client);
|
|
235
|
+
const dryRun = !repo.dryRunDone && s.budget.firstSweepDryRun;
|
|
236
|
+
if (dryRun) {
|
|
237
|
+
// One observing pass, then act. Flip unconditionally - flipping only
|
|
238
|
+
// when candidates existed deadlocked empty first sweeps in dry-run
|
|
239
|
+
// mode forever (dry-run never advanced cursors -> still "first sweep"
|
|
240
|
+
// -> still zero candidates -> dryRunDone never set).
|
|
241
|
+
repo.dryRunDone = true;
|
|
242
|
+
}
|
|
243
|
+
if (!dryRun) {
|
|
244
|
+
// Advance only for acting sweeps: a dry-run must leave the cursors
|
|
245
|
+
// untouched so the reported actions are actually performed next time
|
|
246
|
+
// instead of being marked as already-seen.
|
|
247
|
+
advanceCursors(repo, issues, pulls);
|
|
248
|
+
}
|
|
249
|
+
// Joint full reviews bypass the per-sweep cap: they append AFTER issue/
|
|
250
|
+
// pull candidates, so a busy repo would otherwise starve them forever
|
|
251
|
+
// (cap filled every sweep, lastFullReviewAt never advancing). They are
|
|
252
|
+
// at most one cycle (3 sections) per interval, so this stays bounded.
|
|
253
|
+
const fullReviews = candidates.filter((c) => c.kind === "fullReview");
|
|
254
|
+
const regular = candidates.filter((c) => c.kind !== "fullReview").slice(0, Math.max(0, repo.policy.maxTasksPerSweep - fullReviews.length));
|
|
255
|
+
const capped = [...fullReviews, ...regular];
|
|
256
|
+
let created = 0;
|
|
257
|
+
const summary = [`found ${candidates.length} candidate(s)`];
|
|
258
|
+
if (capped.length && dryRun) {
|
|
259
|
+
summary.push(...capped.map((c) => `DRY-RUN would ${c.kind}: ${c.title}`));
|
|
260
|
+
repo.lastSweepSummary = `dry-run: ${summary.join("; ")}`;
|
|
261
|
+
}
|
|
262
|
+
else if (capped.length) {
|
|
263
|
+
if (!consumeDailyBudget(s, capped.length)) {
|
|
264
|
+
summary.push("skipped: daily task budget exhausted");
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
for (const candidate of capped) {
|
|
268
|
+
const taskId = enqueueCandidate(repo, candidate);
|
|
269
|
+
if (taskId === "dead-lettered") {
|
|
270
|
+
recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: `dead-lettered after ${TEAMAUTO_DEAD_LETTER_ATTEMPTS} failed attempts: ${candidate.kind}: ${candidate.title}` });
|
|
271
|
+
}
|
|
272
|
+
else if (taskId) {
|
|
273
|
+
recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "task", text: `${candidate.kind}: ${candidate.title}` });
|
|
274
|
+
const action = candidate.kind === "prReview"
|
|
275
|
+
? "prComment"
|
|
276
|
+
: candidate.kind === "fullReview"
|
|
277
|
+
? "createIssue"
|
|
278
|
+
: "issueComment";
|
|
279
|
+
registerWriteback(taskId, action, repo.id, candidate.number || null, candidate.cycle !== undefined ? String(candidate.cycle) : undefined);
|
|
280
|
+
created++;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
repo.lastSweepSummary = `created ${created}/${capped.length} task(s)`;
|
|
284
|
+
if (capped.some((c) => c.kind === "fullReview")) {
|
|
285
|
+
repo.cursors.lastFullReviewAt = Date.now();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
repo.lastSweepSummary = "no new work";
|
|
291
|
+
}
|
|
292
|
+
repo.lastSweepAt = Date.now();
|
|
293
|
+
if (isAutoPause(repo.pausedReason)) {
|
|
294
|
+
repo.pausedReason = null;
|
|
295
|
+
recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: "sweep recovered, auto-pause cleared" });
|
|
296
|
+
}
|
|
297
|
+
repo.sweepFailures = 0;
|
|
298
|
+
recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: repo.lastSweepSummary ?? "sweep complete" });
|
|
299
|
+
await saveTeamAutoStore(s);
|
|
300
|
+
if (created > 0) {
|
|
301
|
+
await deps.onTasksCreated().catch((err) => {
|
|
302
|
+
logger.warn(`TeamAuto: auto-assign trigger failed: ${String(err)}`);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
logger.info(`TeamAuto: sweep ${repo.id} -> ${repo.lastSweepSummary}`);
|
|
306
|
+
return repo.lastSweepSummary ?? "sweep complete";
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
310
|
+
// Transient failures (network blips, restart-interrupted sweeps) used to
|
|
311
|
+
// pause a repo FOREVER - teamclaw sat auto-paused 15h on one "fetch
|
|
312
|
+
// failed". Auto-pauses are cooldowns now: the timer retries after the
|
|
313
|
+
// backoff below, and a success clears the state in the block above.
|
|
314
|
+
repo.sweepFailures = (repo.sweepFailures ?? 0) + 1;
|
|
315
|
+
repo.lastSweepErrorAt = Date.now();
|
|
316
|
+
repo.pausedReason = `sweep failed: ${message}`;
|
|
317
|
+
recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: `sweep failed (auto-retry in ~${sweepBackoffMinutes(repo.sweepFailures)}min): ${message}` });
|
|
318
|
+
await saveTeamAutoStore(s).catch(() => { });
|
|
319
|
+
logger.warn(`TeamAuto: sweep failed for ${repo.id}: ${message}`);
|
|
320
|
+
return `error: ${message}`;
|
|
321
|
+
}
|
|
322
|
+
finally {
|
|
323
|
+
sweeping.delete(repo.id);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function enqueueCandidate(repo, candidate) {
|
|
327
|
+
let createdId;
|
|
328
|
+
let deadLettered = false;
|
|
329
|
+
deps.updateTeamState((state) => {
|
|
330
|
+
// Idempotency: an active task for the same object AND kind wins. The
|
|
331
|
+
// key rides in the description (TaskInfo has no dedicated field) and
|
|
332
|
+
// must be a distinct marked line - titles contain human text that never
|
|
333
|
+
// matches the raw key (that was the pre-fix bug). Kind-scoping matters:
|
|
334
|
+
// object-level keys starved takeOwnership (review always enqueued first).
|
|
335
|
+
const dedupMarker = idempotencyMarker(candidate);
|
|
336
|
+
const duplicate = Object.values(state.tasks).find((t) => t.description.includes(dedupMarker) && t.status !== "completed" && t.status !== "failed");
|
|
337
|
+
if (duplicate) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
// Dead-letter: task history doubles as the attempt log. The dedup above
|
|
341
|
+
// only blocks ACTIVE tasks, so a failed candidate would be re-enqueued
|
|
342
|
+
// every sweep forever (observed: issue #12 re-candidated 4 sweeps in a
|
|
343
|
+
// row, burning daily budget on churn). Cap the retries instead - hard
|
|
344
|
+
// failures fast (3), environmental/transient failures get a wider
|
|
345
|
+
// allowance (6 total) so rate limits or workspace races do not kill
|
|
346
|
+
// work that would succeed on a quieter sweep.
|
|
347
|
+
if (hardAttemptCount(state, candidate) >= TEAMAUTO_DEAD_LETTER_ATTEMPTS
|
|
348
|
+
|| failedAttemptCount(state, candidate) >= TEAMAUTO_DEAD_LETTER_TRANSIENT_ATTEMPTS) {
|
|
349
|
+
deadLettered = true;
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const task = {
|
|
353
|
+
id: newId("teamauto"),
|
|
354
|
+
title: `[${candidate.kind}] ${candidate.title}`,
|
|
355
|
+
description: [
|
|
356
|
+
`TeamAuto autonomous work for ${candidate.repoId}.`,
|
|
357
|
+
dedupMarker,
|
|
358
|
+
`Local checkout: projects/${teamAutoProjectDir(candidate.repoId)} in the team workspace.`,
|
|
359
|
+
...(candidate.writeMode === "read-only" || (!candidate.writeMode && candidate.kind !== "takeOwnership")
|
|
360
|
+
? [
|
|
361
|
+
"READ-ONLY TASK (collaboration contract): You must NOT modify, create, or delete any files - your reply IS the deliverable.",
|
|
362
|
+
"Base your review on the committed HEAD state (use git show/git log); uncommitted working-tree changes belong to a concurrent write task and must be ignored.",
|
|
363
|
+
]
|
|
364
|
+
: [
|
|
365
|
+
"WRITE TASK (collaboration contract): you are executing in a dedicated git worktree; deliver your changes via commits there - the controller turns your branch into a PR.",
|
|
366
|
+
]),
|
|
367
|
+
renderNormsBlock(repo.norms, repo.id),
|
|
368
|
+
"---",
|
|
369
|
+
candidate.context,
|
|
370
|
+
"---",
|
|
371
|
+
`When finished, your reply becomes the GitHub ${candidate.kind === "prReview" || candidate.kind === "issueReview" ? "review comment" : "deliverable"}. ` +
|
|
372
|
+
`If the material is ambiguous or blocked on a human decision, request clarification instead of guessing.`,
|
|
373
|
+
MARKER_FOOTER(candidate.role),
|
|
374
|
+
].join("\n"),
|
|
375
|
+
status: "pending",
|
|
376
|
+
priority: candidate.kind === "takeOwnership" ? "high" : "medium",
|
|
377
|
+
assignedRole: candidate.role,
|
|
378
|
+
writeMode: candidate.writeMode === "write" ? "write" : "read-only",
|
|
379
|
+
createdBy: "teamauto",
|
|
380
|
+
projectDir: teamAutoProjectDir(candidate.repoId),
|
|
381
|
+
createdAt: Date.now(),
|
|
382
|
+
updatedAt: Date.now(),
|
|
383
|
+
};
|
|
384
|
+
state.tasks[task.id] = task;
|
|
385
|
+
createdId = task.id;
|
|
386
|
+
});
|
|
387
|
+
return deadLettered ? "dead-lettered" : createdId;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Agent-facing manual proposal: inject a candidate directly (bypassing the
|
|
391
|
+
* GitHub-object sweep) while reusing the full pipeline - idempotency dedup,
|
|
392
|
+
* dead-letter caps, budget accounting, norms blocks, worktree checkout.
|
|
393
|
+
* No writeback is registered (there is no GitHub object to write back to);
|
|
394
|
+
* the result stays in the task system, visible via teamclaw_list_tasks.
|
|
395
|
+
*/
|
|
396
|
+
async function proposeManual(repoId, input) {
|
|
397
|
+
const s = await ensureStore();
|
|
398
|
+
const repo = s.repos.find((r) => r.id === repoId);
|
|
399
|
+
if (!repo) {
|
|
400
|
+
throw new Error(`${repoId} not bound`);
|
|
401
|
+
}
|
|
402
|
+
const kind = input.kind === "takeOwnership" || input.kind === "issueReview" || input.kind === "prReview" || input.kind === "fullReview" ? input.kind : "issueReview";
|
|
403
|
+
const candidate = {
|
|
404
|
+
repoId,
|
|
405
|
+
key: `${repoId}#manual-${Date.now()}`,
|
|
406
|
+
kind,
|
|
407
|
+
number: 0,
|
|
408
|
+
role: (input.role || (kind === "takeOwnership" ? "developer" : "architect")),
|
|
409
|
+
writeMode: input.writeMode ?? (kind === "takeOwnership" ? "write" : "read-only"),
|
|
410
|
+
title: input.title.slice(0, 120),
|
|
411
|
+
reason: "manual proposal from agent tool",
|
|
412
|
+
context: input.context,
|
|
413
|
+
};
|
|
414
|
+
const taskId = enqueueCandidate(repo, candidate);
|
|
415
|
+
if (taskId === "dead-lettered") {
|
|
416
|
+
throw new Error(`proposal dead-lettered (${kind} exceeded failure caps for this repo)`);
|
|
417
|
+
}
|
|
418
|
+
if (taskId) {
|
|
419
|
+
recordActivity(s, { at: Date.now(), repoId, kind: "task", text: `manual ${kind}: ${candidate.title}` });
|
|
420
|
+
await saveTeamAutoStore(s);
|
|
421
|
+
return taskId;
|
|
422
|
+
}
|
|
423
|
+
return "duplicate-active-skipped";
|
|
424
|
+
}
|
|
425
|
+
// ---------- write-back reconciler ----------
|
|
426
|
+
async function reconcileWritebacks() {
|
|
427
|
+
const s = await ensureStore();
|
|
428
|
+
const state0 = deps.getTeamState();
|
|
429
|
+
// Dead letters: entries whose task is gone or failed without a result can
|
|
430
|
+
// never deliver - drop them instead of accumulating forever.
|
|
431
|
+
if (state0) {
|
|
432
|
+
const before = s.writebacks.length;
|
|
433
|
+
s.writebacks = s.writebacks.filter((w) => {
|
|
434
|
+
if (w.doneAt) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
const t = state0.tasks[w.taskId];
|
|
438
|
+
const dead = !t || (t.status === "failed" && !t.result);
|
|
439
|
+
if (dead) {
|
|
440
|
+
logger.warn(`TeamAuto: dropping dead write-back ${w.taskId} (${t ? "task failed without result" : "task missing"})`);
|
|
441
|
+
}
|
|
442
|
+
return !dead;
|
|
443
|
+
});
|
|
444
|
+
if (s.writebacks.length !== before) {
|
|
445
|
+
await saveTeamAutoStore(s);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
// Self-heal: an entry whose task later COMPLETED with a result (e.g. the
|
|
449
|
+
// completion gate rejected an early submission, then a retry succeeded)
|
|
450
|
+
// must be retried - a sticky error here would silently drop delivery.
|
|
451
|
+
for (const w of s.writebacks) {
|
|
452
|
+
if (w.error && !w.doneAt && state0) {
|
|
453
|
+
const t = state0.tasks[w.taskId];
|
|
454
|
+
if (t && t.status === "completed" && t.result) {
|
|
455
|
+
w.error = null;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
const pending = s.writebacks.filter((w) => !w.doneAt && !w.error);
|
|
460
|
+
if (!pending.length) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const state = deps.getTeamState();
|
|
464
|
+
if (!state) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
for (const entry of pending) {
|
|
468
|
+
const task = state.tasks[entry.taskId];
|
|
469
|
+
if (!task || (task.status !== "completed" && task.status !== "failed")) {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
const repo = s.repos.find((r) => r.id === entry.repoId);
|
|
473
|
+
const [owner, name] = entry.repoId.split("/");
|
|
474
|
+
try {
|
|
475
|
+
if (task.status === "failed" || !task.result) {
|
|
476
|
+
entry.error = task.status === "failed" ? (task.error ?? "task failed") : "task completed without a textual result";
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
const role = (task.assignedRole ?? "qa");
|
|
480
|
+
let body = `${task.result.trim()}\n${MARKER_FOOTER(role)}`;
|
|
481
|
+
let writebackDone = false;
|
|
482
|
+
// WRITE TASKS (collaboration contract): commit the task worktree,
|
|
483
|
+
// push its branch, open a PR, and attach the link to the reply.
|
|
484
|
+
const repoId = entry.repoId;
|
|
485
|
+
const isTeamAutoWrite = task.writeMode === "write" && task.projectDir?.includes("__task-");
|
|
486
|
+
if (isTeamAutoWrite) {
|
|
487
|
+
try {
|
|
488
|
+
const info = await client.getRepoInfo(repoId.split("/")[0], repoId.split("/")[1]);
|
|
489
|
+
const wtDir = await sync.ensureTaskWorktree(repoId, task.id);
|
|
490
|
+
const committed = await sync.commitAll(wtDir, `[teamclaw:${role}] ${task.title.replace(/^\[[^\]]+\]\s*/, "")}`.slice(0, 200), `teamclaw-${role}`, `teamclaw-${role}@users.noreply.github.com`);
|
|
491
|
+
const branch = `teamclaw/task-${task.id.replace(/[^\w-]/g, "")}`;
|
|
492
|
+
// Workers often commit themselves inside the worktree - deliver
|
|
493
|
+
// whenever the branch carries commits beyond base, not only when
|
|
494
|
+
// commitAll just added new ones.
|
|
495
|
+
const deliverable = committed || (await sync.branchHasCommits(wtDir, info.defaultBranch));
|
|
496
|
+
if (deliverable) {
|
|
497
|
+
await sync.pushBranch(repoId, wtDir, info.cloneUrl, branch);
|
|
498
|
+
const pr = await client.createPullRequest(repoId.split("/")[0], repoId.split("/")[1], branch, info.defaultBranch, `[teamclaw:${role}] ${task.title.replace(/^\[[^\]]+\]\s*/, "")}`.slice(0, 120), `${task.result.trim()}\n${MARKER_FOOTER(role)}`);
|
|
499
|
+
entry.prUrl = pr.url;
|
|
500
|
+
body = `${body}\n\nDelivered as PR: ${pr.url}`;
|
|
501
|
+
recordActivity(s, { at: Date.now(), repoId, kind: "writeback", text: `PR opened: ${pr.url}` });
|
|
502
|
+
}
|
|
503
|
+
await sync.removeTaskWorktree(repoId, task.id);
|
|
504
|
+
}
|
|
505
|
+
catch (prErr) {
|
|
506
|
+
entry.error = `worktree PR delivery failed: ${prErr instanceof Error ? prErr.message : String(prErr)}`;
|
|
507
|
+
logger.warn(`TeamAuto: ${entry.error} (${task.id})`);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (entry.action === "issueComment" && entry.targetId) {
|
|
511
|
+
await client.postIssueComment(owner, name, entry.targetId, body);
|
|
512
|
+
entry.doneAt = Date.now();
|
|
513
|
+
writebackDone = true;
|
|
514
|
+
// Our own comment bumps the issue's updatedAt, which the scanner
|
|
515
|
+
// treats as new activity - advance the seen cursor so we do not
|
|
516
|
+
// re-trigger a review of an object we just replied to. External
|
|
517
|
+
// edits (updatedAt > now) still re-arm the candidate.
|
|
518
|
+
const issueRepo = s.repos.find((r) => r.id === entry.repoId);
|
|
519
|
+
if (issueRepo) {
|
|
520
|
+
issueRepo.cursors.seen[`${entry.repoId}#issue-${entry.targetId}`] = Date.now();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
else if (entry.action === "prComment" && entry.targetId) {
|
|
524
|
+
await client.postPullReviewComment(owner, name, entry.targetId, body);
|
|
525
|
+
entry.doneAt = Date.now();
|
|
526
|
+
writebackDone = true;
|
|
527
|
+
const prRepo = s.repos.find((r) => r.id === entry.repoId);
|
|
528
|
+
if (prRepo) {
|
|
529
|
+
prRepo.cursors.seen[`${entry.repoId}#pr-${entry.targetId}`] = Date.now();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else if (entry.action === "createIssue") {
|
|
533
|
+
// Joint full review: same-cycle sections land in ONE umbrella issue
|
|
534
|
+
// (first completed section creates it, the rest post as comments).
|
|
535
|
+
const sectionBody = `### ${role} section\n\n${task.result.trim()}\n${MARKER_FOOTER(role)}`;
|
|
536
|
+
if (entry.cycleKey) {
|
|
537
|
+
const peers = s.writebacks.filter((w) => w.repoId === entry.repoId && w.cycleKey === entry.cycleKey && w.taskId !== entry.taskId && w.targetId != null && w.doneAt);
|
|
538
|
+
const umbrella = peers[0];
|
|
539
|
+
if (umbrella && umbrella.targetId != null) {
|
|
540
|
+
await client.postIssueComment(owner, name, umbrella.targetId, sectionBody);
|
|
541
|
+
entry.targetId = umbrella.targetId;
|
|
542
|
+
entry.doneAt = Date.now();
|
|
543
|
+
writebackDone = true;
|
|
544
|
+
}
|
|
545
|
+
else if (entry.targetId == null) {
|
|
546
|
+
const number = await client.createIssue(owner, name, `[teamclaw:fullreview] Joint full review - ${entry.repoId}`, `Joint multi-role full review (cycle ${entry.cycleKey}). Each role appends its section as a comment below.\n\n${sectionBody}`, ["teamclaw", "teamclaw:fullreview"]);
|
|
547
|
+
entry.targetId = number;
|
|
548
|
+
entry.doneAt = Date.now();
|
|
549
|
+
writebackDone = true;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
const number = await client.createIssue(owner, name, `[teamclaw:${role}] ${task.title.replace(/^\[[^\]]+\]\s*/, "")}`, sectionBody, ["teamclaw"]);
|
|
554
|
+
entry.targetId = number;
|
|
555
|
+
entry.doneAt = Date.now();
|
|
556
|
+
writebackDone = true;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
entry.error = `unsupported action ${entry.action}`;
|
|
561
|
+
}
|
|
562
|
+
if (writebackDone) {
|
|
563
|
+
recordActivity(s, { at: Date.now(), repoId: entry.repoId, kind: "writeback", text: `${entry.action} #${entry.targetId ?? "-"} ok (${task.id})` });
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
catch (err) {
|
|
568
|
+
entry.error = err instanceof Error ? err.message : String(err);
|
|
569
|
+
logger.warn(`TeamAuto: writeback failed (${entry.repoId} ${entry.action} #${entry.targetId ?? "-"}): ${entry.error}`);
|
|
570
|
+
}
|
|
571
|
+
void repo;
|
|
572
|
+
}
|
|
573
|
+
s.writebacks = s.writebacks.filter((w) => !w.doneAt).slice(-500);
|
|
574
|
+
await saveTeamAutoStore(s);
|
|
575
|
+
}
|
|
576
|
+
// Register the write-back intent when a task lands in the task store.
|
|
577
|
+
function registerWriteback(taskId, action, repoId, targetId, cycleKey) {
|
|
578
|
+
void ensureStore().then((s) => {
|
|
579
|
+
if (s.writebacks.some((w) => w.taskId === taskId)) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
s.writebacks.push({ taskId, action, repoId, targetId, doneAt: null, prUrl: null, error: null, cycleKey });
|
|
583
|
+
void saveTeamAutoStore(s);
|
|
584
|
+
}).catch(() => { });
|
|
585
|
+
}
|
|
586
|
+
// ---------- scheduling loop ----------
|
|
587
|
+
function scheduleRepo(repo) {
|
|
588
|
+
const previous = timers.get(repo.id);
|
|
589
|
+
if (previous) {
|
|
590
|
+
clearTimeout(previous);
|
|
591
|
+
timers.delete(repo.id);
|
|
592
|
+
}
|
|
593
|
+
if (!repo.enabled) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
let delay;
|
|
597
|
+
try {
|
|
598
|
+
delay = nextFireMs(repo.schedule);
|
|
599
|
+
}
|
|
600
|
+
catch (err) {
|
|
601
|
+
logger.error(`TeamAuto: ${repo.id} has an unsupported schedule "${repo.schedule}" and will not be scheduled: ${err instanceof Error ? err.message : String(err)}`);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
const timer = setTimeout(() => {
|
|
605
|
+
void (async () => {
|
|
606
|
+
try {
|
|
607
|
+
const s = await ensureStore();
|
|
608
|
+
const fresh = s.repos.find((r) => r.id === repo.id);
|
|
609
|
+
const retryDue = fresh
|
|
610
|
+
? isAutoPause(fresh.pausedReason) && Date.now() >= sweepRetryDueAt(fresh.sweepFailures ?? 1, fresh.lastSweepErrorAt ?? 0)
|
|
611
|
+
: false;
|
|
612
|
+
if (fresh?.enabled && (fresh.pausedReason === null || retryDue)) {
|
|
613
|
+
await runSweep(fresh, false);
|
|
614
|
+
}
|
|
615
|
+
if (fresh?.enabled) {
|
|
616
|
+
scheduleRepo(fresh);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
catch (err) {
|
|
620
|
+
// The timer chain must survive any single tick failure. Before this
|
|
621
|
+
// guard, a rejected ensureStore() (corrupt store file, IO error)
|
|
622
|
+
// unhandled-rejected through `void`, scheduleRepo(fresh) never ran,
|
|
623
|
+
// and the repo's scheduling chain died silently until a gateway
|
|
624
|
+
// restart. Re-arm from the last known config; updateRepo re-arms on
|
|
625
|
+
// config change anyway, so a stale schedule here is bounded.
|
|
626
|
+
logger.warn(`TeamAuto: sweep tick failed for ${repo.id}, re-arming timer: ${err instanceof Error ? err.message : String(err)}`);
|
|
627
|
+
try {
|
|
628
|
+
scheduleRepo(repo);
|
|
629
|
+
}
|
|
630
|
+
catch {
|
|
631
|
+
// scheduleRepo only throws on programmer error; a dead chain here
|
|
632
|
+
// is still recoverable by restart (start() rebuilds all timers).
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
})();
|
|
636
|
+
}, delay);
|
|
637
|
+
timer.unref?.();
|
|
638
|
+
timers.set(repo.id, timer);
|
|
639
|
+
}
|
|
640
|
+
async function start() {
|
|
641
|
+
if (running) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
running = true;
|
|
645
|
+
const s = await ensureStore();
|
|
646
|
+
for (const repo of s.repos) {
|
|
647
|
+
scheduleRepo(repo);
|
|
648
|
+
}
|
|
649
|
+
if (s.repos.length) {
|
|
650
|
+
logger.info(`TeamAuto: scheduler started for ${s.repos.length} repo(s)`);
|
|
651
|
+
}
|
|
652
|
+
writebackTimer = setInterval(() => {
|
|
653
|
+
void reconcileWritebacks();
|
|
654
|
+
}, 20_000);
|
|
655
|
+
writebackTimer.unref?.();
|
|
656
|
+
}
|
|
657
|
+
async function stop() {
|
|
658
|
+
running = false;
|
|
659
|
+
for (const timer of timers.values()) {
|
|
660
|
+
clearTimeout(timer);
|
|
661
|
+
}
|
|
662
|
+
timers.clear();
|
|
663
|
+
if (writebackTimer) {
|
|
664
|
+
clearInterval(writebackTimer);
|
|
665
|
+
writebackTimer = null;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
async function getStatus() {
|
|
669
|
+
const s = await ensureStore();
|
|
670
|
+
return { repos: s.repos, budget: s.budget, activity: s.activity ?? [] };
|
|
671
|
+
}
|
|
672
|
+
async function getActivity() {
|
|
673
|
+
const s = await ensureStore();
|
|
674
|
+
return (s.activity ?? []).slice().reverse();
|
|
675
|
+
}
|
|
676
|
+
return { addRepo, removeRepo, setRepoEnabled, updateRepo, runSweepNow, registerWriteback, reconcileWritebacks, start, stop, getStatus, getActivity, ensureWriteWorktree, removeWriteWorktree, proposeManual };
|
|
677
|
+
/** Collaboration contract: dispatch asks for a task-scoped worktree dir (rel to projects root). */
|
|
678
|
+
async function ensureWriteWorktree(repoId, taskId) {
|
|
679
|
+
const wtAbs = await sync.ensureTaskWorktree(repoId, taskId);
|
|
680
|
+
void wtAbs;
|
|
681
|
+
// Rel dir INCLUDING the teamauto/ level (basename dropped it and pointed
|
|
682
|
+
// workers outside the git worktree).
|
|
683
|
+
return sync.taskWorktreeRelDir(repoId, taskId);
|
|
684
|
+
}
|
|
685
|
+
async function removeWriteWorktree(repoId, taskId) {
|
|
686
|
+
await sync.removeTaskWorktree(repoId, taskId);
|
|
687
|
+
}
|
|
688
|
+
}
|