🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(console): worktree removal stops running the repo's fsmonitor and hooks, and keeps untracked files
Dragan Spiridonova62c6e6ee916
diff --git a/plugins/ruflo-console/hooks/adr-mission.ts b/plugins/ruflo-console/hooks/adr-mission.tsindex f6ef4d52a7..bb0092c84f 100644--- a/plugins/ruflo-console/hooks/adr-mission.ts+++ b/plugins/ruflo-console/hooks/adr-mission.ts@@ -107,7 +107,7 @@ export async function syncAdrDigest(state: State, host: Host): Promise<void> {/** Files changed in the project: uncommitted work, and commits since the mission began. Read-only git. */export async function changedFiles(host: Pick<Host, 'run'>, cwd: string, sinceMs: number): Promise<string[]> {const out = new Set<string>()- const status = await host.run(['git', '-C', cwd, 'status', '--porcelain'], 15_000).catch(() => null)+ const status = await host.run(['git', '-C', cwd, '--no-optional-locks', '-c', 'core.fsmonitor=false', 'status', '--porcelain'], 15_000).catch(() => null)for (const line of (status?.stdout ?? '').split('\n')) {const path = line.slice(3).split(' -> ').pop()?.trim().replace(/^"|"$/g, '')diff --git a/plugins/ruflo-console/hooks/data/wf-worktrees.ts b/plugins/ruflo-console/hooks/data/wf-worktrees.tsindex 9099a25b62..d5d860ff1a 100644--- a/plugins/ruflo-console/hooks/data/wf-worktrees.ts+++ b/plugins/ruflo-console/hooks/data/wf-worktrees.ts@@ -46,13 +46,18 @@ export const REMOVABLE_DIRS = ['.claude/worktrees', '.git-worktrees'] as constexport const LIST_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, 'worktree', 'list', '--porcelain']// status is the one probe that can run a program from the repository's config (core.fsmonitor) and that refreshes the index (a write, and a lock another-// session's git may want): both are switched off, after '-C <dir>' so the directory stays the third word.-export const STATUS_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, '--no-optional-locks', '-c', 'core.fsmonitor=false', 'status', '--porcelain=v1']+// session's git may want): both are switched off, after '-C <dir>' so the directory stays the third word. Untracked files are listed whatever+// status.showUntrackedFiles says: with it at 'no' a worktree holding new, unsaved files would read clean, and removal deletes them.+export const STATUS_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, '--no-optional-locks', '-c', 'core.fsmonitor=false', 'status', '--porcelain=v1', '--untracked-files=normal']/** Ignored files and folders (a folder is one entry): 'git worktree remove' deletes these too, and they are where a .env or a key lives. */export const IGNORED_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, '--no-optional-locks', '-c', 'core.fsmonitor=false', 'ls-files', '--others', '--ignored', '--exclude-standard', '--directory']export const AHEAD_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, 'rev-list', '--left-right', '--count', 'origin/main...HEAD']export const REF_ARGV = (dir: string): readonly string[] => ['git', '-C', dir, 'log', '-1', '--format=%ct', 'origin/main']-export const REMOVE_ARGV = (main: string, path: string): readonly string[] => ['git', '-C', main, 'worktree', 'remove', path]+// Removal runs its own `git status` on the worktree first. That runs core.fsmonitor and fires post-index-change from the repository (its+// config or .git/hooks), so both are switched off. It also skips untracked files when status.showUntrackedFiles is 'no', and then deletes+// them without --force, so the setting is pinned to git's default. Still possible: a filter.<driver>.clean or .process command (see diffArgv+// in wf-drill-io.ts), and changes hidden by index flags (assume-unchanged, skip-worktree, core.ignoreStat), which git's check does not see.+export const REMOVE_ARGV = (main: string, path: string): readonly string[] => ['git', '-C', main, '-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', '-c', 'status.showUntrackedFiles=normal', 'worktree', 'remove', path]export const PROCS_ARGV: readonly string[] = ['/usr/bin/find', '/proc', '-maxdepth', '3', '-regextype', 'posix-extended', '-regex', '/proc/[0-9]+/(cwd|exe|fd/[0-9]+)', '-lname', '/*', '-printf', '%p\\t%l\\n']// eslint-disable-next-line no-control-regexdiff --git a/plugins/ruflo-console/hooks/register.ts b/plugins/ruflo-console/hooks/register.tsindex 296c89d4ee..59026df35e 100644--- a/plugins/ruflo-console/hooks/register.ts+++ b/plugins/ruflo-console/hooks/register.ts@@ -183,7 +183,7 @@ export const register: Register = (on, raw: PluginOptions) => {const built = here.run(['git', '-C', root, 'rev-parse', '--show-prefix'], 3_000)- .then(prefix => (prefix.exitCode === 0 && isOurCheckout(prefix.stdout) ? here.run(['git', '-C', root, 'describe', '--always', '--dirty', '--abbrev=7'], 3_000) : null))+ .then(prefix => (prefix.exitCode === 0 && isOurCheckout(prefix.stdout) ? here.run(['git', '-C', root, '--no-optional-locks', '-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', 'describe', '--always', '--dirty', '--abbrev=7'], 3_000) : null)).then(described => {setBuild(described !== null && described.exitCode === 0 ? buildOf(described.stdout) : '')here.invalidate()diff --git a/plugins/ruflo-console/tests/fixtures/wf-git.ts b/plugins/ruflo-console/tests/fixtures/wf-git.tsindex 96970b6813..2c6160a0c8 100644--- a/plugins/ruflo-console/tests/fixtures/wf-git.ts+++ b/plugins/ruflo-console/tests/fixtures/wf-git.ts@@ -1,7 +1,7 @@/*** A stand-in for git and /proc for the worktree specs: a fixed list, per-path dirty and ahead counts, ages and a process listing.*/-import { AHEAD_ARGV, IGNORED_ARGV, LIST_ARGV, parseProcs, PROCS_ARGV, REF_ARGV, STATUS_ARGV, type WtIo, type WtRead, type WtRow } from '../../hooks/data/wf-worktrees'+import { AHEAD_ARGV, IGNORED_ARGV, LIST_ARGV, parseProcs, PROCS_ARGV, REF_ARGV, REMOVE_ARGV, STATUS_ARGV, type WtIo, type WtRead, type WtRow } from '../../hooks/data/wf-worktrees'import type { Kit } from '../../hooks/views/common'export const NOW = Date.parse('2026-10-06T12:00:00.000Z')@@ -69,8 +69,8 @@ export function ioOf(w: World): WtIo {if (key === STATUS_ARGV(dir).join(' ')) return { stdout: Array.from({ length: w.dirty[dir] ?? 0 }, (_, i) => ` M f${i}`).join('\n'), stderr: '', exitCode: 0 }if (key === IGNORED_ARGV(dir).join(' ')) return { stdout: w.ignored[dir] ?? '', stderr: '', exitCode: 0 }if (key === AHEAD_ARGV(dir).join(' ')) return w.ahead[dir] === null ? { stdout: '', stderr: 'bad', exitCode: 128 } : { stdout: `0\t${w.ahead[dir] ?? 0}\n`, stderr: '', exitCode: 0 }- if (key.startsWith(`git -C ${ROOT} worktree remove `)) {- const path = argv[5] ?? ''+ if (key === REMOVE_ARGV(ROOT, argv.at(-1) ?? '').join(' ')) {+ const path = argv.at(-1) ?? ''if (w.failRemove.has(path)) return { stdout: '', stderr: 'fatal: contains modified or untracked files', exitCode: 128 }diff --git a/plugins/ruflo-console/tests/git-config-exec.spec.ts b/plugins/ruflo-console/tests/git-config-exec.spec.tsnew file mode 100644index 0000000000..fae53c4d4f--- /dev/null+++ b/plugins/ruflo-console/tests/git-config-exec.spec.ts@@ -0,0 +1,216 @@+/**+ * A repository's own config and .git/hooks can name programs git runs: core.fsmonitor when a command compares the work tree with the index,+ * and post-index-change when one rewrites the index. The console runs git in worktrees and projects it did not make, so its fixed probes switch+ * the fsmonitor off, and removal and describe (which can rewrite the index) also turn hooks off. Removal also lists untracked files whatever+ * status.showUntrackedFiles says, so a worktree holding new files is never read as clean and deleted. Each real-git case has a positive control:+ * the same config does its harm under the plain command, so a marker that stays absent means the guard held, not that the probe could not see it.+ *+ * Not covered here: filter.<driver>.clean/.process commands, lazy fetches in a partial clone, changes hidden by index flags (assume-unchanged,+ * skip-worktree, core.ignoreStat), and commands the person configures themselves (mission gates).+ */+import { execFile, spawn } from 'node:child_process'+import { chmod, mkdtemp, readdir, readFile, rm, stat as statOf, utimes, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { promisify } from 'node:util'++import { afterAll, beforeAll, describe, expect, it } from 'vitest'++import { changedFiles } from '../hooks/adr-mission'+import { diffArgv } from '../hooks/data/wf-drill-io'+import { IGNORED_ARGV, REMOVE_ARGV, STATUS_ARGV } from '../hooks/data/wf-worktrees'++const sh = promisify(execFile)+const PLUGIN = join(__dirname, '..')+const isWin = process.platform === 'win32'+const exists = async (path: string): Promise<boolean> => (await statOf(path).catch(() => null)) !== null++/** Subcommands that compare the work tree with the index, so a repository's core.fsmonitor runs under them. */+const FSMONITOR = /'(status|describe|diff|diff-files|diff-index|ls-files|add|update-index)'|'worktree','remove'/+/** Of those, the ones that can write the index and so fire post-index-change even with --no-optional-locks. */+const WRITES_INDEX = /'describe'|'worktree','remove'/++async function sourceFiles(dir: string): Promise<string[]> {+ const entries = await readdir(dir, { withFileTypes: true }).catch(() => [])+ const nested = await Promise.all(entries.map(entry => (entry.isDirectory() ? sourceFiles(join(dir, entry.name)) : Promise.resolve(/\.(m?ts|m?js)$/.test(entry.name) ? [join(dir, entry.name)] : []))))++ return nested.flat()+}++/** Every array literal in the plugin's runtime code that starts with git, quotes normalised to ' and whitespace removed. */+async function gitLiterals(): Promise<{ where: string; literal: string }[]> {+ const out: { where: string; literal: string }[] = []++ for (const dir of ['hooks', 'tui']) {+ for (const file of await sourceFiles(join(PLUGIN, dir))) {+ const text = await readFile(file, 'utf8')++ for (const match of text.matchAll(/\[\s*["'`]git["'`]\s*,[^\]]*\]/g)) out.push({ where: file.slice(PLUGIN.length + 1), literal: match[0].replace(/["`]/g, "'").replace(/\s+/g, '') })+ }+ }++ return out+}++describe('the fixed git argv the console builds', () => {+ it('the builders for status, ignored files, diff and removal carry core.fsmonitor=false; removal also turns hooks off and lists untracked files', () => {+ for (const argv of [STATUS_ARGV('/x'), IGNORED_ARGV('/x'), diffArgv('/x'), REMOVE_ARGV('/main', '/main/.claude/worktrees/x')]) {+ expect(argv.join(' '), argv.join(' ')).toContain('-c core.fsmonitor=false')+ }++ expect(REMOVE_ARGV('/main', '/p').join(' ')).toContain('-c core.hooksPath=/dev/null -c status.showUntrackedFiles=normal worktree remove')+ expect(REMOVE_ARGV('/main', '/p').at(-1)).toBe('/p')+ expect(STATUS_ARGV('/x')).toContain('--untracked-files=normal')+ })++ it('no git array literal in hooks/ or tui/ reaches an fsmonitor or index-writing subcommand without its guard, and none sets the fsmonitor back', async () => {+ const literals = await gitLiterals()+ const unguarded = literals.filter(({ literal }) => FSMONITOR.test(literal) && !literal.includes("'-c','core.fsmonitor=false'"))+ const hooksOn = literals.filter(({ literal }) => WRITES_INDEX.test(literal) && !literal.includes("'-c','core.hooksPath=/dev/null'"))+ const overridden = literals.filter(({ literal }) => (literal.match(/core\.fsmonitor=/g) ?? []).length > 1)++ expect(literals.length).toBeGreaterThan(5) // the scan sees the probes it is meant to check+ expect(unguarded.map(({ where, literal }) => `${where}: ${literal}`)).toEqual([])+ expect(hooksOn.map(({ where, literal }) => `${where}: ${literal}`)).toEqual([])+ expect(overridden).toEqual([])+ })+})++describe.skipIf(isWin)('against real git', () => {+ let base: string+ let main: string+ const fsmonitorMarker = (): string => join(base, 'fsmonitor-ran')+ const hookMarker = (): string => join(base, 'hook-ran')+ const git = async (cwd: string, ...args: string[]): Promise<string> => (await sh('git', ['-C', cwd, '-c', 'user.name=t', '-c', 'user.email=t@t', '-c', 'commit.gpgsign=false', ...args])).stdout+ const runArgv = (argv: readonly string[]): Promise<number> =>+ new Promise(resolve => {+ const child = spawn(argv[0] as string, argv.slice(1), { stdio: 'ignore' })++ child.on('close', code => resolve(code ?? -1))+ child.on('error', () => resolve(127))+ })+ const hostile = async (): Promise<void> => {+ await rm(fsmonitorMarker(), { force: true })+ await rm(hookMarker(), { force: true })+ await git(main, 'config', 'core.fsmonitor', `touch ${fsmonitorMarker()}; false`)+ }+ // A new mtime with the same content: the index entry goes stale, so a command that refreshes the index rewrites it.+ let tick = 1+ const restat = async (): Promise<void> => {+ const when = new Date(Date.UTC(2020, 0, tick++))++ await utimes(join(main, 'a.txt'), when, when)+ }++ beforeAll(async () => {+ base = await mkdtemp(join(tmpdir(), 'git-config-exec-'))+ main = join(base, 'main')+ await sh('git', ['init', '-b', 'main', main])+ await writeFile(join(main, 'a.txt'), 'one\n')+ await git(main, 'add', '.')+ await git(main, 'commit', '-m', 'init')++ const hook = join(main, '.git', 'hooks', 'post-index-change')++ await writeFile(hook, `#!/bin/sh\ntouch '${hookMarker()}'\n`)+ await chmod(hook, 0o755)+ }, 30_000)++ afterAll(async () => {+ await rm(base, { recursive: true, force: true })+ })++ it('control: the plain removal runs the hostile fsmonitor and the post-index-change hook', async () => {+ const path = join(base, 'wt-control')++ await git(main, 'worktree', 'add', '-b', 'b-control', path)+ await hostile()+ expect(await runArgv(['git', '-C', main, 'worktree', 'remove', path])).toBe(0)+ expect(await exists(path)).toBe(false)+ expect(await exists(fsmonitorMarker())).toBe(true)+ expect(await exists(hookMarker())).toBe(true)+ }, 30_000)++ it('REMOVE_ARGV removes the worktree and runs neither', async () => {+ const path = join(base, 'wt-guarded')++ await git(main, 'worktree', 'add', '-b', 'b-guarded', path)+ await hostile()+ expect(await runArgv(REMOVE_ARGV(main, path))).toBe(0)+ expect(await exists(path)).toBe(false)+ expect(await exists(fsmonitorMarker())).toBe(false)+ expect(await exists(hookMarker())).toBe(false)+ }, 30_000)++ it('with status.showUntrackedFiles=no, the probe still sees a new file and REMOVE_ARGV refuses; the plain removal deletes it (control)', async () => {+ await git(main, 'config', '--unset', 'core.fsmonitor').catch(() => '')+ await git(main, 'config', 'status.showUntrackedFiles', 'no')++ try {+ const control = join(base, 'wt-untracked-control')+ const guarded = join(base, 'wt-untracked')++ for (const [path, branch] of [[control, 'b-untracked-control'], [guarded, 'b-untracked']] as const) {+ await git(main, 'worktree', 'add', '-b', branch, path)+ await writeFile(join(path, 'unsaved.txt'), 'new work\n')+ }++ expect(await runArgv(['git', '-C', main, 'worktree', 'remove', control])).toBe(0)+ expect(await exists(join(control, 'unsaved.txt'))).toBe(false)++ expect((await sh(STATUS_ARGV(guarded)[0] as string, STATUS_ARGV(guarded).slice(1) as string[])).stdout).toContain('?? unsaved.txt')+ expect(await runArgv(REMOVE_ARGV(main, guarded))).not.toBe(0)+ expect(await readFile(join(guarded, 'unsaved.txt'), 'utf8')).toBe('new work\n')+ } finally {+ await git(main, 'config', '--unset', 'status.showUntrackedFiles')+ }+ }, 30_000)++ it("register.ts's describe argv, run as written, runs neither (control: plain describe --dirty fires the hook)", async () => {+ const source = await readFile(join(PLUGIN, 'hooks', 'register.ts'), 'utf8')+ const literal = source.match(/\[\s*'git'[^\]]*'describe'[^\]]*\]/)?.[0]++ expect(literal).toBeDefined()++ // Its elements are quoted words and the identifier `root`; run it with root set to the hostile repository.+ const argv = [...(literal as string).matchAll(/'([^']*)'|([A-Za-z_]\w*)/g)].map(([, word, name]) => (word !== undefined ? word : name === 'root' ? main : `?${name}`))++ expect(argv.some(word => word.startsWith('?'))).toBe(false)++ await hostile()+ await restat()+ expect(await runArgv(['git', '-C', main, 'describe', '--always', '--dirty'])).toBe(0)+ expect(await exists(hookMarker())).toBe(true)++ await hostile()+ await restat()+ expect(await runArgv(argv)).toBe(0)+ expect(await exists(fsmonitorMarker())).toBe(false)+ expect(await exists(hookMarker())).toBe(false)+ }, 30_000)++ it('the mission scope check reads changed files without running the hostile fsmonitor (control: plain status runs it)', async () => {+ await writeFile(join(main, 'a.txt'), 'changed\n')+ await hostile()+ expect(await runArgv(['git', '-C', main, 'status', '--porcelain'])).toBe(0)+ expect(await exists(fsmonitorMarker())).toBe(true)++ await hostile()++ const host = {+ run: async (argv: readonly string[]) => {+ try {+ const { stdout, stderr } = await sh(argv[0] as string, argv.slice(1) as string[])++ return { exitCode: 0, stdout, stderr }+ } catch (error) {+ return { exitCode: 1, stdout: '', stderr: String(error) }+ }+ },+ }++ expect(await changedFiles(host, main, Date.now())).toContain('a.txt')+ expect(await exists(fsmonitorMarker())).toBe(false)+ await git(main, 'checkout', '--', 'a.txt')+ }, 30_000)+})diff --git a/plugins/ruflo-console/tests/tui-ai-host.spec.ts b/plugins/ruflo-console/tests/tui-ai-host.spec.tsindex 5054002a6d..7b5959dfb3 100644--- a/plugins/ruflo-console/tests/tui-ai-host.spec.ts+++ b/plugins/ruflo-console/tests/tui-ai-host.spec.ts@@ -51,24 +51,27 @@ describe('the pinned Codex', () => {expect(await resolveCodex(root, newer)).toMatchObject({ ok: false, why: expect.stringMatching(/pinned Codex 0\.162\.0 is not installed/) })})+ // Each release case has a home of its own: the next one writes the pinned release, and in a shuffled run it could go first.it('finds the release directory named for the pinned version, never current and never PATH', async () => {- const releases = join(root, '.codex', 'packages', 'standalone', 'releases')+ const home = mkdtempSync(join(root, 'home-'))+ const releases = join(home, '.codex', 'packages', 'standalone', 'releases')mkdirSync(join(releases, '0.162.1-x86_64-unknown-linux-musl', 'bin'), { recursive: true })- mkdirSync(join(root, '.codex', 'packages', 'standalone', 'current'), { recursive: true })+ mkdirSync(join(home, '.codex', 'packages', 'standalone', 'current'), { recursive: true })// Another version on disk, and a codex on PATH that claims the pinned version: neither is used.writeFileSync(join(releases, '0.162.1-x86_64-unknown-linux-musl', 'bin', 'codex'), '#!/bin/sh\necho "codex-cli 0.162.0"\n')chmodSync(join(releases, '0.162.1-x86_64-unknown-linux-musl', 'bin', 'codex'), 0o755)- expect(await resolveCodex(root)).toMatchObject({ ok: false, why: expect.stringMatching(/never uses current or PATH/) })+ expect(await resolveCodex(home)).toMatchObject({ ok: false, why: expect.stringMatching(/never uses current or PATH/) })})it.skipIf(isWin)('finds the exact release when it is there', async () => {- const dir = join(root, '.codex', 'packages', 'standalone', 'releases', '0.162.0-x86_64-unknown-linux-musl', 'bin')+ const home = mkdtempSync(join(root, 'home-'))+ const dir = join(home, '.codex', 'packages', 'standalone', 'releases', '0.162.0-x86_64-unknown-linux-musl', 'bin')mkdirSync(dir, { recursive: true })writeFileSync(join(dir, 'codex'), readFileSync(FAKE))chmodSync(join(dir, 'codex'), 0o755)- expect(await resolveCodex(root)).toEqual({ ok: true, bin: join(dir, 'codex') })+ expect(await resolveCodex(home)).toEqual({ ok: true, bin: join(dir, 'codex') })})it('spawn refuses anything but a read-only codex exec, before a process starts, and with no AI options at all', () => {diff --git a/plugins/ruflo-console/tests/wf-security-worktrees.spec.ts b/plugins/ruflo-console/tests/wf-security-worktrees.spec.tsindex 550dda1b43..be07b5e01f 100644--- a/plugins/ruflo-console/tests/wf-security-worktrees.spec.ts+++ b/plugins/ruflo-console/tests/wf-security-worktrees.spec.ts@@ -110,7 +110,11 @@ const rowOf = (name: string): WtRow => storeFor(state).read?.rows.find(entry =>// neither of, so on another kernel they measure the test machine, not the guard. CI runs them on Linux.const onLinux = process.platform === 'linux'-describe('the removal guard against a real repository', () => {+// One repository, in steps: the first case reads it, the second removes from it and the third adds to it. The order is the test, so it is fixed+// (a shuffled run reorders them), and each real-git case gets the minute the header asks for rather than vitest's 5 s.+const GIT_MS = 60_000++describe('the removal guard against a real repository', { shuffle: false }, () => {it.skipIf(!onLinux)('offers exactly the merged, clean, idle, old, not-current worktrees, and keeps everything else with the right reason', async () => {await refreshWorktrees(state, host, true)@@ -135,7 +139,7 @@ describe('the removal guard against a real repository', () => {expect(why[join(base, 'outside-wt')]).toMatch(/outside/)expect(why[main]).toBe('the main worktree')expect(rowOf('old').createdMs).toBeLessThan(Date.now() - MIN_AGE_MS)- })+ }, GIT_MS)it.skipIf(!onLinux)('removes only those, one at a time, never a branch, and a path that reads like a command line is one argv element', async () => {const spec = removalSpec(envOf())@@ -154,7 +158,7 @@ describe('the removal guard against a real repository', () => {expect(await git(main, 'branch', '--list', 'b-old', 'b-old2', 'b-rfforcexy')).toMatch(/b-old/)expect(state.outcome?.detail).toBe('3 removed, 0 kept')expect(state.outcome?.verified).toBe('yes')- })+ }, GIT_MS)it.skipIf(!onLinux)('re-checks each worktree at the moment of removal: one made dirty, in use or unmerged after the confirm is kept', async () => {for (const name of ['race-dirty', 'race-busy', 'race-ahead', 'race-ok']) {@@ -182,7 +186,7 @@ describe('the removal guard against a real repository', () => {expect(await exists(wtPath('race-ok'))).toBe(false)expect(state.outcome?.lines?.join('\n')).toMatch(/kept \S*race-dirty: 1 changed/)expect(await exists(join(wtPath('race-dirty'), 'a.txt'))).toBe(true)- })+ }, GIT_MS)it('every probe that can consult the repository config switches fsmonitor off and takes no optional lock', () => {const argv = STATUS_ARGV('/x').join(' ')@@ -200,5 +204,5 @@ describe('the removal guard against a real repository', () => {await refreshWorktrees(state, host, false)await git(main, 'config', '--unset', 'core.fsmonitor')expect(await exists(marker)).toBe(false)- })+ }, GIT_MS)})diff --git a/plugins/ruflo-console/tests/wf-send-stub.spec.ts b/plugins/ruflo-console/tests/wf-send-stub.spec.tsindex a96b408e7a..d8de4a88e1 100644--- a/plugins/ruflo-console/tests/wf-send-stub.spec.ts+++ b/plugins/ruflo-console/tests/wf-send-stub.spec.ts@@ -64,12 +64,17 @@ describe('the stub endpoint receives exactly what the card showed', () => {expect(card.ok).toBe(true)+ // Counted from here: the other cases share this server, and a shuffled run can send first.+ const before = seen.lengthconst answered = await sendTo(d, target, 'compare raft and paxos')- expect(seen).toHaveLength(1)- expect(seen[0]).toMatchObject({ method: 'POST', url: '/v1/chat/completions', contentType: 'application/json', authorization: `Bearer ${KEY}` })- expect(seen[0]?.body).toBe(chatBody({ name: 'stub', baseUrl: base, keyEnv: 'STUB_MODEL_KEY', model: 'stub-model' }, 'compare raft and paxos'))- expect(card.ok && card.payload.shows).toContain(seen[0]?.body)+ expect(seen).toHaveLength(before + 1)++ const sent = seen[before]++ expect(sent).toMatchObject({ method: 'POST', url: '/v1/chat/completions', contentType: 'application/json', authorization: `Bearer ${KEY}` })+ expect(sent?.body).toBe(chatBody({ name: 'stub', baseUrl: base, keyEnv: 'STUB_MODEL_KEY', model: 'stub-model' }, 'compare raft and paxos'))+ expect(card.ok && card.payload.shows).toContain(sent?.body)expect(card.ok && card.payload.shows).toContain('Authorization: Bearer ‹from $STUB_MODEL_KEY›')expect(card.ok && card.payload.shows).not.toContain(KEY)expect(answered).toMatchObject({ ok: true, state: 'reply', tokensIn: 7, tokensOut: 5, costUsd: 0.00012, model: 'stub-model' })@@ -87,9 +92,11 @@ describe('the stub endpoint receives exactly what the card showed', () => {it('with NONE as the key name no Authorization header is sent', async () => {const d = depsOf(`endpoint:open=${base}|NONE|stub-model`)+ const before = seen.lengthawait sendTo(d, targetOf(d, 'open'), 'hi')- expect(seen.at(-1)?.authorization).toBeUndefined()+ expect(seen).toHaveLength(before + 1)+ expect(seen[before]?.authorization).toBeUndefined()})})diff --git a/plugins/ruflo-console/tests/wf-worktrees-view.spec.ts b/plugins/ruflo-console/tests/wf-worktrees-view.spec.tsindex 3ac4132454..96169a5542 100644--- a/plugins/ruflo-console/tests/wf-worktrees-view.spec.ts+++ b/plugins/ruflo-console/tests/wf-worktrees-view.spec.ts@@ -88,11 +88,11 @@ describe('the board and the confirm-gated removal', () => {const spec = removalSpec(envOf())expect(spec).not.toBeNull()- expect(spec?.shows).toBe(`git -C ${ROOT} worktree remove ${wt('old')}`)+ expect(spec?.shows).toBe(`git -C ${ROOT} -c core.fsmonitor=false -c core.hooksPath=/dev/null -c status.showUntrackedFiles=normal worktree remove ${wt('old')}`)expect(spec?.shows).not.toContain('--force')expect(spec).toMatchObject({ declared: 'delete', args: [], label: 'remove 1 merged, clean worktree' })expect(spec?.note).toMatch(/branches stay/)- expect(REMOVE_ARGV(ROOT, wt('old'))).toEqual(['git', '-C', ROOT, 'worktree', 'remove', wt('old')])+ expect(REMOVE_ARGV(ROOT, wt('old'))).toEqual(['git', '-C', ROOT, '-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', '-c', 'status.showUntrackedFiles=normal', 'worktree', 'remove', wt('old')])})it('offers nothing before the live processes were checked (the timer read never checks them)', async () => {