Skip to content

fix(eve): prioritize current hook deliveries over stale backlog#598

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/drop-stale-buffered-deliveries-547
Open

fix(eve): prioritize current hook deliveries over stale backlog#598
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/drop-stale-buffered-deliveries-547

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Summary

  • split session delivery backlog into turn-owned, current-hook, and replaced-hook queues
  • classify ready hook reads before selecting the next delivery, so current live input runs before older replaced-hook backlog
  • preserve turn-control cancellation/rebuffer ordering and keep the active hook current when a candidate rekey claim fails

Refs #547.

Tests

  • pnpm --filter eve exec vitest run --config vitest.unit.config.ts src/execution/session-delivery-hook.test.ts src/execution/workflow-entry.test.ts src/execution/turn-control-receiver.test.ts src/execution/turn-dispatch.test.ts
  • pnpm --filter eve exec vitest run --config vitest.integration.config.ts src/execution/session-delivery-hook.integration.test.ts
  • pnpm --filter eve typecheck
  • pnpm changeset status --since origin/main
  • git diff --check

Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.


return {
async bufferNext(): Promise<"buffered" | "closed"> {
await this.next();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await this.next();
const result = await this.next();
// `next()` memoizes a single in-flight read in `offered`, and the hook is
// shared across turns, so several `bufferNext` callers (e.g. an abandoned
// request from a prior turn plus the current turn) can await the same
// resolved read. The first caller consumes and buffers it, clearing
// `offeredRead`; later callers must not consume again (that would throw
// "Cannot consume a public delivery before it resolves."). They observe
// the identical resolved result and report the delivery already buffered.
if (offeredRead === undefined) {
return result.done ? "closed" : "buffered";
}

Two bufferNext() awaiters sharing the memoized offered read both call consumeOffered(), so the second throws "Cannot consume a public delivery before it resolves." and crashes the driver loop.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant