@vellumai/assistant 0.10.10-dev.202607210140.cb3a413 → 0.10.10-dev.202607210310.d95be07

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.10-dev.202607210140.cb3a413",
3
+ "version": "0.10.10-dev.202607210310.d95be07",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -202,38 +202,47 @@ describe("createWorkflowSandbox — CPU guard", () => {
202
202
  ).rejects.toThrow(WorkflowResourceError);
203
203
  });
204
204
 
205
+ // Margins for the two long-await tests below. The host await must exceed the
206
+ // deadline so the reset is load-bearing — without it, the script resumes
207
+ // against an already-expired guard and trips. The deadline itself leaves a
208
+ // full second of post-resume headroom: on shared CI runners, CPU contention
209
+ // can stall the resume path for hundreds of milliseconds, and that stall
210
+ // counts against the contiguous-CPU deadline.
211
+ const LONG_HOST_AWAIT_MS = 1500;
212
+ const LONG_AWAIT_DEADLINE_MS = 1000;
213
+
205
214
  test("a genuinely long host call does not trip the deadline (latency excused)", async () => {
206
- // A single host call whose await (1000ms) far exceeds the deadline (200ms)
207
- // must NOT trip: the reset excuses real leaf/agent latency. With the reset
208
- // gated on a 50ms threshold, this 1000ms call still resets.
215
+ // A single host call whose await exceeds the deadline must NOT trip: the
216
+ // reset excuses real leaf/agent latency. With the reset gated on a 50ms
217
+ // threshold, this call still resets.
209
218
  const sandbox = createWorkflowSandbox({
210
219
  hostFunctions: {
211
220
  slow: async () => {
212
- await new Promise((r) => setTimeout(r, 1000));
221
+ await new Promise((r) => setTimeout(r, LONG_HOST_AWAIT_MS));
213
222
  return "ok";
214
223
  },
215
224
  },
216
- interruptDeadlineMs: 200,
225
+ interruptDeadlineMs: LONG_AWAIT_DEADLINE_MS,
217
226
  });
218
227
  const result = await sandbox.run(`return slow();`, null);
219
228
  expect(result).toBe("ok");
220
229
  });
221
230
 
222
231
  test("a host call that REJECTS after a long await still resets the deadline (catch survives)", async () => {
223
- // A leaf that fails after a multi-second round-trip must not leave the
224
- // script's catch block resuming against an already-expired CPU deadline.
225
- // The reject-path reset (finally) excuses the awaited latency on failure
226
- // too, so the catch — which does enough work to hit an interrupt check —
227
- // runs instead of being killed as a WorkflowResourceError. Without the
228
- // reset, this run rejects.
232
+ // A leaf that fails after a long round-trip must not leave the script's
233
+ // catch block resuming against an already-expired CPU deadline. The
234
+ // reject-path reset (finally) excuses the awaited latency on failure too,
235
+ // so the catch — which does enough work to hit an interrupt check — runs
236
+ // instead of being killed as a WorkflowResourceError. Without the reset,
237
+ // this run rejects.
229
238
  const sandbox = createWorkflowSandbox({
230
239
  hostFunctions: {
231
240
  slowFail: async () => {
232
- await new Promise((r) => setTimeout(r, 1000));
241
+ await new Promise((r) => setTimeout(r, LONG_HOST_AWAIT_MS));
233
242
  throw new Error("leaf failed");
234
243
  },
235
244
  },
236
- interruptDeadlineMs: 300,
245
+ interruptDeadlineMs: LONG_AWAIT_DEADLINE_MS,
237
246
  });
238
247
  const result = await sandbox.run(
239
248
  `try {