Skip to content

ui-sdk: a worker freeze can be confirmed while a just-forked child still runs #4400

Open

Description

@schlessera

Part of #4278. Deferred from the first review of PR #4395 (#4292).

Context

  • createWorkerFreezer().freeze() returns true when every PID from its last scan is stopped (packages/ui-sdk/src/server/worker-freezer.ts:39-52). A child forked between the /proc scan and its parent's SIGSTOP is in no scan.
  • workerStarted freezes a worker admitted during a hold and ignores the result (packages/ui-server/src/brain/turn-scope.ts:330-345). main has the same behaviour for every hold.
  • The identity-broker freezer returns true right after requesting STOP (packages/ui-sdk/src/server/worker-launcher.ts:1593). It is unverified whether that request confirms the stop.
  • The deferred dispatch of ui-server: after each tool result the worker is stopped before it can send its next model request (0.8 s median per request) #4292 treats these receipts as its precondition.

Scope

Make the receipt mean the whole tree is stopped. Decide what an unconfirmed, late-admitted worker does to a hold that requires confirmation. No change to hold scheduling.

Acceptance criteria

  • freeze() returns true only after a scan that finds no member outside the stopped set.
  • A runtime test with a forking worker fails on the current code, shown by a mutation.
  • The identity-broker freezer's receipt is verified, or it reports unconfirmed.
  • A worker admitted during a confirmed-stop hold with a false or void receipt is handled fail-closed for that turn only, with a durable cause.

Activity

  1. added
    type: fix
    area: ui-sdk
    priority: p2
    agent-ready
    on Nov 21, 2026
  2. schlessera commented on Nov 21, 2026

    @schlessera
    OwnerAuthor

    Added from the second review of PR #4395 (same theme): a worker freeze that throws kills the worker and skips the result observation.

    held treats a thrown before as a failed hold: it calls after(false) and rejects before it queues the observation (packages/ui-server/src/brain/turn-journal.ts:365-366). after(false) kills the held workers and stops the turn (packages/ui-server/src/brain/turn-scope.ts:283-286). The process-tree freezer throws after 5 s (packages/ui-sdk/src/server/worker-freezer.ts:49). main behaves the same for every hold.

    Additional acceptance criteria:

    • Decide whether a thrown stop is a transient failure to retry or a terminal one, for immediate and deferred holds alike. Keep the turn's final observation and accounting either way.
    • A freezer that throws once does not skip the result's observation, or the skip is recorded durably with its cause, and the turn's outcome names the freeze failure.
    • A test covers a freezer that throws once and then succeeds.
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-sdkpriority: p2type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions