Skip to content

ui-server: a throw while creating a turn's lifecycle leaks the authorization lease #4422

Open

Description

@schlessera

Part of #4278. Found in the sixth review of PR #4327; the ordering predates it.

Context

  • runSession retains authorization at packages/ui-server/src/ws/run-session.ts:66 and creates the lifecycle at :67, but the releasing try only starts at :70. The queued follow-up path has the same shape at run-session.ts:254-259.
  • PR CONTRACT: fix(activity): preserve startup evidence and reconnect state #4327 added an unguarded performance.now() anchor read (packages/ui-server/src/activity/turn-lifecycle.ts:59) beside the existing unguarded Date.now().
  • A throw from createTurnLifecycle rejects the turn and strands its lease.

Scope

Make lifecycle creation unable to reject a turn or strand its lease. Out of scope: the lifecycle record's shape.

Acceptance criteria

  • With a throwing performance.now() or Date.now(), the turn still runs, with or without a lifecycle.
  • If createTurnLifecycle throws for any reason, the lease is released exactly once on both the initial and the queued path.
  • Each test has a mutation receipt.

Activity

  1. added
    type: fix
    area: ui-server
    priority: p3
    agent-ready
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-serverpriority: p3type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions