instar 1.3.1146 → 1.3.1148
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/core/AgentWorktreeDetector.d.ts +48 -0
- package/dist/core/AgentWorktreeDetector.d.ts.map +1 -1
- package/dist/core/AgentWorktreeDetector.js +115 -0
- package/dist/core/AgentWorktreeDetector.js.map +1 -1
- package/dist/data/standards-guard-index.json +1 -1
- package/dist/data/standards-guard-index.meta.json +2 -2
- package/dist/data/standards-registry.meta.json +1 -1
- package/package.json +1 -1
- package/scripts/lint-no-blocking-process-scans.js +130 -4
- package/src/data/builtin-manifest.json +2 -2
- package/src/data/standards-guard-index.json +1 -1
- package/src/data/standards-guard-index.meta.json +2 -2
- package/src/data/standards-registry.meta.json +1 -1
- package/upgrades/1.3.1147.md +55 -0
- package/upgrades/1.3.1148.md +68 -0
- package/upgrades/side-effects/blocking-process-scan-command-resolution.md +109 -0
- package/upgrades/side-effects/worktree-repo-discovery.md +124 -0
|
@@ -63,6 +63,47 @@ export declare function runDetection(opts: DetectorOptions): Promise<DetectorRes
|
|
|
63
63
|
* mutable file in the read path → the transient-empty failure class is gone.
|
|
64
64
|
*/
|
|
65
65
|
export declare function enumerateSafeRoots(agentsDir?: string): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Derive candidate instar-repo roots from the agent worktrees themselves.
|
|
68
|
+
*
|
|
69
|
+
* WHY THIS EXISTS. The fallback chain below guesses at conventional checkout
|
|
70
|
+
* locations (`~/Documents/Projects/instar`, `~/instar`). An agent whose repo
|
|
71
|
+
* lives anywhere else — e.g. `<agent_home>/.dev/instar`, which is where the
|
|
72
|
+
* dev layout actually puts it — matches none of them, so resolution returned
|
|
73
|
+
* null and every consumer silently did nothing. Meanwhile the answer was
|
|
74
|
+
* sitting on disk the whole time: a linked worktree's `.git` is a FILE whose
|
|
75
|
+
* contents name its owning repo. The worktrees know. Ask them instead of
|
|
76
|
+
* guessing.
|
|
77
|
+
*
|
|
78
|
+
* (2026-07-29 the same blind spot let the reaper report `reclaimable: 0`
|
|
79
|
+
* against 73 worktrees because its `git -C <path> worktree list` was failing
|
|
80
|
+
* outright. The honest-reporting fix landed; the resolution did not.)
|
|
81
|
+
*
|
|
82
|
+
* Deliberately NO subprocess: reading the pointer file is cheaper than
|
|
83
|
+
* `git rev-parse`, cannot block the event loop, and keeps this helper usable
|
|
84
|
+
* from the runtime hot dirs. Returns candidates only — every one is still
|
|
85
|
+
* integrity-validated by `resolveInstarRepo` before it is believed.
|
|
86
|
+
*
|
|
87
|
+
* ORDERED BY COUNT, and the ordering carries a real limitation worth stating.
|
|
88
|
+
* One agent's `.worktrees/` can legitimately hold worktrees of MORE THAN ONE
|
|
89
|
+
* clone of the same upstream — measured on a live agent: 29 worktrees owned by
|
|
90
|
+
* `<home>/.build/instar` and 17 by `<home>/.dev/instar`. This returns the
|
|
91
|
+
* most-owned first, so a single-repo consumer gets the largest coherent set
|
|
92
|
+
* rather than an arbitrary one; it does NOT merge them, and a consumer that
|
|
93
|
+
* takes only `[0]` will not see the smaller repo's worktrees. Consumers that
|
|
94
|
+
* need full coverage must iterate the whole list. The alternative — picking
|
|
95
|
+
* arbitrarily — would make the blind spot unpredictable instead of merely
|
|
96
|
+
* bounded.
|
|
97
|
+
*/
|
|
98
|
+
export declare function discoverInstarRepoFromWorktrees(roots: ReadonlyArray<string>, opts?: {
|
|
99
|
+
maxWorktrees?: number;
|
|
100
|
+
}): string[];
|
|
101
|
+
/**
|
|
102
|
+
* `gitdir: /path/to/repo/.git/worktrees/<slug>` → `/path/to/repo`.
|
|
103
|
+
* Anything that does not have that exact shape names nothing, and returns
|
|
104
|
+
* null rather than a guess.
|
|
105
|
+
*/
|
|
106
|
+
export declare function parseWorktreeGitPointer(contents: string): string | null;
|
|
66
107
|
export interface ResolveDetectorRepoOptions {
|
|
67
108
|
/** Path to user config (defaults to `~/.instar/config.json`). */
|
|
68
109
|
configPath?: string;
|
|
@@ -76,6 +117,13 @@ export interface ResolveDetectorRepoOptions {
|
|
|
76
117
|
* running them has an allowlisted checkout at cwd).
|
|
77
118
|
*/
|
|
78
119
|
cwd?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The CALLER'S OWN agent `.worktrees` root(s), used to derive the owning
|
|
122
|
+
* repo from the worktrees themselves. Omitted ⇒ no worktree-derived
|
|
123
|
+
* candidates. Never pass `enumerateSafeRoots()` here: that spans every agent
|
|
124
|
+
* on the machine and will resolve you to somebody else's repo.
|
|
125
|
+
*/
|
|
126
|
+
worktreeRoots?: ReadonlyArray<string>;
|
|
79
127
|
}
|
|
80
128
|
/**
|
|
81
129
|
* Per spec: the detector uses a deterministic source (config or default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentWorktreeDetector.d.ts","sourceRoot":"","sources":["../../src/core/AgentWorktreeDetector.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,eAAe;IAC9B;;iFAE6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB;uCACmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;oBAGgB;IAChB,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC;;gEAE4D;IAC5D,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnE,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;uDACmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,0FAA0F;IAC1F,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC/C,aAAa,CAAC,EA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AAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,GAAE,0BAA+B,GAAG,MAAM,GAAG,IAAI,CA4D9F"}
|
|
@@ -333,6 +333,104 @@ export function enumerateSafeRoots(agentsDir) {
|
|
|
333
333
|
}
|
|
334
334
|
return roots;
|
|
335
335
|
}
|
|
336
|
+
// ── Public helper: ask the worktrees which repo owns them ────────────────
|
|
337
|
+
/**
|
|
338
|
+
* Derive candidate instar-repo roots from the agent worktrees themselves.
|
|
339
|
+
*
|
|
340
|
+
* WHY THIS EXISTS. The fallback chain below guesses at conventional checkout
|
|
341
|
+
* locations (`~/Documents/Projects/instar`, `~/instar`). An agent whose repo
|
|
342
|
+
* lives anywhere else — e.g. `<agent_home>/.dev/instar`, which is where the
|
|
343
|
+
* dev layout actually puts it — matches none of them, so resolution returned
|
|
344
|
+
* null and every consumer silently did nothing. Meanwhile the answer was
|
|
345
|
+
* sitting on disk the whole time: a linked worktree's `.git` is a FILE whose
|
|
346
|
+
* contents name its owning repo. The worktrees know. Ask them instead of
|
|
347
|
+
* guessing.
|
|
348
|
+
*
|
|
349
|
+
* (2026-07-29 the same blind spot let the reaper report `reclaimable: 0`
|
|
350
|
+
* against 73 worktrees because its `git -C <path> worktree list` was failing
|
|
351
|
+
* outright. The honest-reporting fix landed; the resolution did not.)
|
|
352
|
+
*
|
|
353
|
+
* Deliberately NO subprocess: reading the pointer file is cheaper than
|
|
354
|
+
* `git rev-parse`, cannot block the event loop, and keeps this helper usable
|
|
355
|
+
* from the runtime hot dirs. Returns candidates only — every one is still
|
|
356
|
+
* integrity-validated by `resolveInstarRepo` before it is believed.
|
|
357
|
+
*
|
|
358
|
+
* ORDERED BY COUNT, and the ordering carries a real limitation worth stating.
|
|
359
|
+
* One agent's `.worktrees/` can legitimately hold worktrees of MORE THAN ONE
|
|
360
|
+
* clone of the same upstream — measured on a live agent: 29 worktrees owned by
|
|
361
|
+
* `<home>/.build/instar` and 17 by `<home>/.dev/instar`. This returns the
|
|
362
|
+
* most-owned first, so a single-repo consumer gets the largest coherent set
|
|
363
|
+
* rather than an arbitrary one; it does NOT merge them, and a consumer that
|
|
364
|
+
* takes only `[0]` will not see the smaller repo's worktrees. Consumers that
|
|
365
|
+
* need full coverage must iterate the whole list. The alternative — picking
|
|
366
|
+
* arbitrarily — would make the blind spot unpredictable instead of merely
|
|
367
|
+
* bounded.
|
|
368
|
+
*/
|
|
369
|
+
export function discoverInstarRepoFromWorktrees(roots, opts = {}) {
|
|
370
|
+
const cap = opts.maxWorktrees ?? 200;
|
|
371
|
+
const counts = new Map();
|
|
372
|
+
let inspected = 0;
|
|
373
|
+
for (const root of roots) {
|
|
374
|
+
let entries = [];
|
|
375
|
+
try {
|
|
376
|
+
entries = fs.readdirSync(root);
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
// @silent-fallback-ok — root vanished between enumeration and read.
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
for (const entry of entries) {
|
|
383
|
+
if (inspected >= cap)
|
|
384
|
+
break;
|
|
385
|
+
const pointer = path.join(root, entry, '.git');
|
|
386
|
+
let stat;
|
|
387
|
+
try {
|
|
388
|
+
stat = fs.statSync(pointer);
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
// @silent-fallback-ok — not a worktree (no .git at all). Skip.
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
// A linked worktree's .git is a FILE. A full clone's is a directory, and
|
|
395
|
+
// a clone under .worktrees/ is not a worktree of anything — skip it
|
|
396
|
+
// rather than claim it points somewhere.
|
|
397
|
+
if (!stat.isFile())
|
|
398
|
+
continue;
|
|
399
|
+
inspected++;
|
|
400
|
+
let contents;
|
|
401
|
+
try {
|
|
402
|
+
contents = fs.readFileSync(pointer, 'utf-8');
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
// @silent-fallback-ok — unreadable pointer; it names nothing.
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const repo = parseWorktreeGitPointer(contents);
|
|
409
|
+
if (repo)
|
|
410
|
+
counts.set(repo, (counts.get(repo) ?? 0) + 1);
|
|
411
|
+
}
|
|
412
|
+
if (inspected >= cap)
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
return [...counts.entries()]
|
|
416
|
+
.sort((a, b) => (b[1] - a[1]) || a[0].localeCompare(b[0]))
|
|
417
|
+
.map(([repo]) => repo);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* `gitdir: /path/to/repo/.git/worktrees/<slug>` → `/path/to/repo`.
|
|
421
|
+
* Anything that does not have that exact shape names nothing, and returns
|
|
422
|
+
* null rather than a guess.
|
|
423
|
+
*/
|
|
424
|
+
export function parseWorktreeGitPointer(contents) {
|
|
425
|
+
const match = /^\s*gitdir:\s*(.+?)\s*$/m.exec(contents);
|
|
426
|
+
if (!match)
|
|
427
|
+
return null;
|
|
428
|
+
const marker = `${path.sep}.git${path.sep}worktrees${path.sep}`;
|
|
429
|
+
const idx = match[1].indexOf(marker);
|
|
430
|
+
if (idx <= 0)
|
|
431
|
+
return null;
|
|
432
|
+
return match[1].slice(0, idx);
|
|
433
|
+
}
|
|
336
434
|
/**
|
|
337
435
|
* Per spec: the detector uses a deterministic source (config or default
|
|
338
436
|
* chain), NOT `INSTAR_REPO` env var, because env vars can differ between
|
|
@@ -358,6 +456,23 @@ export function resolveDetectorInstarRepo(opts = {}) {
|
|
|
358
456
|
const candidateChain = [];
|
|
359
457
|
if (configRepoPath)
|
|
360
458
|
candidateChain.push(configRepoPath);
|
|
459
|
+
// Ask the worktrees who owns them, BEFORE guessing at conventional
|
|
460
|
+
// locations. An operator-supplied `worktree.repoPath` still wins — this only
|
|
461
|
+
// ever gets consulted where the deterministic answer was absent, which is
|
|
462
|
+
// exactly where resolution used to return null.
|
|
463
|
+
//
|
|
464
|
+
// THE CALLER MUST NAME ITS OWN ROOT. There is deliberately no default here,
|
|
465
|
+
// and `enumerateSafeRoots()` is deliberately NOT it: that helper enumerates
|
|
466
|
+
// EVERY agent on the machine, so defaulting to it resolved this agent to a
|
|
467
|
+
// DIFFERENT agent's repo — whichever one happened to own the most worktrees.
|
|
468
|
+
// (Measured, not hypothesised: with the default in place, echo resolved to
|
|
469
|
+
// instar-codey's repo.) A confident wrong repo is worse than the null this
|
|
470
|
+
// change exists to remove, so absent an explicit root we add no candidate
|
|
471
|
+
// and the pre-existing chain applies unchanged.
|
|
472
|
+
for (const repo of discoverInstarRepoFromWorktrees(opts.worktreeRoots ?? [])) {
|
|
473
|
+
if (!candidateChain.includes(repo))
|
|
474
|
+
candidateChain.push(repo);
|
|
475
|
+
}
|
|
361
476
|
if (opts.fallbackChain) {
|
|
362
477
|
candidateChain.push(...opts.fallbackChain);
|
|
363
478
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentWorktreeDetector.js","sourceRoot":"","sources":["../../src/core/AgentWorktreeDetector.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,+DAA+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA2D/D,4EAA4E;AAE5E,MAAM,sBAAsB,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,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,sEAAsE;IACtE,uEAAuE;IACvE,uDAAuD;IACvD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,iBAAiB,CAAC;YAC7B,GAAG,EAAE,EAAE;YACP,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,aAAa,EAAE,cAAc;YAC7B,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;QACrE,sEAAsE;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.1148",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "c4fb233de8c00b924323e7e9b167a5832162a35740c6445ccb7200c863ee9686",
|
|
3
3
|
"registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.1148"
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -25,6 +25,29 @@
|
|
|
25
25
|
* line or the line directly above:
|
|
26
26
|
* // lint-allow-blocking-scan: <why this can't run periodically>
|
|
27
27
|
*
|
|
28
|
+
* ── 2026-08-14: the command name does not have to be written at the callsite.
|
|
29
|
+
* The original pattern required the scan command as a string literal INSIDE the
|
|
30
|
+
* call, so putting the name one step away walked past it — while the event loop
|
|
31
|
+
* stalled just the same, because the incident was about what the process DOES,
|
|
32
|
+
* not how the argument was spelled. instar-codey reproduced the concatenation
|
|
33
|
+
* form (`const cmd = 'pg' + 'rep'; execFileSync(cmd, ['node'])` → exit 0) while
|
|
34
|
+
* auditing rename-defeatable checks, and scoped the fix.
|
|
35
|
+
*
|
|
36
|
+
* NOW RESOLVED before the decision: literal `+` chains, local `const` string
|
|
37
|
+
* bindings, and import aliases of the sync entry points. The VALUE decides, so
|
|
38
|
+
* `const pgrep = 'tmux'` is legal and `const cmd = 'psql'` is not a `ps`.
|
|
39
|
+
*
|
|
40
|
+
* DELIBERATELY NOT CLOSED, so it is stated rather than implied:
|
|
41
|
+
* · A call split across MULTIPLE LINES. This lint is line-oriented; making it
|
|
42
|
+
* multi-line means an AST, which is a different check at a different layer.
|
|
43
|
+
* Pre-existing, not introduced here.
|
|
44
|
+
* · A command read from config, an argv, or another module. Not foldable
|
|
45
|
+
* without dataflow analysis, and guessing would over-block correct code —
|
|
46
|
+
* the more expensive failure for a check that blocks commits.
|
|
47
|
+
* · Scope: bindings are collected file-wide rather than per-scope, so an
|
|
48
|
+
* identifier bound twice to DIFFERENT values is treated as unresolvable and
|
|
49
|
+
* never flagged. That is the safe direction, chosen on purpose.
|
|
50
|
+
*
|
|
28
51
|
* Exit codes: 0 — clean; 1 — at least one violation.
|
|
29
52
|
*
|
|
30
53
|
* Usage:
|
|
@@ -46,11 +69,112 @@ const ROOT = path.resolve(path.dirname(__filename), '..');
|
|
|
46
69
|
const SCAN_DIRS = ['src/monitoring', 'src/server'];
|
|
47
70
|
const EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.mjs', '.cjs']);
|
|
48
71
|
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
const
|
|
72
|
+
// The scan commands themselves. Word-boundary matched against the RESOLVED
|
|
73
|
+
// command value, so `psql` never counts as `ps`.
|
|
74
|
+
const SCAN_COMMAND = /^(ps|pgrep|lsof|pkill)\b/;
|
|
75
|
+
|
|
76
|
+
// The synchronous child-process entry points. Import aliases of these are
|
|
77
|
+
// resolved per-file below — `import { execFileSync as run }` then `run('pgrep')`
|
|
78
|
+
// stalls the loop exactly as much as calling it by its own name.
|
|
79
|
+
const SYNC_BUILTINS = ['spawnSync', 'execSync', 'execFileSync'];
|
|
80
|
+
|
|
52
81
|
const ALLOW = /lint-allow-blocking-scan:/;
|
|
53
82
|
|
|
83
|
+
/** A string literal, or a `+` chain of string literals. Nothing else folds. */
|
|
84
|
+
const FOLDABLE = /^\s*(?:(?:'[^'\\]*'|"[^"\\]*"|`[^`\\$]*`)\s*\+\s*)*(?:'[^'\\]*'|"[^"\\]*"|`[^`\\$]*`)\s*$/;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Fold an expression to its string value, or null if it is not a pure literal
|
|
88
|
+
* chain. `'pg' + 'rep'` → `pgrep`. A template with `${}` never folds.
|
|
89
|
+
*/
|
|
90
|
+
function foldLiteral(expr) {
|
|
91
|
+
if (!FOLDABLE.test(expr)) return null;
|
|
92
|
+
const parts = expr.match(/'[^'\\]*'|"[^"\\]*"|`[^`\\$]*`/g);
|
|
93
|
+
if (!parts) return null;
|
|
94
|
+
return parts.map((p) => p.slice(1, -1)).join('');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Local `const NAME = <literal chain>` bindings, file-wide.
|
|
99
|
+
*
|
|
100
|
+
* Deliberately NOT scope-aware: this is a line-oriented lint, not a compiler.
|
|
101
|
+
* The safe direction for a check that BLOCKS COMMITS is to refuse to resolve
|
|
102
|
+
* anything ambiguous, so an identifier bound more than once to DIFFERENT values
|
|
103
|
+
* is recorded as unresolvable and never produces a violation. Over-blocking
|
|
104
|
+
* correct code is the more expensive failure here.
|
|
105
|
+
*/
|
|
106
|
+
function collectStringConsts(lines) {
|
|
107
|
+
const map = new Map();
|
|
108
|
+
const conflicted = new Set();
|
|
109
|
+
const DECL = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::\s*[^=]+?)?=\s*([^;\n]+)/g;
|
|
110
|
+
for (const line of lines) {
|
|
111
|
+
const trimmed = line.trimStart();
|
|
112
|
+
if (/^(\/\/|\*|\/\*)/.test(trimmed)) continue; // a commented-out const binds nothing
|
|
113
|
+
DECL.lastIndex = 0;
|
|
114
|
+
let m;
|
|
115
|
+
while ((m = DECL.exec(line)) !== null) {
|
|
116
|
+
const [, name, rhs] = m;
|
|
117
|
+
const value = foldLiteral(rhs);
|
|
118
|
+
if (value === null) { conflicted.add(name); continue; }
|
|
119
|
+
if (map.has(name) && map.get(name) !== value) conflicted.add(name);
|
|
120
|
+
else map.set(name, value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
for (const name of conflicted) map.delete(name);
|
|
124
|
+
return map;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Names in this file that reach a synchronous child-process call. */
|
|
128
|
+
function collectSyncNames(text) {
|
|
129
|
+
const names = new Set(SYNC_BUILTINS);
|
|
130
|
+
const IMPORT = /import\s*\{([^}]*)\}\s*from\s*['"]node:child_process['"]/g;
|
|
131
|
+
let m;
|
|
132
|
+
while ((m = IMPORT.exec(text)) !== null) {
|
|
133
|
+
for (const clause of m[1].split(',')) {
|
|
134
|
+
const alias = clause.match(/([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)/);
|
|
135
|
+
if (alias && SYNC_BUILTINS.includes(alias[1])) names.add(alias[2]);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return names;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The first argument of `name(` starting at `from`, as source text. Bounded to
|
|
143
|
+
* the line, matching this lint's existing granularity — a call split across
|
|
144
|
+
* lines is a separate, pre-existing gap, declared in the header rather than
|
|
145
|
+
* silently implied.
|
|
146
|
+
*/
|
|
147
|
+
function firstArg(line, from) {
|
|
148
|
+
let depth = 0;
|
|
149
|
+
for (let i = from; i < line.length; i++) {
|
|
150
|
+
const c = line[i];
|
|
151
|
+
if (c === '(' || c === '[' || c === '{') depth++;
|
|
152
|
+
else if (c === ')' || c === ']' || c === '}') {
|
|
153
|
+
if (depth === 0) return line.slice(from, i);
|
|
154
|
+
depth--;
|
|
155
|
+
} else if (c === ',' && depth === 0) return line.slice(from, i);
|
|
156
|
+
}
|
|
157
|
+
return line.slice(from);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Does this line perform a synchronous scan? Resolves the command through
|
|
162
|
+
* literal folding and local constants before deciding.
|
|
163
|
+
*/
|
|
164
|
+
function scanViolation(line, syncNames, constMap) {
|
|
165
|
+
for (const name of syncNames) {
|
|
166
|
+
const call = new RegExp(`\\b${name}\\s*\\(`, 'g');
|
|
167
|
+
let m;
|
|
168
|
+
while ((m = call.exec(line)) !== null) {
|
|
169
|
+
const arg = firstArg(line, m.index + m[0].length).trim();
|
|
170
|
+
let value = foldLiteral(arg);
|
|
171
|
+
if (value === null && /^[A-Za-z_$][\w$]*$/.test(arg)) value = constMap.get(arg) ?? null;
|
|
172
|
+
if (value !== null && SCAN_COMMAND.test(value.trim())) return true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
54
178
|
const inScanDir = (p) => SCAN_DIRS.some((d) => p.startsWith(d + '/'));
|
|
55
179
|
|
|
56
180
|
function listFiles() {
|
|
@@ -86,10 +210,12 @@ for (const rel of listFiles()) {
|
|
|
86
210
|
let content;
|
|
87
211
|
try { content = fs.readFileSync(full, 'utf-8'); } catch { continue; }
|
|
88
212
|
const lines = content.split('\n');
|
|
213
|
+
const syncNames = collectSyncNames(content);
|
|
214
|
+
const constMap = collectStringConsts(lines);
|
|
89
215
|
for (let i = 0; i < lines.length; i++) {
|
|
90
216
|
const trimmed = lines[i].trimStart();
|
|
91
217
|
if (/^(\/\/|\*|\/\*)/.test(trimmed)) continue; // comment-only mention
|
|
92
|
-
if (!
|
|
218
|
+
if (!scanViolation(lines[i], syncNames, constMap)) continue;
|
|
93
219
|
// Inline justification on this line or within the comment block directly
|
|
94
220
|
// above (scan back up to 4 lines so a multi-line reason is honoured).
|
|
95
221
|
let allowed = false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-08-
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-08-14T23:20:47.847Z",
|
|
5
|
+
"instarVersion": "1.3.1148",
|
|
6
6
|
"entryCount": 202,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.1148",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "c4fb233de8c00b924323e7e9b167a5832162a35740c6445ccb7200c863ee9686",
|
|
3
3
|
"registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.1148"
|
|
5
5
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
`scripts/lint-no-blocking-process-scans.js` enforces root cause #4 of the 2026-06-07 "server temporarily
|
|
9
|
+
down" post-mortem: a synchronous `ps`/`pgrep`/`lsof`/`pkill` on a runtime hot path blocks the single-threaded
|
|
10
|
+
event loop, those commands get slow under exactly the load that makes monitors fire, and the cumulative
|
|
11
|
+
stall starved `/health` until the supervisor restarted a server that was alive the whole time.
|
|
12
|
+
|
|
13
|
+
The check required the scan command as a string literal inside the call, so the name one step away walked
|
|
14
|
+
past it while the event loop stalled identically:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const cmd = 'pgrep'; execFileSync(cmd, ['node']); // was not caught
|
|
18
|
+
const cmd = 'pg' + 'rep'; execFileSync(cmd, ['node']); // was not caught
|
|
19
|
+
import { execFileSync as run } from 'node:child_process';
|
|
20
|
+
run('pgrep', ['node']); // was not caught
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
instar-codey reproduced the concatenation form against the shipped lint (exit 0) while auditing
|
|
24
|
+
rename-defeatable checks, and scoped the remedy. The command is now resolved before the rule is applied:
|
|
25
|
+
literal `+` chains fold, local `const` string bindings resolve, and import aliases of the three sync entry
|
|
26
|
+
points are followed.
|
|
27
|
+
|
|
28
|
+
Three choices keep it from flagging correct code, each with its own test: the resolved VALUE decides and
|
|
29
|
+
never the variable name (`const pgrep = 'tmux'` is legal); matching is whole-word (`psql` is not `ps`); and
|
|
30
|
+
an identifier bound to two different values in one file is treated as unresolvable and never flagged. Async
|
|
31
|
+
calls stay legal — moving to async is the remedy the rule exists to push toward.
|
|
32
|
+
|
|
33
|
+
Deliberately left open and stated in the header: calls split across multiple lines (line-oriented lint;
|
|
34
|
+
closing it means an AST), and commands read from config/argv/another module (needs dataflow analysis, and
|
|
35
|
+
guessing would over-block).
|
|
36
|
+
|
|
37
|
+
## What to Tell Your User
|
|
38
|
+
|
|
39
|
+
None — internal change (no user-facing surface).
|
|
40
|
+
|
|
41
|
+
## Summary of New Capabilities
|
|
42
|
+
|
|
43
|
+
None — internal change (no user-facing surface).
|
|
44
|
+
|
|
45
|
+
## Evidence
|
|
46
|
+
|
|
47
|
+
- `tests/unit/lint-no-blocking-process-scans.test.ts` — 14/14 green (5 original + 9 added).
|
|
48
|
+
- Negative control: tests written BEFORE the fix and run against the shipped lint — **4 of 14 fail**
|
|
49
|
+
(const concatenation, plain variable, inline concatenation, import alias). The other 10 pass both ways,
|
|
50
|
+
which is what makes them controls.
|
|
51
|
+
- Real-tree verdict: `node scripts/lint-no-blocking-process-scans.js` → `clean`, exit 0 — no new flags on
|
|
52
|
+
existing code.
|
|
53
|
+
- Full `npm run lint` chain green.
|
|
54
|
+
- Side-effects review: `upgrades/side-effects/blocking-process-scan-command-resolution.md`.
|
|
55
|
+
- ELI16: `docs/specs/blocking-process-scan-command-resolution.eli16.md`.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
Adds to `src/core/AgentWorktreeDetector.ts`:
|
|
9
|
+
|
|
10
|
+
- `parseWorktreeGitPointer(contents)` — `gitdir: /repo/.git/worktrees/<slug>` → `/repo`; null for anything
|
|
11
|
+
that is not exactly that shape.
|
|
12
|
+
- `discoverInstarRepoFromWorktrees(roots, {maxWorktrees})` — reads each worktree's `.git` pointer FILE under
|
|
13
|
+
the given roots and returns owning repo roots, ordered by how many worktrees name each. No subprocess:
|
|
14
|
+
reading the pointer is cheaper than `git rev-parse`, cannot block the event loop, and keeps the helper
|
|
15
|
+
usable from the runtime hot dirs.
|
|
16
|
+
- `ResolveDetectorRepoOptions.worktreeRoots` — when a caller passes ITS OWN `.worktrees` root(s), discovered
|
|
17
|
+
repos join the candidate chain after the operator-supplied `worktree.repoPath` and before the
|
|
18
|
+
conventional-location guesses. Omitted ⇒ no candidates ⇒ byte-identical behaviour.
|
|
19
|
+
|
|
20
|
+
**Why.** On a live agent: `GET /worktrees/agent-reaper` reported `enumerationOk: false`,
|
|
21
|
+
`enumerationFailures: 98`, `git -C <agent home> worktree list --porcelain → fatal: not a git repository`,
|
|
22
|
+
with 45 worktrees and 27 GB unreclaimed. Separately `resolveDetectorInstarRepo` guessed at
|
|
23
|
+
`~/Documents/Projects/instar` and `~/instar`; neither exists there, so it returned null and callers guarded
|
|
24
|
+
with `if (repo)` skipped silently. Both are the same mistake — a path assumed rather than resolved — while a
|
|
25
|
+
linked worktree's `.git` file names its owner outright.
|
|
26
|
+
|
|
27
|
+
**A misresolution caught during development, now pinned.** The first draft defaulted discovery to
|
|
28
|
+
`enumerateSafeRoots()`, which spans EVERY agent home on the machine; measured on the real box, `echo`
|
|
29
|
+
resolved to `instar-codey`'s repo. A confident wrong repo is worse than null — null makes a consumer skip, a
|
|
30
|
+
wrong repo makes it act. There is now no default: a caller must name its own root.
|
|
31
|
+
|
|
32
|
+
**Declared limitation.** One agent's `.worktrees/` can legitimately hold worktrees of more than one clone of
|
|
33
|
+
the same upstream (measured: 29 owned by `<home>/.build/instar`, 17 by `<home>/.dev/instar`). Both are
|
|
34
|
+
returned, most-owned first, unmerged; a consumer taking only `[0]` gets the largest coherent set, not full
|
|
35
|
+
coverage. Stated in the function's doc comment.
|
|
36
|
+
|
|
37
|
+
**Held back deliberately:** pointing `AgentWorktreeReaper` and `OrphanedWorkSentinel` at the resolved repo
|
|
38
|
+
instead of `config.projectDir`. That is runtime code feeding a guard with delete authority, and the
|
|
39
|
+
misresolution above is evidence that getting it wrong is easy — so it goes through the Tier 2 spec +
|
|
40
|
+
operator-approval path as a small focused follow-up, registered as a commitment.
|
|
41
|
+
|
|
42
|
+
## What to Tell Your User
|
|
43
|
+
|
|
44
|
+
Nothing changes for you in this release. This adds an internal ability — working out which repository a set
|
|
45
|
+
of working copies belongs to by asking the working copies themselves — and deliberately does not plug it in
|
|
46
|
+
anywhere yet.
|
|
47
|
+
|
|
48
|
+
It exists because the background housekeeper that reclaims finished working copies had been handed a path
|
|
49
|
+
that is not a repository, so it failed to look 98 times in a row while 27 GB of finished copies accumulated.
|
|
50
|
+
Wiring this in is a separate change that needs review before it goes near anything with permission to delete
|
|
51
|
+
directories.
|
|
52
|
+
|
|
53
|
+
## Summary of New Capabilities
|
|
54
|
+
|
|
55
|
+
None that you can use. No new command, endpoint, setting, or behaviour. Two internal helper functions and one
|
|
56
|
+
opt-in parameter that nothing passes yet.
|
|
57
|
+
|
|
58
|
+
## Evidence
|
|
59
|
+
|
|
60
|
+
- `tests/unit/agent-worktree-repo-discovery.test.ts` — 14/14 green.
|
|
61
|
+
- Existing detector suites unmodified and green (`AgentWorktreeDetector`, `-attention-wireup`,
|
|
62
|
+
`WorktreeEnumerationFailureStore`) — 19/19 — which is what shows the old path is untouched when no caller
|
|
63
|
+
opts in.
|
|
64
|
+
- `npm run lint` chain green; `tsc --noEmit` clean.
|
|
65
|
+
- Real-machine measurement: with the caller's own root, discovery returns both repos in count order; with no
|
|
66
|
+
root, resolution returns null exactly as before.
|
|
67
|
+
- Side-effects: `upgrades/side-effects/worktree-repo-discovery.md` · ELI16:
|
|
68
|
+
`docs/specs/worktree-repo-discovery.eli16.md`.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Side-Effects Review — blocking-process-scan lint resolves the command before deciding
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `blocking-process-scan-command-resolution`
|
|
4
|
+
**Date:** `2026-08-14`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required — Tier 1 declared (CI-only tooling, riskFloor 1). No spec change: the §rule is unchanged; the check now resolves the command value before applying the same rule.`
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
`scripts/lint-no-blocking-process-scans.js` enforces the topic-21816 post-mortem's root cause #4: a
|
|
11
|
+
synchronous `ps`/`pgrep`/`lsof`/`pkill` on a runtime hot path blocks the single-threaded event loop, and those
|
|
12
|
+
commands get slow under exactly the load that makes monitors fire — the cumulative stall starved `/health`,
|
|
13
|
+
the supervisor declared the live server unresponsive, and restarted it.
|
|
14
|
+
|
|
15
|
+
The check required the scan command as a string literal INSIDE the call:
|
|
16
|
+
`/\b(spawnSync|execSync|execFileSync)\s*\(\s*['"\`]\s*(ps|pgrep|lsof|pkill)\b/`. Putting the name one step
|
|
17
|
+
away walked past it, while the event loop stalled just the same — the incident was about what the process
|
|
18
|
+
DOES, not how the argument was spelled. instar-codey reproduced the concatenation form against the shipped
|
|
19
|
+
lint (`const cmd = 'pg' + 'rep'; execFileSync(cmd, ['node'])` → exit 0) and scoped the fix.
|
|
20
|
+
|
|
21
|
+
The command is now RESOLVED before the rule is applied: literal `+` chains fold, local `const` string bindings
|
|
22
|
+
resolve, and import aliases of the three sync entry points are followed.
|
|
23
|
+
|
|
24
|
+
## Decision-point inventory
|
|
25
|
+
|
|
26
|
+
- `scanViolation()` — REPLACES the literal-only regex — resolves then decides. CI-time only; never runtime.
|
|
27
|
+
- `foldLiteral()` — ADD — pure literal chains only; a template with `${}` never folds.
|
|
28
|
+
- `collectStringConsts()` — ADD — file-wide, and **deliberately refuses ambiguity** (see §1).
|
|
29
|
+
- `collectSyncNames()` — ADD — follows `import { execFileSync as run } from 'node:child_process'`.
|
|
30
|
+
- The allow comment, the comment-only skip, the scan dirs, and the async remedy are all unchanged.
|
|
31
|
+
- No runtime block/allow decisions added or modified. This runs in `npm run lint` and CI only.
|
|
32
|
+
|
|
33
|
+
## 1. Over-block
|
|
34
|
+
|
|
35
|
+
This is the failure that matters here: the lint blocks commits, so flagging correct code costs more than
|
|
36
|
+
missing a case. Three structural choices push against it, and each has a test:
|
|
37
|
+
|
|
38
|
+
- **The VALUE decides, never the name.** `const pgrep = 'tmux'` is legal; the identifier being called `pgrep`
|
|
39
|
+
is irrelevant.
|
|
40
|
+
- **Word-boundary on the resolved value.** `psql` is not `ps`; `pstree` is not `ps`.
|
|
41
|
+
- **Ambiguity resolves to NOT-flagged.** Bindings are collected file-wide rather than per-scope (a
|
|
42
|
+
line-oriented lint is not a compiler). An identifier bound more than once to DIFFERENT values is recorded as
|
|
43
|
+
unresolvable and never produces a violation — the safe direction, chosen on purpose.
|
|
44
|
+
|
|
45
|
+
Async calls are untouched: `execFile(cmd, …)` with a folded command stays legal, because async yielding the
|
|
46
|
+
loop IS the remedy this lint exists to push people toward.
|
|
47
|
+
|
|
48
|
+
Verified against the real tree: `src/monitoring` + `src/server` report clean, exit 0 — the widened check
|
|
49
|
+
introduces no new flags on existing code.
|
|
50
|
+
|
|
51
|
+
## 2. Under-block
|
|
52
|
+
|
|
53
|
+
Stated in the header rather than implied:
|
|
54
|
+
|
|
55
|
+
- **A call split across multiple lines.** This lint is line-oriented; making it multi-line means an AST, which
|
|
56
|
+
is a different check at a different layer. Pre-existing — not introduced here.
|
|
57
|
+
- **A command read from config, argv, or another module.** Not foldable without dataflow analysis, and
|
|
58
|
+
guessing would over-block.
|
|
59
|
+
- Scope is still the two hot dirs (`src/monitoring`, `src/server`). `src/core`'s tmux-heavy session plumbing
|
|
60
|
+
remains the separate, larger conversion tracked in the post-mortem follow-up.
|
|
61
|
+
|
|
62
|
+
## 3. Level-of-abstraction fit
|
|
63
|
+
|
|
64
|
+
Same layer as the shipped check — line-oriented regex over source, no AST, no type information, no new
|
|
65
|
+
dependency. The added machinery (fold, const map, alias map, first-arg extractor) is the minimum needed to
|
|
66
|
+
answer "what command does this actually run?" without climbing to a parser. Codey rated this scope
|
|
67
|
+
"low/medium FP risk if limited to child_process sync aliases plus literal/constant-folded command values in
|
|
68
|
+
src/monitoring and src/server" — that is exactly the scope implemented.
|
|
69
|
+
|
|
70
|
+
## 4. Signal vs authority compliance
|
|
71
|
+
|
|
72
|
+
Unchanged. A CI guard, not a runtime authority. It forbids a synchronous enumeration on the hot path; the
|
|
73
|
+
async equivalent remains the sanctioned path, and the reviewed one-shot escape hatch still works.
|
|
74
|
+
|
|
75
|
+
## 5. Interactions
|
|
76
|
+
|
|
77
|
+
- `npm run lint` chain (`package.json`) — position unchanged; full chain green.
|
|
78
|
+
- `--staged` path and explicit-file args unchanged in behaviour.
|
|
79
|
+
- Husky pre-commit / CI run the same chain.
|
|
80
|
+
- No source module, route, config key, or state file is touched.
|
|
81
|
+
|
|
82
|
+
## 6. External surfaces
|
|
83
|
+
|
|
84
|
+
None. No HTTP route, no config key, no user-visible message, no CLAUDE.md template change (developer-facing
|
|
85
|
+
tooling, not an agent capability). Agent Awareness Standard does not apply.
|
|
86
|
+
|
|
87
|
+
## 7. Rollback cost
|
|
88
|
+
|
|
89
|
+
`git revert` of one script plus one test file. No migration, no state, no deployed artifact.
|
|
90
|
+
|
|
91
|
+
## Conclusion
|
|
92
|
+
|
|
93
|
+
Ship. Four evasions closed, each with a test that fails without the fix; six anti-over-block controls added
|
|
94
|
+
alongside; real tree verified clean.
|
|
95
|
+
|
|
96
|
+
## Second-pass review (if required)
|
|
97
|
+
|
|
98
|
+
Not required at Tier 1. Independent corroboration exists regardless: instar-codey reproduced the evasion
|
|
99
|
+
separately and pre-scoped the remedy, including the warning not to overmatch all sync child-process calls.
|
|
100
|
+
|
|
101
|
+
## Evidence pointers
|
|
102
|
+
|
|
103
|
+
- `tests/unit/lint-no-blocking-process-scans.test.ts` — 14/14 green (5 original + 9 added).
|
|
104
|
+
- Negative control: tests written BEFORE the fix and run against the shipped lint — **4 of 14 fail**
|
|
105
|
+
(const concatenation, plain variable, inline concatenation, import alias); the 10 others pass both ways,
|
|
106
|
+
which is what makes the controls controls.
|
|
107
|
+
- Real-tree verdict: `node scripts/lint-no-blocking-process-scans.js` → `clean`, exit 0.
|
|
108
|
+
- Full `npm run lint` chain green.
|
|
109
|
+
- Source incident: `docs/postmortems/2026-06-07-server-temporarily-down.md` (root cause #4).
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Side-Effects Review — ask the worktrees which repo owns them
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `worktree-repo-discovery`
|
|
4
|
+
**Date:** `2026-08-14`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required — Tier 1: pure addition with NO caller, therefore no runtime behaviour change on any agent. The consuming wiring is deliberately NOT in this change (see "What is deliberately not here").`
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
Adds two exported helpers to `src/core/AgentWorktreeDetector.ts` and one option on
|
|
11
|
+
`resolveDetectorInstarRepo`:
|
|
12
|
+
|
|
13
|
+
- `parseWorktreeGitPointer(contents)` — `gitdir: /repo/.git/worktrees/<slug>` → `/repo`, or null for anything
|
|
14
|
+
that is not exactly that shape.
|
|
15
|
+
- `discoverInstarRepoFromWorktrees(roots, {maxWorktrees})` — reads each worktree's `.git` POINTER FILE under
|
|
16
|
+
the given roots and returns the owning repo roots, ordered by how many worktrees name each.
|
|
17
|
+
- `ResolveDetectorRepoOptions.worktreeRoots` — when a caller passes ITS OWN `.worktrees` root(s), the
|
|
18
|
+
discovered repos join the candidate chain after the operator-supplied `worktree.repoPath` and before the
|
|
19
|
+
conventional-location guesses. Omitted ⇒ no candidates ⇒ byte-identical behaviour.
|
|
20
|
+
|
|
21
|
+
**Nothing calls it yet.** This lands the mechanism, verified, with the consuming wiring held back.
|
|
22
|
+
|
|
23
|
+
## Why it exists (observed, not hypothesised)
|
|
24
|
+
|
|
25
|
+
On a live agent, 2026-08-14: `GET /worktrees/agent-reaper` reported `enumerationOk: false`,
|
|
26
|
+
`enumerationFailures: 98`, error `git -C <agent home> worktree list --porcelain → fatal: not a git
|
|
27
|
+
repository` — while 45 worktrees and **27 GB** sat under that agent home.
|
|
28
|
+
|
|
29
|
+
Two blind spots, both a path assumed rather than resolved. `resolveDetectorInstarRepo` guessed at
|
|
30
|
+
`~/Documents/Projects/instar` and `~/instar`; neither exists there, so it returned null and the detector's
|
|
31
|
+
`if (repo)` guard silently skipped every tick. Separately the reaper was wired to `config.projectDir`, which
|
|
32
|
+
on that layout is the agent home and is not a repo at all.
|
|
33
|
+
|
|
34
|
+
The answer was on disk the whole time: a linked worktree's `.git` is a file naming its owning repo. This is
|
|
35
|
+
also the same defect class the reaper's own header records for 2026-07-29 — *"the reaper reported
|
|
36
|
+
`reclaimable: 0` against 73 worktrees because `git -C <path> worktree list` was failing outright."* That fix
|
|
37
|
+
made the failure VISIBLE (`enumerationOk` / `reclaimable: null`), which is how this was found; it did not make
|
|
38
|
+
resolution work.
|
|
39
|
+
|
|
40
|
+
## Decision-point inventory
|
|
41
|
+
|
|
42
|
+
- `parseWorktreeGitPointer` — ADD — pure function; returns null on anything unrecognised.
|
|
43
|
+
- `discoverInstarRepoFromWorktrees` — ADD — filesystem reads only, bounded by `maxWorktrees` (default 200).
|
|
44
|
+
- `ResolveDetectorRepoOptions.worktreeRoots` — ADD — inert unless passed.
|
|
45
|
+
- No runtime block/allow decision added or modified. No caller changed.
|
|
46
|
+
|
|
47
|
+
## 1. Over-block
|
|
48
|
+
|
|
49
|
+
Not applicable in the gate sense (nothing is blocked), but the analogous failure is **naming a wrong repo**,
|
|
50
|
+
and one real instance was caught during development and is now pinned by a test:
|
|
51
|
+
|
|
52
|
+
The first draft defaulted the discovery roots to `enumerateSafeRoots()`. That helper enumerates EVERY agent
|
|
53
|
+
home on the machine, so the agent asking the question resolved to a **different agent's repo** — whichever
|
|
54
|
+
owned the most worktrees. Measured on the real box: `echo` resolved to `instar-codey/repo`. A confident wrong
|
|
55
|
+
repo is strictly worse than the null this change removes — null makes a consumer skip, a wrong repo makes it
|
|
56
|
+
act. The API now has NO default: a caller must name its own root, documented on the option itself, and a test
|
|
57
|
+
asserts resolution takes no worktree candidate when none is named.
|
|
58
|
+
|
|
59
|
+
Other non-answers all return null/empty rather than a guess: a full clone under `.worktrees/` (its `.git` is a
|
|
60
|
+
directory, not a pointer), a malformed pointer, a submodule gitdir with no `/.git/worktrees/` segment, a
|
|
61
|
+
directory with no `.git`, an unreadable file, a missing root.
|
|
62
|
+
|
|
63
|
+
## 2. Under-block
|
|
64
|
+
|
|
65
|
+
**One agent's `.worktrees/` can legitimately hold worktrees of MORE THAN ONE clone of the same upstream.**
|
|
66
|
+
Measured on the agent that surfaced this: 29 worktrees owned by `<home>/.build/instar` and 17 by
|
|
67
|
+
`<home>/.dev/instar`. The helper returns BOTH, most-owned first; it does not merge them. A single-repo
|
|
68
|
+
consumer that takes only `[0]` therefore gets the largest coherent set and still will not see the smaller
|
|
69
|
+
repo's worktrees. That is an improvement over enumerating nothing and it is not full coverage — stated in the
|
|
70
|
+
function's own doc comment rather than left to be discovered.
|
|
71
|
+
|
|
72
|
+
Also unchanged: `resolveInstarRepo` still integrity-validates every candidate, so a discovered path that is
|
|
73
|
+
not a valid instar repo is rejected exactly as before.
|
|
74
|
+
|
|
75
|
+
## 3. Level-of-abstraction fit
|
|
76
|
+
|
|
77
|
+
Filesystem reads in a module that already does filesystem enumeration (`enumerateSafeRoots` next door).
|
|
78
|
+
**Deliberately no subprocess** — reading the pointer file is cheaper than `git rev-parse`, cannot block the
|
|
79
|
+
event loop, and keeps the helper usable from the runtime hot dirs where `lint-no-blocking-process-scans`
|
|
80
|
+
applies.
|
|
81
|
+
|
|
82
|
+
## 4. Signal vs authority compliance
|
|
83
|
+
|
|
84
|
+
The helper produces CANDIDATES, never an authority. Every candidate is still validated by `resolveInstarRepo`
|
|
85
|
+
before anything believes it. An operator-supplied `worktree.repoPath` continues to win outright.
|
|
86
|
+
|
|
87
|
+
## 5. Interactions
|
|
88
|
+
|
|
89
|
+
- `resolveDetectorInstarRepo()` with no `worktreeRoots` is byte-identical to before — verified by the existing
|
|
90
|
+
detector suites (19/19 green, unmodified).
|
|
91
|
+
- No consumer passes `worktreeRoots` in this change, so no runtime path changes on any agent.
|
|
92
|
+
|
|
93
|
+
## 6. External surfaces
|
|
94
|
+
|
|
95
|
+
None. No HTTP route, no config key, no user-visible message. Not an agent capability, so the Agent Awareness
|
|
96
|
+
Standard does not apply.
|
|
97
|
+
|
|
98
|
+
## 7. Rollback cost
|
|
99
|
+
|
|
100
|
+
`git revert` of one source file plus one test file. No migration, no state, no deployed artifact, and — since
|
|
101
|
+
nothing calls it — no behaviour to restore.
|
|
102
|
+
|
|
103
|
+
## What is deliberately NOT here, and why
|
|
104
|
+
|
|
105
|
+
The consuming wiring (pointing `AgentWorktreeReaper` and `OrphanedWorkSentinel` at the resolved repo instead
|
|
106
|
+
of `config.projectDir`) is **held back for a Tier 2 spec + operator approval.** It is runtime code feeding a
|
|
107
|
+
guard with delete authority, and the cross-agent misresolution above is direct evidence that getting
|
|
108
|
+
resolution wrong here is easy. Landing the mechanism first makes that follow-up a small, focused, individually
|
|
109
|
+
reviewable diff. It is registered as a commitment, not an intention.
|
|
110
|
+
|
|
111
|
+
## Conclusion
|
|
112
|
+
|
|
113
|
+
Ship. Verified mechanism, zero runtime effect, one real misresolution caught during development and pinned by
|
|
114
|
+
a test.
|
|
115
|
+
|
|
116
|
+
## Evidence pointers
|
|
117
|
+
|
|
118
|
+
- `tests/unit/agent-worktree-repo-discovery.test.ts` — 14/14 green.
|
|
119
|
+
- Existing detector suites unmodified and green: `AgentWorktreeDetector`, `-attention-wireup`,
|
|
120
|
+
`WorktreeEnumerationFailureStore` — 19/19.
|
|
121
|
+
- Full `npm run lint` chain green; `tsc --noEmit` clean.
|
|
122
|
+
- Real-machine measurement: with the caller's own root, discovery returns
|
|
123
|
+
`[<home>/.build/instar, <home>/.dev/instar]` (29 and 17 worktrees respectively); with no root, resolution
|
|
124
|
+
returns null exactly as before.
|