Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ How to keep this current: add the entry in the same pull request as the change,

<!-- Empty. Next release starts here. -->

## 0.73.1

### Tests

- `tests/host-compat.test.ts`: the fake host's per-handler timeout stays referenced while a dispatch runs and is cleared before `emit()` returns, so an awaited `emit()` always has a loop wakeup. The timer was unref'd, so on Node 22 the event loop could drain mid-dispatch and node:test cancelled the rest of the file with `Promise resolution is still pending but the event loop has already resolved`.

## 0.73.0

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pi-warden",
"version": "0.73.0",
"version": "0.73.1",
"description": "Makes the Pi agent follow your project's rules. Jev judges every write against your pi-warden.md and quotes the broken rule back to the agent, names slop, breaks stuck loops, calls out unverified done claims, compresses large tool output, and holds the rare destructive command. Built on pi-typesafe.",
"type": "module",
"license": "MIT",
Expand Down
6 changes: 4 additions & 2 deletions tests/host-compat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ function fakeHost(extras: Record<string, unknown> = {}) {
let result: unknown;
let error: unknown;
// omp's per-handler timeout: the host stops awaiting a handler that runs too long and
// advances to the next one; the handler's promise keeps running.
// advances to the next one; the handler's promise keeps running. The timer stays
// referenced for the dispatch: an unref'd timeout is not a loop wakeup, so an awaited
// emit whose handler promise stays pending would drain the loop before the timeout can
// advance to the next handler. Every emit clears the timer before it returns.
let onTimeout = (): void => {};
const timeout = new Promise<void>(resolve => { onTimeout = resolve; });
const timer = setTimeout(onTimeout, handlerTimeoutMs ?? 2 ** 30);
timer.unref?.();
const run = (handler: Handler) => Promise.race([Promise.resolve(handler(payload, ctx)), timeout]);
for (const handler of handlers.get(event) ?? []) {
try { result = await run(handler); } catch (failure) { error ??= failure; }
Expand Down
Loading