Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Native descriptor probe: lsof's warnings about file systems it cannot stat no longer fail it

bitcoinbuilder8ddbb84b1d56
diff --git a/cli/src/engines/kit/nativeDescriptors.lsof.spec.ts b/cli/src/engines/kit/nativeDescriptors.lsof.spec.ts
new file mode 100644
index 000000000..5e37a655f
--- /dev/null
+++ b/cli/src/engines/kit/nativeDescriptors.lsof.spec.ts
@@ -0,0 +1,28 @@
+// lsof warns on stderr about a file system it cannot stat, while its own listing is complete, and the native probe reads
+// any stderr as failure: no Codex session in a Harness Team account whose owner has an OrbStack NFS mount was ever
+// confirmed (Mac Auto, 2026-10-29). The descriptor probe asks lsof not to warn.
+import { afterEach, expect, it, vi } from 'vitest'
+
+const calls: string[][] = []
+vi.mock('node:child_process', async original => ({ ...await original<object>(),
+ execFile: (command: string, args: string[], _options: unknown, done: (error: Error | null, out: Buffer, err: Buffer) => void) => {
+ calls.push([command, ...args])
+ const listing = Buffer.from('p42\0\nf3\0tREG\0D0x1\0i7\0n/rollout.jsonl\0\n')
+ // What lsof wrote in the Team account: exit 0, a complete listing, and a warning unless -w.
+ const warning = args.includes('-w') ? '' : 'lsof: WARNING: can\'t stat() nfs file system /Users/owner/OrbStack\n Output information may be incomplete.\n'
+ done(null, listing, Buffer.from(warning))
+ },
+}))
+
+const platform = Object.getOwnPropertyDescriptor(process, 'platform')!
+afterEach(() => { Object.defineProperty(process, 'platform', platform); calls.length = 0 })
+
+it('reads a process\'s descriptors past lsof\'s warnings about file systems it cannot stat', async () => {
+ Object.defineProperty(process, 'platform', { ...platform, value: 'darwin' })
+ const { readDescriptorEvidence } = await import('./nativeDescriptors.js')
+ const { NativeEvidenceBudget } = await import('./nativeEvidence.js')
+ const evidence = await readDescriptorEvidence(42, new NativeEvidenceBudget())
+ expect(evidence.descriptors).toEqual([expect.objectContaining({ fd: '3', path: '/rollout.jsonl' })])
+ await evidence.verify()
+ expect(calls[0]).toEqual(['lsof', '-n', '-P', '-w', '-p', '42', '-F0pftDin'])
+})
diff --git a/cli/src/engines/kit/nativeDescriptors.ts b/cli/src/engines/kit/nativeDescriptors.ts
index 499133372..df40e0069 100644
--- a/cli/src/engines/kit/nativeDescriptors.ts
+++ b/cli/src/engines/kit/nativeDescriptors.ts
@@ -92,8 +92,11 @@ async function linuxDescriptors(pid: number, budget: NativeEvidenceBudget): Prom
export async function readDescriptorEvidence(pid: number, budget: NativeEvidenceBudget): Promise<DescriptorEvidence> {
if (!Number.isSafeInteger(pid) || pid <= 0) return nativeUnavailable('the native descriptor owner is invalid')
+ // `-w`: lsof warns on stderr about any file system it cannot stat, its own process's files complete regardless, and
+ // the probe reads stderr as failure. A Harness Team account cannot stat its owner's OrbStack NFS mount under their home,
+ // so no Codex session there was ever confirmed and each start failed at 3 minutes (Mac Auto, 2026-10-29).
const read = () => process.platform === 'linux' ? linuxDescriptors(pid, budget)
- : nativeProbe('lsof', ['-n', '-P', '-p', String(pid), '-F0pftDin'], budget, 1024 * 1024)
+ : nativeProbe('lsof', ['-n', '-P', '-w', '-p', String(pid), '-F0pftDin'], budget, 1024 * 1024)
.then(output => parseDescriptors(output, pid, budget))
const descriptors = await read(), before = signature(descriptors)
return { descriptors, verify: async () => {