@bakers-build/conductor 0.14.1-next.7 → 0.14.1-next.9
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.
|
@@ -56,6 +56,8 @@ export declare class Conductor {
|
|
|
56
56
|
private readonly inboxAddons;
|
|
57
57
|
/** The per-item work each tick enqueues. */
|
|
58
58
|
private readonly queue;
|
|
59
|
+
/** Whether the executor's leftover-workspace sweep has finished this process. */
|
|
60
|
+
private workspaceSweepDone;
|
|
59
61
|
/** The local MCP server for addon tools; only the serve process runs one. */
|
|
60
62
|
private toolServer;
|
|
61
63
|
/** Where runs execute, chosen per ticket. */
|
|
@@ -219,6 +219,8 @@ export class Conductor {
|
|
|
219
219
|
inboxAddons;
|
|
220
220
|
/** The per-item work each tick enqueues. */
|
|
221
221
|
queue;
|
|
222
|
+
/** Whether the executor's leftover-workspace sweep has finished this process. */
|
|
223
|
+
workspaceSweepDone = false;
|
|
222
224
|
/** The local MCP server for addon tools; only the serve process runs one. */
|
|
223
225
|
toolServer;
|
|
224
226
|
/** Where runs execute, chosen per ticket. */
|
|
@@ -1071,6 +1073,25 @@ export class Conductor {
|
|
|
1071
1073
|
run: () => this.reapOne(t),
|
|
1072
1074
|
});
|
|
1073
1075
|
}
|
|
1076
|
+
const sweep = this.executor.sweepWorkspaces?.bind(this.executor);
|
|
1077
|
+
if (sweep &&
|
|
1078
|
+
!this.workspaceSweepDone &&
|
|
1079
|
+
this.executor.capabilities().persistent) {
|
|
1080
|
+
this.queue.enqueue({
|
|
1081
|
+
key: 'reap:workspace-sweep',
|
|
1082
|
+
lane: 'reap:workspace-sweep',
|
|
1083
|
+
run: async () => {
|
|
1084
|
+
try {
|
|
1085
|
+
this.workspaceSweepDone = await sweep();
|
|
1086
|
+
}
|
|
1087
|
+
catch (err) {
|
|
1088
|
+
// A sweep that throws would throw again: give up for this process.
|
|
1089
|
+
this.workspaceSweepDone = true;
|
|
1090
|
+
this.logger.warn({ err: String(err) }, 'workspace sweep failed');
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1074
1095
|
}
|
|
1075
1096
|
/**
|
|
1076
1097
|
* Record the merge request's size on a done ticket while its worktree still
|
|
@@ -1209,6 +1230,22 @@ export class Conductor {
|
|
|
1209
1230
|
return; // leave cleaned_up=0 → the next reconciliation retries.
|
|
1210
1231
|
}
|
|
1211
1232
|
}
|
|
1233
|
+
// The worktree is gone; close the branch workspace the executor opened
|
|
1234
|
+
// for it, which another workspace addon's teardown leaves behind.
|
|
1235
|
+
if (outcome !== 'unverified' &&
|
|
1236
|
+
this.executor.closeWorkspace &&
|
|
1237
|
+
this.executor.capabilities().persistent) {
|
|
1238
|
+
try {
|
|
1239
|
+
const closed = await this.executor.closeWorkspace(t.branchName, t.worktreePath || undefined);
|
|
1240
|
+
if (!closed) {
|
|
1241
|
+
this.logger.warn({ ticket: t.ticketUuid, branch: t.branchName }, 'branch workspace not safe to close — retrying next reap');
|
|
1242
|
+
return; // leave cleaned_up=0 → the next reconciliation retries.
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
catch (err) {
|
|
1246
|
+
this.logger.warn({ ticket: t.ticketUuid, branch: t.branchName, err: String(err) }, 'branch workspace close failed');
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1212
1249
|
if (outcome === 'already_absent') {
|
|
1213
1250
|
// BB-293: the worktree was gone before we got here. That is a
|
|
1214
1251
|
// FINISHED teardown, so it is recorded rather than swallowed and
|
|
@@ -1412,7 +1449,9 @@ export class Conductor {
|
|
|
1412
1449
|
}
|
|
1413
1450
|
/** `at.worktree` is set once the workspace exists, so a failure can signal it. */
|
|
1414
1451
|
async dispatch(run, at = {}) {
|
|
1415
|
-
const
|
|
1452
|
+
const fetched = await this.remote.getTicket(run.ticketUuid);
|
|
1453
|
+
// JSON:API can return the pre-transition state; the run knows the state it was started for.
|
|
1454
|
+
const t = { ...fetched, state: run.stateAtStart || fetched.state };
|
|
1416
1455
|
// Resolve the ticket alias and machine defaults, or the project selection hook.
|
|
1417
1456
|
// Persist the package id below so finalize can choose its transcript parser.
|
|
1418
1457
|
// The project's select_agent wins; then the machine's agents select.
|
|
@@ -18,6 +18,8 @@ export const SITE_TOOLS = [
|
|
|
18
18
|
'bakers_label_list',
|
|
19
19
|
'bakers_project_read',
|
|
20
20
|
'bakers_user_read',
|
|
21
|
+
'bakers_user_search',
|
|
22
|
+
'bakers_team_members',
|
|
21
23
|
'bakers_conductor_list',
|
|
22
24
|
];
|
|
23
25
|
/** The site tools that change a ticket; a successful call signals `bakers ui`. */
|
|
@@ -173,4 +173,19 @@ export interface BbExecutor {
|
|
|
173
173
|
* non-persistent executors.
|
|
174
174
|
*/
|
|
175
175
|
cleanupRun(branch: string, runId: number): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Close the branch's hosted workspace once the reaper has torn its worktree
|
|
178
|
+
* down (`removed` or `already_absent`), whichever workspace addon did it.
|
|
179
|
+
* Optional; called only for a persistent executor. `false` = not safe yet
|
|
180
|
+
* (e.g. focused with nowhere to move focus): the ticket stays on the reap
|
|
181
|
+
* list and the next reap retries. A workspace that holds anything besides
|
|
182
|
+
* bakers terminals is kept, reported, and counts as `true`.
|
|
183
|
+
*/
|
|
184
|
+
closeWorkspace?(branch: string, worktreePath?: string): Promise<boolean>;
|
|
185
|
+
/**
|
|
186
|
+
* Close workspaces left over by earlier versions, whose tickets are already
|
|
187
|
+
* cleaned up. Optional; the reaper runs it once per process for a persistent
|
|
188
|
+
* executor and again on later passes while it returns `false`.
|
|
189
|
+
*/
|
|
190
|
+
sweepWorkspaces?(): Promise<boolean>;
|
|
176
191
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/conductor",
|
|
3
|
-
"version": "0.14.1-next.
|
|
3
|
+
"version": "0.14.1-next.9",
|
|
4
4
|
"description": "bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@dropsh/plugin-jsonapi-schema": "^0.8.2",
|
|
34
34
|
"@dropsh/plugin-oauth2": "^0.8.2",
|
|
35
|
-
"@bakers-build/core": "^0.14.1-next.
|
|
36
|
-
"@bakers-build/message": "^0.14.1-next.
|
|
35
|
+
"@bakers-build/core": "^0.14.1-next.9",
|
|
36
|
+
"@bakers-build/message": "^0.14.1-next.9",
|
|
37
37
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
38
38
|
"commander": "^12.1.0",
|
|
39
39
|
"dropsh": "^0.8.2"
|
|
40
40
|
},
|
|
41
41
|
"bakersBuild": {
|
|
42
|
-
"commit": "
|
|
42
|
+
"commit": "612efe0faf4279433f176f450b932f00f6fdb581",
|
|
43
43
|
"channel": "next"
|
|
44
44
|
}
|
|
45
45
|
}
|