BusyThreadPolicy

org.llm4s.agent.service.BusyThreadPolicy
@Experimental

How a submission treats a thread that already has an open entry or a live run (Stage 5 W1 and W3, designs 4.55 and 4.57), reversing §5.3's "do not queue".

  • Reject, the default: refused with GraphError.ThreadBusy while the thread has an open entry or a live claim - a run there, queued or direct, on any machine - as a direct run on a busy thread is refused (§5.3).
  • Enqueue: waits behind the thread's running and queued entries, in submission order (W1's FIFO); behind a direct run, the worker that takes it waits for the run's claim.
  • Interrupt: goes ahead of the thread's queued entries, which keep their order behind it, and asks the thread's running entry to stop at its next superstep boundary: its model call in flight is cut, tool calls already started finish and keep their results, none not yet started starts, the turn is closed with a synthetic "interrupted" result for each call left without one, and the entry closes EntryOutcome.Interrupted, not retried. Of two Interrupt entries the later goes first and the earlier is closed Interrupted before it runs (Stage 5 rule 5). A direct run is not interrupted - it is its owner's - so the entry waits for it, as Enqueue does.

A pending approval or question on the thread is not a busy thread, whatever the policy: the thread is at rest, and a queued start is refused by the runtime while the interrupts are pending (§5.3) - a resume is what answers them.

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

case Enqueue extends BusyThreadPolicy
case Reject extends BusyThreadPolicy