Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: stop the transcript persistence test paying per-flush directory fsyncs (#11800)

Adam Eivy7063c2e9d49f
diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.js
index 92cde941fb..70f7e1b28e 100644
--- a/server/services/agentCliSpawning.test.js
+++ b/server/services/agentCliSpawning.test.js
@@ -129,6 +129,18 @@ vi.mock('./providers.js', () => ({
vi.mock('../lib/privateSecuritySandbox.js', () => ({
preparePrivateSecuritySpawn: vi.fn(),
}));
+// Real publication admission fsyncs a directory on every flush. A byte-volume
+// test with hundreds of flushes opts out so disk latency under load cannot eat
+// its timeout; the admission contract keeps its own real-boundary test.
+const publicationAdmission = vi.hoisted(() => ({ bypass: false }));
+vi.mock('../lib/backupSnapshotBoundary.js', async (importActual) => {
+ const actual = await importActual();
+ return {
+ ...actual,
+ withBackupAssetPublication: (work, options) =>
+ publicationAdmission.bypass ? work() : actual.withBackupAssetPublication(work, options),
+ };
+});
import { buildCliSpawnConfig, spawnDirectly } from './agentCliSpawning.js';
import { promptOpensOwnPr } from './promptSections/completion.js';
@@ -933,6 +945,7 @@ describe('stream error containment', () => {
writeFileGuarded.mockImplementation((path, bytes, options) => fs.writeFile(path, bytes, options));
});
afterEach(async () => {
+ publicationAdmission.bypass = false;
writeFileGuarded.mockResolvedValue(undefined);
await fs.rm(dir, { recursive: true, force: true });
});
@@ -949,6 +962,7 @@ describe('stream error containment', () => {
// 240 flushes model one minute at the 250ms batch cadence without sleeps.
// Before the stderr suffix, full-prefix writes submitted 238,878,720
// bytes for 1,966,080 bytes of output; deltas plus final rewrite need 3,932,160.
+ publicationAdmission.bypass = true;
await fs.writeFile(join(dir, 'output.txt'), 'stale previous transcript');
await spawnDirectly({ ...minimalArgs, agentDir: dir,
cliConfig: { command: 'claude', args: [], stdinMode: 'prompt', streamFormat: 'text' } });