Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(lp-g): ask the same delete again until it settles; a preparation past the reply wait returned write_pending once the new page's index build overlapped it (#7106)

garrytanced1a2334914
diff --git a/test/pathological/lp-g-file-digest-fence-bound.test.ts b/test/pathological/lp-g-file-digest-fence-bound.test.ts
index f7b41a179b..4bc788656a 100644
--- a/test/pathological/lp-g-file-digest-fence-bound.test.ts
+++ b/test/pathological/lp-g-file-digest-fence-bound.test.ts
@@ -178,9 +178,16 @@ for (const { backend, databaseUrl } of pathologicalArms()) describe(`the drift c
const snapshot = await engine.readPageSnapshot(slug, { sourceId, includeDeleted: true });
bodyDigestWork.fileBytes = 0;
let refusal: { code?: string; message: string } | undefined;
- try {
- await submitPageMutation(ctx, { operation: 'delete_page', params: { slug, expected_revision: snapshot!.revision, request_id: randomUUID() } });
- } catch (error) { refusal = { code: (error as { code?: string }).code, message: (error as Error).message }; }
+ // A preparation that outlasts the reply wait (a pending receipt) still ends in its refusal: the same request is
+ // asked again until it settles. The new page's background index build can overlap this delete since #7106.
+ const params = { slug, expected_revision: snapshot!.revision, request_id: randomUUID() };
+ for (;;) {
+ try { await submitPageMutation(ctx, { operation: 'delete_page', params }); break; }
+ catch (error) {
+ if ((error as { code?: string }).code === 'write_pending') { await Bun.sleep(1000); continue; }
+ refusal = { code: (error as { code?: string }).code, message: (error as Error).message }; break;
+ }
+ }
expect(refusal?.code).toBe('page_body_segmented');
expect(refusal?.message).toContain(`over the ${FENCE_MAX_BYTES}-byte bound`);
const fenceRead = bodyDigestWork.fileBytes - fileBytes - regionBytes - 2 * (Buffer.byteLength(before) - start);