@wildo-ai/dev-companion 1.1.15 → 1.1.16
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/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +165 -5
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +239 -8
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +2 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +2 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
- package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts +68 -0
- package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts.map +1 -0
- package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js +198 -0
- package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js.map +1 -0
- package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts +138 -0
- package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts.map +1 -0
- package/dist/esm/claude-cli/models/workspace-path-claims.models.js +204 -0
- package/dist/esm/claude-cli/models/workspace-path-claims.models.js.map +1 -0
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +20 -0
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +27 -12
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +155 -3
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +791 -151
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +7 -1
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +1 -1
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts +13 -0
- package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js +98 -16
- package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js.map +1 -1
- package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts +21 -1
- package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
- package/dist/esm/expert-personas/services/expert-persona.companion.service.js +35 -3
- package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts +62 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js +62 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts +62 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js +62 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js.map +1 -0
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.js +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
- package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts +23 -0
- package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/carried-verification-failure.models.js +14 -0
- package/dist/esm/meta-workflows/models/carried-verification-failure.models.js.map +1 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +12 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +99 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +5 -0
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +22 -1
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +67 -20
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +344 -76
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +9 -0
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +47 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +98 -9
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +38 -2
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +176 -22
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +45 -0
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +74 -0
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +9 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +64 -5
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +139 -14
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts +19 -1
- package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/website-demo-facts.models.js +7 -5
- package/dist/esm/meta-workflows/services/website-demo-facts.models.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts +2 -0
- package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js +3 -1
- package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js.map +1 -1
- package/package.json +17 -17
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { writeScopeMayReachReadScope, } from './isolated-recheck-interference.models.js';
|
|
2
|
+
/**
|
|
3
|
+
* PATH-SCOPED holds on the application's working tree (#4020): what lets a concurrent coding run be ADMITTED while a
|
|
4
|
+
* long holder of the whole-tree workspace-mutation lock works on paths its declared scope does not meet.
|
|
5
|
+
*
|
|
6
|
+
* ## What was too wide
|
|
7
|
+
*
|
|
8
|
+
* The workspace-mutation lock (`withDedicatedFileLock` on `.wildo-saas/state/workspace-mutation.lock`) is held for
|
|
9
|
+
* minutes by a generation step (its whole window) and by an isolated re-check (its checks). A concurrent coding run took
|
|
10
|
+
* the same lock before its baseline, to commit pending playbook runs, whether or not one was pending, so it waited for
|
|
11
|
+
* every such holder. Measured on reference run 44052185141 (2026-11-17): dispatch-wait p95 76.5 s, 218 minutes summed;
|
|
12
|
+
* the logo step alone (13:22:25-13:28:19) kept 8 prepared runs waiting 155-375 s.
|
|
13
|
+
*
|
|
14
|
+
* ## What changed, and what did not
|
|
15
|
+
*
|
|
16
|
+
* The holders keep the lock exactly as before: no commit, no re-check, no single-flight run and no second step enters a
|
|
17
|
+
* step's window, and no commit enters a re-check. What changed is the ADMISSION only. A holder that knows which paths it
|
|
18
|
+
* writes or reads opens a CLAIM naming them, inside the lock it holds; a concurrent run with nothing to commit before its
|
|
19
|
+
* baseline then waits for the claims its declared mutation scope meets, not for the lock. A holder that opens no claim (a
|
|
20
|
+
* step declaring nothing, a single-flight run, a commit, a CLI writer in another process) is waited for exactly as before.
|
|
21
|
+
*
|
|
22
|
+
* A run admitted this way joins the holder's window the way a wave's run already joins a step the wave runs inline
|
|
23
|
+
* (#1805 review N2): the step reads its window as SHARED and claims only what lies under its own directories (#2240), and
|
|
24
|
+
* its closing checkpoint commits the tree as it stands (#3204). A step whose writes have not all been traced claims
|
|
25
|
+
* nothing, so it is waited for as before. The run's scope is a prediction (#1268 lets a run write anywhere);
|
|
26
|
+
* interference between writers sharing the tree is detected and repaired, not prevented (#1528).
|
|
27
|
+
*
|
|
28
|
+
* ## The three kinds
|
|
29
|
+
*
|
|
30
|
+
* - {@link WorkspacePathClaimKind.STEP_WRITE}: what a generation step may write, for its window: its write scope plus
|
|
31
|
+
* every side write traced for it (`GENERATION_STEP_CLAIM_BASIS`); a step not traced claims nothing.
|
|
32
|
+
* - {@link WorkspacePathClaimKind.RECHECK_READ}: an isolated re-check's read scope while its checks run; the whole
|
|
33
|
+
* application at a wave's end. A run whose scope may reach it waits, so the re-check still runs "alone against what it
|
|
34
|
+
* reads" (#3220, #3998).
|
|
35
|
+
* - {@link WorkspacePathClaimKind.ADMISSION_WRITE}: a concurrent coding run from the first instant of its admission
|
|
36
|
+
* (opened before any wait) until it is a registered live run, so a re-check opening meanwhile sees it.
|
|
37
|
+
*
|
|
38
|
+
* ## In-process, on purpose
|
|
39
|
+
*
|
|
40
|
+
* Every claim holder and every waiter lives in the companion process. STEP_WRITE and RECHECK_READ claims are opened and
|
|
41
|
+
* released INSIDE the file lock their holder holds, so "one of them is open" means "this process holds the lock in a
|
|
42
|
+
* section whose paths are named". The cross-process half of exclusion (a CLI writer, another companion) is still the file
|
|
43
|
+
* lock. JavaScript runs one task at a time, so a claim CHECKED and OPENED with no `await` between the two is atomic
|
|
44
|
+
* against every other holder; callers keep it that way.
|
|
45
|
+
*/
|
|
46
|
+
export var WorkspacePathClaimKind;
|
|
47
|
+
(function (WorkspacePathClaimKind) {
|
|
48
|
+
/** A generation step writing its own directories. */
|
|
49
|
+
WorkspacePathClaimKind["STEP_WRITE"] = "STEP_WRITE";
|
|
50
|
+
/** An isolated re-check reading a closure of workspace packages, or the whole application. */
|
|
51
|
+
WorkspacePathClaimKind["RECHECK_READ"] = "RECHECK_READ";
|
|
52
|
+
/** A concurrent coding run being admitted, until it is registered as a live run. */
|
|
53
|
+
WorkspacePathClaimKind["ADMISSION_WRITE"] = "ADMISSION_WRITE";
|
|
54
|
+
})(WorkspacePathClaimKind || (WorkspacePathClaimKind = {}));
|
|
55
|
+
/** An application-relative path or prefix, without a leading `./` or `/`. */
|
|
56
|
+
function normalizePrefix(prefix) {
|
|
57
|
+
return prefix.replace(/\\/gu, '/').replace(/^(?:\.\/|\/)+/u, '');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The roots a generation step claims for its window (#4020), normalized, or `undefined` when it claims nothing: an empty
|
|
61
|
+
* claim, or one naming the root itself. Directories (with their trailing slash) and exact files alike: the overlap test
|
|
62
|
+
* reads both as string prefixes. The claim must cover every write, side effects included (the logo step's brand
|
|
63
|
+
* propagation into the frontend, the website and the documentation, for one); the generation-step service declares it.
|
|
64
|
+
*/
|
|
65
|
+
export function generationStepWorkspaceClaimRoots(ownedPathPrefixes) {
|
|
66
|
+
const roots = ownedPathPrefixes.map(normalizePrefix);
|
|
67
|
+
if (roots.length === 0 || roots.some((root) => root === '' || root === '/'))
|
|
68
|
+
return undefined;
|
|
69
|
+
return [...new Set(roots)].sort();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether two sets of write prefixes may name a common path. Raw string prefixes in BOTH directions, so `frontend/src`
|
|
73
|
+
* meets `frontend/src-old/` and `frontend/` meets `frontend/src/x.ts`: over-reporting an overlap costs a wait, missing one
|
|
74
|
+
* lets two writers into one file, so the comparison errs toward overlap. An empty set is UNKNOWN and meets everything.
|
|
75
|
+
*/
|
|
76
|
+
export function writePrefixesOverlap(left, right) {
|
|
77
|
+
if (left.length === 0 || right.length === 0)
|
|
78
|
+
return true;
|
|
79
|
+
const a = left.map(normalizePrefix);
|
|
80
|
+
const b = right.map(normalizePrefix);
|
|
81
|
+
return a.some((x) => b.some((y) => x === '' || y === '' || x.startsWith(y) || y.startsWith(x)));
|
|
82
|
+
}
|
|
83
|
+
function isWriteClaim(claim) {
|
|
84
|
+
return claim.kind === WorkspacePathClaimKind.STEP_WRITE || claim.kind === WorkspacePathClaimKind.ADMISSION_WRITE;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether two claims may not be held at once (#4020). Symmetric. Two writers conflict when their prefixes overlap; a
|
|
88
|
+
* writer and a reader when the writer may write something the reader's checks read ({@link writeScopeMayReachReadScope},
|
|
89
|
+
* the rule the early re-check already applies to live runs, #3998); two readers never do, since neither changes the tree.
|
|
90
|
+
*
|
|
91
|
+
* Two ADMISSIONS never conflict: concurrent coding runs share the tree by decision (#1528), overlapping scopes included,
|
|
92
|
+
* and interference between them is detected and repaired rather than prevented. An admission claim exists only so the
|
|
93
|
+
* holders that DO exclude a run (a step's directories, a re-check's read scope) can see a run that is not live yet.
|
|
94
|
+
*/
|
|
95
|
+
export function workspacePathClaimsConflict(left, right) {
|
|
96
|
+
if (left.kind === WorkspacePathClaimKind.ADMISSION_WRITE && right.kind === WorkspacePathClaimKind.ADMISSION_WRITE)
|
|
97
|
+
return false;
|
|
98
|
+
if (isWriteClaim(left) && isWriteClaim(right))
|
|
99
|
+
return writePrefixesOverlap(left.writePrefixes, right.writePrefixes);
|
|
100
|
+
if (isWriteClaim(left) && right.kind === WorkspacePathClaimKind.RECHECK_READ)
|
|
101
|
+
return writeScopeMayReachReadScope(left.writePrefixes, right.readScope, right.graph);
|
|
102
|
+
if (left.kind === WorkspacePathClaimKind.RECHECK_READ && isWriteClaim(right))
|
|
103
|
+
return writeScopeMayReachReadScope(right.writePrefixes, left.readScope, left.graph);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
/** Whether a path a commit would carry lies under one of these write roots. */
|
|
107
|
+
export function isUnderWriteRoots(path, roots) {
|
|
108
|
+
const normalized = normalizePrefix(path);
|
|
109
|
+
return roots.map(normalizePrefix).some((root) => root !== '' && normalized.startsWith(root));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The open claims of one companion process, and a way to wait for them to change (#4020). Pure bookkeeping: it decides
|
|
113
|
+
* nothing about what a holder may do; the dispatch service asks it, under the rules above.
|
|
114
|
+
*/
|
|
115
|
+
export class WorkspacePathClaims {
|
|
116
|
+
open = new Map();
|
|
117
|
+
sequence = 0;
|
|
118
|
+
changed;
|
|
119
|
+
/** Every open claim, in opening order. */
|
|
120
|
+
list() {
|
|
121
|
+
return [...this.open.values()];
|
|
122
|
+
}
|
|
123
|
+
/** The open claims that conflict with `request`, excluding any owned by `exceptOwnerTaskId`. */
|
|
124
|
+
conflicting(request, exceptOwnerTaskId) {
|
|
125
|
+
return this.list().filter((claim) => claim.ownerTaskId !== exceptOwnerTaskId && workspacePathClaimsConflict(claim, request));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Open a claim, returning its release. The release is idempotent, so a `finally` and an earlier explicit release may
|
|
129
|
+
* both call it. Never checks for conflicts itself: the caller checks with {@link conflicting} and opens with no `await`
|
|
130
|
+
* in between, which is what makes the pair atomic.
|
|
131
|
+
*/
|
|
132
|
+
acquire(request) {
|
|
133
|
+
this.sequence += 1;
|
|
134
|
+
const id = `${request.kind}:${request.ownerTaskId}:${this.sequence}`;
|
|
135
|
+
this.open.set(id, { ...request, id });
|
|
136
|
+
this.signalChange();
|
|
137
|
+
return () => {
|
|
138
|
+
if (this.open.delete(id))
|
|
139
|
+
this.signalChange();
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The roots of every open STEP_WRITE claim, except the steps named: what a commit made WITHOUT the lock (a person's
|
|
144
|
+
* build checkpoint) must not carry while the step is still writing there.
|
|
145
|
+
*/
|
|
146
|
+
openStepWriteRoots(exceptOwnerTaskIds = []) {
|
|
147
|
+
const except = new Set(exceptOwnerTaskIds);
|
|
148
|
+
return [...new Set(this.list()
|
|
149
|
+
.filter((claim) => claim.kind === WorkspacePathClaimKind.STEP_WRITE && !except.has(claim.ownerTaskId))
|
|
150
|
+
.flatMap((claim) => (claim.kind === WorkspacePathClaimKind.STEP_WRITE ? claim.writePrefixes : [])))].sort();
|
|
151
|
+
}
|
|
152
|
+
/** Resolves the next time a claim is opened or released. */
|
|
153
|
+
nextChange() {
|
|
154
|
+
this.changed ??= (() => {
|
|
155
|
+
let resolve;
|
|
156
|
+
const promise = new Promise((done) => { resolve = done; });
|
|
157
|
+
return { promise, resolve };
|
|
158
|
+
})();
|
|
159
|
+
return this.changed.promise;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Wait until `blocking()` answers an empty list, re-asking it at every change and at least every `pollMs`, and at most
|
|
163
|
+
* `timeoutMs` in all. Answers the claims still blocking when the bound is reached, or an empty list. The poll is a
|
|
164
|
+
* backstop for a predicate that also reads state outside this registry (a live-run set); the change signal is what
|
|
165
|
+
* normally wakes it.
|
|
166
|
+
*/
|
|
167
|
+
async waitUntilClear(blocking, options) {
|
|
168
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
169
|
+
for (;;) {
|
|
170
|
+
const now = blocking();
|
|
171
|
+
if (now.length === 0)
|
|
172
|
+
return now;
|
|
173
|
+
const remaining = deadline - Date.now();
|
|
174
|
+
if (remaining <= 0)
|
|
175
|
+
return now;
|
|
176
|
+
let timer;
|
|
177
|
+
await Promise.race([
|
|
178
|
+
this.nextChange(),
|
|
179
|
+
new Promise((resolve) => { timer = setTimeout(resolve, Math.min(remaining, options.pollMs ?? 5_000)); timer.unref?.(); }),
|
|
180
|
+
]);
|
|
181
|
+
if (timer !== undefined)
|
|
182
|
+
clearTimeout(timer);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
signalChange() {
|
|
186
|
+
const changed = this.changed;
|
|
187
|
+
this.changed = undefined;
|
|
188
|
+
changed?.resolve();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/** One line naming who holds the claims a waiter met, for a refusal or a log. */
|
|
192
|
+
export function describeWorkspacePathClaims(claims) {
|
|
193
|
+
return claims.map((claim) => {
|
|
194
|
+
switch (claim.kind) {
|
|
195
|
+
case WorkspacePathClaimKind.STEP_WRITE:
|
|
196
|
+
return `generation step ${claim.ownerTaskRef} writing ${claim.writePrefixes.join(', ')}`;
|
|
197
|
+
case WorkspacePathClaimKind.ADMISSION_WRITE:
|
|
198
|
+
return `coding run ${claim.ownerTaskRef} being admitted to write ${claim.writePrefixes.join(', ')}`;
|
|
199
|
+
case WorkspacePathClaimKind.RECHECK_READ:
|
|
200
|
+
return `isolated re-check of ${claim.ownerTaskRef} reading ${claim.readScope.wholeApplication ? 'the whole application' : [...claim.readScope.packageDirectories].sort().join(', ')}`;
|
|
201
|
+
}
|
|
202
|
+
}).join('; ');
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=workspace-path-claims.models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-path-claims.models.js","sourceRoot":"","sources":["../../../../src/claude-cli/models/workspace-path-claims.models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,GAG5B,MAAM,wCAAwC,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qDAAqD;IACrD,mDAAyB,CAAA;IACzB,8FAA8F;IAC9F,uDAA6B,CAAA;IAC7B,oFAAoF;IACpF,6DAAmC,CAAA;AACrC,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AA0BD,6EAA6E;AAC7E,SAAS,eAAe,CAAC,MAAc;IACrC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,iBAAoC;IACpF,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACrD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9F,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,I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YAAY,YAAY,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3F,KAAK,sBAAsB,CAAC,eAAe;gBACzC,OAAO,cAAc,KAAK,CAAC,YAAY,4BAA4B,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtG,KAAK,sBAAsB,CAAC,YAAY;gBACtC,OAAO,wBAAwB,KAAK,CAAC,YAAY,YAAY,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1L,CAAC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import {\n writeScopeMayReachReadScope,\n type ApplicationWorkspacePackageGraph,\n type VerificationReadScope,\n} from './isolated-recheck-interference.models';\n\n/**\n * PATH-SCOPED holds on the application's working tree (#4020): what lets a concurrent coding run be ADMITTED while a\n * long holder of the whole-tree workspace-mutation lock works on paths its declared scope does not meet.\n *\n * ## What was too wide\n *\n * The workspace-mutation lock (`withDedicatedFileLock` on `.wildo-saas/state/workspace-mutation.lock`) is held for\n * minutes by a generation step (its whole window) and by an isolated re-check (its checks). A concurrent coding run took\n * the same lock before its baseline, to commit pending playbook runs, whether or not one was pending, so it waited for\n * every such holder. Measured on reference run 44052185141 (2026-11-17): dispatch-wait p95 76.5 s, 218 minutes summed;\n * the logo step alone (13:22:25-13:28:19) kept 8 prepared runs waiting 155-375 s.\n *\n * ## What changed, and what did not\n *\n * The holders keep the lock exactly as before: no commit, no re-check, no single-flight run and no second step enters a\n * step's window, and no commit enters a re-check. What changed is the ADMISSION only. A holder that knows which paths it\n * writes or reads opens a CLAIM naming them, inside the lock it holds; a concurrent run with nothing to commit before its\n * baseline then waits for the claims its declared mutation scope meets, not for the lock. A holder that opens no claim (a\n * step declaring nothing, a single-flight run, a commit, a CLI writer in another process) is waited for exactly as before.\n *\n * A run admitted this way joins the holder's window the way a wave's run already joins a step the wave runs inline\n * (#1805 review N2): the step reads its window as SHARED and claims only what lies under its own directories (#2240), and\n * its closing checkpoint commits the tree as it stands (#3204). A step whose writes have not all been traced claims\n * nothing, so it is waited for as before. The run's scope is a prediction (#1268 lets a run write anywhere);\n * interference between writers sharing the tree is detected and repaired, not prevented (#1528).\n *\n * ## The three kinds\n *\n * - {@link WorkspacePathClaimKind.STEP_WRITE}: what a generation step may write, for its window: its write scope plus\n * every side write traced for it (`GENERATION_STEP_CLAIM_BASIS`); a step not traced claims nothing.\n * - {@link WorkspacePathClaimKind.RECHECK_READ}: an isolated re-check's read scope while its checks run; the whole\n * application at a wave's end. A run whose scope may reach it waits, so the re-check still runs \"alone against what it\n * reads\" (#3220, #3998).\n * - {@link WorkspacePathClaimKind.ADMISSION_WRITE}: a concurrent coding run from the first instant of its admission\n * (opened before any wait) until it is a registered live run, so a re-check opening meanwhile sees it.\n *\n * ## In-process, on purpose\n *\n * Every claim holder and every waiter lives in the companion process. STEP_WRITE and RECHECK_READ claims are opened and\n * released INSIDE the file lock their holder holds, so \"one of them is open\" means \"this process holds the lock in a\n * section whose paths are named\". The cross-process half of exclusion (a CLI writer, another companion) is still the file\n * lock. JavaScript runs one task at a time, so a claim CHECKED and OPENED with no `await` between the two is atomic\n * against every other holder; callers keep it that way.\n */\nexport enum WorkspacePathClaimKind {\n /** A generation step writing its own directories. */\n STEP_WRITE = 'STEP_WRITE',\n /** An isolated re-check reading a closure of workspace packages, or the whole application. */\n RECHECK_READ = 'RECHECK_READ',\n /** A concurrent coding run being admitted, until it is registered as a live run. */\n ADMISSION_WRITE = 'ADMISSION_WRITE',\n}\n\ninterface WorkspacePathClaimBase {\n /** Unique per open claim. */\n readonly id: string;\n /** The task or run the claim belongs to, for a refusal or a wait to name. */\n readonly ownerTaskId: string;\n readonly ownerTaskRef: string;\n}\n\nexport type WorkspacePathClaim =\n | (WorkspacePathClaimBase & {\n readonly kind: WorkspacePathClaimKind.STEP_WRITE | WorkspacePathClaimKind.ADMISSION_WRITE;\n /** Application-root-relative path prefixes it may write. */\n readonly writePrefixes: readonly string[];\n })\n | (WorkspacePathClaimBase & {\n readonly kind: WorkspacePathClaimKind.RECHECK_READ;\n readonly readScope: VerificationReadScope;\n /** The package graph the read scope was resolved against; absent, every path is read. */\n readonly graph: ApplicationWorkspacePackageGraph | undefined;\n });\n\n/** What a claim is compared with: an open claim's shape, without its identity. */\nexport type WorkspacePathClaimRequest = WorkspacePathClaim extends infer Claim ? Claim extends WorkspacePathClaim ? Omit<Claim, 'id'> : never : never;\n\n/** An application-relative path or prefix, without a leading `./` or `/`. */\nfunction normalizePrefix(prefix: string): string {\n return prefix.replace(/\\\\/gu, '/').replace(/^(?:\\.\\/|\\/)+/u, '');\n}\n\n/**\n * The roots a generation step claims for its window (#4020), normalized, or `undefined` when it claims nothing: an empty\n * claim, or one naming the root itself. Directories (with their trailing slash) and exact files alike: the overlap test\n * reads both as string prefixes. The claim must cover every write, side effects included (the logo step's brand\n * propagation into the frontend, the website and the documentation, for one); the generation-step service declares it.\n */\nexport function generationStepWorkspaceClaimRoots(ownedPathPrefixes: readonly string[]): readonly string[] | undefined {\n const roots = ownedPathPrefixes.map(normalizePrefix);\n if (roots.length === 0 || roots.some((root) => root === '' || root === '/')) return undefined;\n return [...new Set(roots)].sort();\n}\n\n/**\n * Whether two sets of write prefixes may name a common path. Raw string prefixes in BOTH directions, so `frontend/src`\n * meets `frontend/src-old/` and `frontend/` meets `frontend/src/x.ts`: over-reporting an overlap costs a wait, missing one\n * lets two writers into one file, so the comparison errs toward overlap. An empty set is UNKNOWN and meets everything.\n */\nexport function writePrefixesOverlap(left: readonly string[], right: readonly string[]): boolean {\n if (left.length === 0 || right.length === 0) return true;\n const a = left.map(normalizePrefix);\n const b = right.map(normalizePrefix);\n return a.some((x) => b.some((y) => x === '' || y === '' || x.startsWith(y) || y.startsWith(x)));\n}\n\nfunction isWriteClaim(claim: WorkspacePathClaimRequest): claim is Extract<WorkspacePathClaimRequest, { readonly writePrefixes: readonly string[] }> {\n return claim.kind === WorkspacePathClaimKind.STEP_WRITE || claim.kind === WorkspacePathClaimKind.ADMISSION_WRITE;\n}\n\n/**\n * Whether two claims may not be held at once (#4020). Symmetric. Two writers conflict when their prefixes overlap; a\n * writer and a reader when the writer may write something the reader's checks read ({@link writeScopeMayReachReadScope},\n * the rule the early re-check already applies to live runs, #3998); two readers never do, since neither changes the tree.\n *\n * Two ADMISSIONS never conflict: concurrent coding runs share the tree by decision (#1528), overlapping scopes included,\n * and interference between them is detected and repaired rather than prevented. An admission claim exists only so the\n * holders that DO exclude a run (a step's directories, a re-check's read scope) can see a run that is not live yet.\n */\nexport function workspacePathClaimsConflict(left: WorkspacePathClaimRequest, right: WorkspacePathClaimRequest): boolean {\n if (left.kind === WorkspacePathClaimKind.ADMISSION_WRITE && right.kind === WorkspacePathClaimKind.ADMISSION_WRITE) return false;\n if (isWriteClaim(left) && isWriteClaim(right)) return writePrefixesOverlap(left.writePrefixes, right.writePrefixes);\n if (isWriteClaim(left) && right.kind === WorkspacePathClaimKind.RECHECK_READ) return writeScopeMayReachReadScope(left.writePrefixes, right.readScope, right.graph);\n if (left.kind === WorkspacePathClaimKind.RECHECK_READ && isWriteClaim(right)) return writeScopeMayReachReadScope(right.writePrefixes, left.readScope, left.graph);\n return false;\n}\n\n/** Whether a path a commit would carry lies under one of these write roots. */\nexport function isUnderWriteRoots(path: string, roots: readonly string[]): boolean {\n const normalized = normalizePrefix(path);\n return roots.map(normalizePrefix).some((root) => root !== '' && normalized.startsWith(root));\n}\n\n/**\n * The open claims of one companion process, and a way to wait for them to change (#4020). Pure bookkeeping: it decides\n * nothing about what a holder may do; the dispatch service asks it, under the rules above.\n */\nexport class WorkspacePathClaims {\n private readonly open = new Map<string, WorkspacePathClaim>();\n private sequence = 0;\n private changed: { promise: Promise<void>; resolve: () => void } | undefined;\n\n /** Every open claim, in opening order. */\n public list(): readonly WorkspacePathClaim[] {\n return [...this.open.values()];\n }\n\n /** The open claims that conflict with `request`, excluding any owned by `exceptOwnerTaskId`. */\n public conflicting(request: WorkspacePathClaimRequest, exceptOwnerTaskId?: string): readonly WorkspacePathClaim[] {\n return this.list().filter((claim) => claim.ownerTaskId !== exceptOwnerTaskId && workspacePathClaimsConflict(claim, request));\n }\n\n /**\n * Open a claim, returning its release. The release is idempotent, so a `finally` and an earlier explicit release may\n * both call it. Never checks for conflicts itself: the caller checks with {@link conflicting} and opens with no `await`\n * in between, which is what makes the pair atomic.\n */\n public acquire(request: WorkspacePathClaimRequest): () => void {\n this.sequence += 1;\n const id = `${request.kind}:${request.ownerTaskId}:${this.sequence}`;\n this.open.set(id, { ...request, id } as WorkspacePathClaim);\n this.signalChange();\n return () => {\n if (this.open.delete(id)) this.signalChange();\n };\n }\n\n /**\n * The roots of every open STEP_WRITE claim, except the steps named: what a commit made WITHOUT the lock (a person's\n * build checkpoint) must not carry while the step is still writing there.\n */\n public openStepWriteRoots(exceptOwnerTaskIds: Iterable<string> = []): readonly string[] {\n const except = new Set(exceptOwnerTaskIds);\n return [...new Set(this.list()\n .filter((claim) => claim.kind === WorkspacePathClaimKind.STEP_WRITE && !except.has(claim.ownerTaskId))\n .flatMap((claim) => (claim.kind === WorkspacePathClaimKind.STEP_WRITE ? claim.writePrefixes : [])))].sort();\n }\n\n /** Resolves the next time a claim is opened or released. */\n public nextChange(): Promise<void> {\n this.changed ??= (() => {\n let resolve!: () => void;\n const promise = new Promise<void>((done) => { resolve = done; });\n return { promise, resolve };\n })();\n return this.changed.promise;\n }\n\n /**\n * Wait until `blocking()` answers an empty list, re-asking it at every change and at least every `pollMs`, and at most\n * `timeoutMs` in all. Answers the claims still blocking when the bound is reached, or an empty list. The poll is a\n * backstop for a predicate that also reads state outside this registry (a live-run set); the change signal is what\n * normally wakes it.\n */\n public async waitUntilClear(\n blocking: () => readonly WorkspacePathClaim[],\n options: { readonly timeoutMs: number; readonly pollMs?: number },\n ): Promise<readonly WorkspacePathClaim[]> {\n const deadline = Date.now() + options.timeoutMs;\n for (;;) {\n const now = blocking();\n if (now.length === 0) return now;\n const remaining = deadline - Date.now();\n if (remaining <= 0) return now;\n let timer: ReturnType<typeof setTimeout> | undefined;\n await Promise.race([\n this.nextChange(),\n new Promise<void>((resolve) => { timer = setTimeout(resolve, Math.min(remaining, options.pollMs ?? 5_000)); timer.unref?.(); }),\n ]);\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n private signalChange(): void {\n const changed = this.changed;\n this.changed = undefined;\n changed?.resolve();\n }\n}\n\n/** One line naming who holds the claims a waiter met, for a refusal or a log. */\nexport function describeWorkspacePathClaims(claims: readonly WorkspacePathClaim[]): string {\n return claims.map((claim) => {\n switch (claim.kind) {\n case WorkspacePathClaimKind.STEP_WRITE:\n return `generation step ${claim.ownerTaskRef} writing ${claim.writePrefixes.join(', ')}`;\n case WorkspacePathClaimKind.ADMISSION_WRITE:\n return `coding run ${claim.ownerTaskRef} being admitted to write ${claim.writePrefixes.join(', ')}`;\n case WorkspacePathClaimKind.RECHECK_READ:\n return `isolated re-check of ${claim.ownerTaskRef} reading ${claim.readScope.wholeApplication ? 'the whole application' : [...claim.readScope.packageDirectories].sort().join(', ')}`;\n }\n }).join('; ');\n}\n"]}
|
|
@@ -253,6 +253,13 @@ export declare class AcceptedChangeCommitCompanionService {
|
|
|
253
253
|
commitBuildCheckpoint(input: {
|
|
254
254
|
readonly origin: AcceptOrigin.WAVE_RECONCILIATION | AcceptOrigin.INTERRUPTED_RUN_RECOVERY | AcceptOrigin.OPERATOR;
|
|
255
255
|
readonly liveTaskIds: ReadonlySet<string>;
|
|
256
|
+
/**
|
|
257
|
+
* Roots no commit may carry now (#4020): what a generation step still running has claimed (directories with their
|
|
258
|
+
* slash, or single files). Every automatic checkpoint takes the lock a step holds for its whole window, so only the
|
|
259
|
+
* door that takes no lock passes these (a person's `POST /build/checkpoint`). A path under one is left out and listed,
|
|
260
|
+
* like a person's decision record; the step's own closing checkpoint commits it. Absent, nothing is left out.
|
|
261
|
+
*/
|
|
262
|
+
readonly excludedPathPrefixes?: readonly string[];
|
|
256
263
|
}): Promise<BuildCheckpointOutcome | undefined>;
|
|
257
264
|
/** The commit that last changed any of these paths, or HEAD when git has no history for them (or none are given). */
|
|
258
265
|
private lastCommitTouching;
|
|
@@ -360,6 +367,19 @@ export declare class AcceptedChangeCommitCompanionService {
|
|
|
360
367
|
* A file the run created and HEAD lacks merges from empty, which yields the run's own bytes.
|
|
361
368
|
*/
|
|
362
369
|
private mergeRunChangeOntoHead;
|
|
370
|
+
/**
|
|
371
|
+
* The playbook runs {@link acceptPendingPlaybookRuns} would commit, oldest first: not yet accepted, not held for a
|
|
372
|
+
* person's request (research evidence, #2419), and not a run that failed after writing (#3237: a half-applied
|
|
373
|
+
* composition is a person's to accept or revert, never the posture's). One list, so the question below and the accept
|
|
374
|
+
* cannot disagree about what is pending.
|
|
375
|
+
*/
|
|
376
|
+
private listPlaybookRunsTheAutomaticAcceptTakes;
|
|
377
|
+
/**
|
|
378
|
+
* Whether {@link acceptPendingPlaybookRuns} has anything to commit right now (#4020). A concurrent coding run takes the
|
|
379
|
+
* whole-tree lock before its baseline to make that commit; when the answer is no it only waits for the lock's holder, and
|
|
380
|
+
* not at all when that holder is a generation step or a re-check whose claimed paths its scope does not meet.
|
|
381
|
+
*/
|
|
382
|
+
hasPlaybookRunsTheAutomaticAcceptTakes(): Promise<boolean>;
|
|
363
383
|
/**
|
|
364
384
|
* Accept EVERY playbook run whose writes are not yet accepted — the third site of #1534's invariant,
|
|
365
385
|
* run by the coding dispatch inside its worktree window, immediately before it takes a baseline.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accepted-change-commit.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/claude-cli/services/accepted-change-commit.companion.service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EACL,YAAY,EAMb,MAAM,oDAAoD,CAAC;AAG5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAqE,wCAAwC,EAAgC,MAAM,6EAA6E,CAAC;AAGxO,OAAO,EAAE,sCAAsC,EAAwC,MAAM,+CAA+C,CAAC;AAM7I,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kEAAkE,CAAC;AAE5H,OAAO,EAAkC,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"accepted-change-commit.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/claude-cli/services/accepted-change-commit.companion.service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EACL,YAAY,EAMb,MAAM,oDAAoD,CAAC;AAG5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAqE,wCAAwC,EAAgC,MAAM,6EAA6E,CAAC;AAGxO,OAAO,EAAE,sCAAsC,EAAwC,MAAM,+CAA+C,CAAC;AAM7I,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kEAAkE,CAAC;AAE5H,OAAO,EAAkC,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAwGzH;;;;GAIG;AACH,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAuHD,oBAAY,mBAAmB;IAC7B,uGAAuG;IACvG,mCAAmC,wCAAwC;IAC3E,iDAAiD;IACjD,oBAAoB,yBAAyB;IAC7C,sGAAsG;IACtG,YAAY,iBAAiB;IAC7B;;;;;OAKG;IACH,sBAAsB,2BAA2B;IACjD;;;;;;;OAOG;IACH,kBAAkB,uBAAuB;IACzC;;;;;OAKG;IACH,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,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,SAAS;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1H,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;KAChC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuCxC;;;;;;;;OAQG;IACU,oBAAoB,CAAC,KAAK,EAAE;QACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;QAClC,kCAAkC;QAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;QACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;QAC9B;;;;WAIG;QACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,IAAI,CAAC;QAC1C,8HAA8H;QAC9H,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;KAC9B,GAAG,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,cAAc,CAAC,GAAG;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAe/F,wGAAwG;YAC1F,OAAO;CAuCtB"}
|
|
@@ -35,6 +35,7 @@ import { serializeDossierWrite } from '../../meta-workflows/services/dossier-wri
|
|
|
35
35
|
import { closeCommitOverRelativeImports } from './accepted-change-import-closure.companion.js';
|
|
36
36
|
import { APPLICATION_CREATION_AUTONOMY_POSTURE } from '../../meta-workflows/models/playbook-run-checkpoint.models.js';
|
|
37
37
|
import { isBuildTaskDecisionsPath } from '../../meta-workflows/models/build-task-decisions-path.models.js';
|
|
38
|
+
import { isUnderWriteRoots } from '../models/workspace-path-claims.models.js';
|
|
38
39
|
const execFileAsync = promisify(execFile);
|
|
39
40
|
/**
|
|
40
41
|
* ACCEPTANCE as a commit, from the workbench (#1454, Step 7).
|
|
@@ -625,7 +626,9 @@ let AcceptedChangeCommitCompanionService = class AcceptedChangeCommitCompanionSe
|
|
|
625
626
|
const excludedPaths = changed.map((entry) => entry.path).filter((filePath) => isBuildTaskDecisionsPath(filePath, this.companionContext)
|
|
626
627
|
|| playbookOwners.has(filePath)
|
|
627
628
|
// The research-evidence store is accepted only on a person's request (#2419), whether or not a run record still owns it.
|
|
628
|
-
|| filePath.startsWith(`${RESEARCH_EVIDENCE_RELATIVE_ROOT}/`)
|
|
629
|
+
|| filePath.startsWith(`${RESEARCH_EVIDENCE_RELATIVE_ROOT}/`)
|
|
630
|
+
// A generation step still writing there (#4020): its output is half-written until its own window ends.
|
|
631
|
+
|| isUnderWriteRoots(filePath, input.excludedPathPrefixes ?? []));
|
|
629
632
|
const excluded = new Set(excludedPaths);
|
|
630
633
|
const stillThere = await Promise.all(changed.map(async (entry) => (!entry.untracked || await stat(path.resolve(this.companionContext.saasRoot, entry.path)).then(() => true, () => false))));
|
|
631
634
|
const paths = changed.filter((entry, index) => !excluded.has(entry.path) && stillThere[index]).map((entry) => entry.path);
|
|
@@ -644,7 +647,7 @@ let AcceptedChangeCommitCompanionService = class AcceptedChangeCommitCompanionSe
|
|
|
644
647
|
'The working tree the build\'s runs share is committed as it stands. The runs named below settled since the previous checkpoint; which run wrote which file is in each run\'s own write record.',
|
|
645
648
|
'',
|
|
646
649
|
...runs.map((record) => `Run: ${record.taskRef} (run ${record.taskId}, recorded ${record.at})`),
|
|
647
|
-
...(excludedPaths.length > 0 ? ['', 'Left out (a person\'s decision record, an unaccepted playbook run\'s file, or
|
|
650
|
+
...(excludedPaths.length > 0 ? ['', 'Left out (a person\'s decision record, an unaccepted playbook run\'s file, research evidence, or a generation step\'s output still being written):', ...excludedPaths.map((filePath) => `- ${filePath}`)] : []),
|
|
648
651
|
'',
|
|
649
652
|
...runs.map((record) => `${CODING_RUN_TRAILER}: ${record.taskId}`),
|
|
650
653
|
].join('\n');
|
|
@@ -1122,6 +1125,27 @@ let AcceptedChangeCommitCompanionService = class AcceptedChangeCommitCompanionSe
|
|
|
1122
1125
|
await rm(directory, { recursive: true, force: true }).catch(() => undefined);
|
|
1123
1126
|
}
|
|
1124
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* The playbook runs {@link acceptPendingPlaybookRuns} would commit, oldest first: not yet accepted, not held for a
|
|
1130
|
+
* person's request (research evidence, #2419), and not a run that failed after writing (#3237: a half-applied
|
|
1131
|
+
* composition is a person's to accept or revert, never the posture's). One list, so the question below and the accept
|
|
1132
|
+
* cannot disagree about what is pending.
|
|
1133
|
+
*/
|
|
1134
|
+
async listPlaybookRunsTheAutomaticAcceptTakes() {
|
|
1135
|
+
return (await this.playbookRunWrites.list())
|
|
1136
|
+
.filter((record) => record.acceptedCommitSha === undefined)
|
|
1137
|
+
.filter((record) => record.acceptOnRequestOnly !== true)
|
|
1138
|
+
.filter((record) => record.landingFailed !== true)
|
|
1139
|
+
.sort((left, right) => left.at.localeCompare(right.at));
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Whether {@link acceptPendingPlaybookRuns} has anything to commit right now (#4020). A concurrent coding run takes the
|
|
1143
|
+
* whole-tree lock before its baseline to make that commit; when the answer is no it only waits for the lock's holder, and
|
|
1144
|
+
* not at all when that holder is a generation step or a re-check whose claimed paths its scope does not meet.
|
|
1145
|
+
*/
|
|
1146
|
+
async hasPlaybookRunsTheAutomaticAcceptTakes() {
|
|
1147
|
+
return (await this.listPlaybookRunsTheAutomaticAcceptTakes()).length > 0;
|
|
1148
|
+
}
|
|
1125
1149
|
/**
|
|
1126
1150
|
* Accept EVERY playbook run whose writes are not yet accepted — the third site of #1534's invariant,
|
|
1127
1151
|
* run by the coding dispatch inside its worktree window, immediately before it takes a baseline.
|
|
@@ -1148,16 +1172,7 @@ let AcceptedChangeCommitCompanionService = class AcceptedChangeCommitCompanionSe
|
|
|
1148
1172
|
* which is how the unstamped backlog of a run carried by hand is absorbed on the first pass.
|
|
1149
1173
|
*/
|
|
1150
1174
|
async acceptPendingPlaybookRuns(origin) {
|
|
1151
|
-
const pending =
|
|
1152
|
-
.filter((record) => record.acceptedCommitSha === undefined)
|
|
1153
|
-
// Research evidence waits for a person's accept (#2419): never carried by the automatic commit.
|
|
1154
|
-
.filter((record) => record.acceptOnRequestOnly !== true)
|
|
1155
|
-
/*
|
|
1156
|
-
* A run that FAILED after writing (#3237): its record makes its writes attributable and keeps them out of a
|
|
1157
|
-
* coding run's commit, but a half-applied composition is a person's to accept or revert, never the posture's.
|
|
1158
|
-
*/
|
|
1159
|
-
.filter((record) => record.landingFailed !== true)
|
|
1160
|
-
.sort((left, right) => left.at.localeCompare(right.at));
|
|
1175
|
+
const pending = await this.listPlaybookRunsTheAutomaticAcceptTakes();
|
|
1161
1176
|
let accepted = 0;
|
|
1162
1177
|
let superseded = 0;
|
|
1163
1178
|
let editedOutsideRuns = 0;
|