---
title: What happens when you send while a turn runs?
description: A Send on a busy weft/thread session follows its busy policy (Queue, Reject, Steer, Interrupt or Rollback); every accepted message is a durable receipt, and s.Steer joins the running turn or returns ErrNotRunning.
url: https://weftgo.dev/docs/sessions/busy-and-steering/
type: how-to
sources:
  - weft/AGENTS.md:565-569 (block 8, Busy, Steer), 122-130 (block 3a, the drain points)
  - weft/README.md:706-739 (steering)
  - weft/thread/turn.go:24-98 (Policy, Queue, Reject, Steer, Interrupt, Rollback, String, BusyPolicy), 125-137 (As)
  - 'weft/thread/interrupt.go:25-49 (interruptSendLocked: the message is accepted like a Queue send, then the running turn is felled); weft/thread/turn.go:372-383 (enqueueLocked: appended at the back of the queue)'
  - 'scratch proof (weft v0.17.0): a running turn, sends A and B queued, then C As(Interrupt): the model saw slow, A, B, C; under Rollback the context held A, B, C without the interrupted turn; ClearQueue before the interrupt dropped A (ErrDropped) and C ran next'
  - weft/thread/steer.go:80-91 (QueuedSteer), 145 (Steer), 383 (Queue), 409 (ClearQueue)
  - weft/thread/entry.go:480-494 (receipt statuses), ReceiptEntry godoc
  - weft/thread/errors.go:15 (ErrBusy), 22 (ErrNotRunning), 156 (ErrDropped)
  - weft/docs/adr/0019-steering-hook.md (§2 the drain points; amendments 2026-10-01 and 2026-10-11)
  - weft/docs/thread-operations.md (§4 Steer, §8 the queue)
  - weft/CHANGELOG.md:592 (Session.Steer, ErrNotRunning), 3233 (steer follow-ups inherit), 3849 (queued sends durable), 5118 (busy policies), 5121 (Steer), 5127 (receipts), 5135 (Interrupt), 5141 (Rollback)
  - weft/thread/example_test.go ExampleBusyPolicy, ExampleAs
  - weft/thread/example_turn_test.go ExampleInterrupt, ExampleRollback, ExampleSteer, ExampleSession_Queue, ExampleTurn_Next
  - docs-site/examples/sessions/busy.go, sessions_test.go TestDemos/busy, TestRejectIsBusy
---

# What happens when you send while a turn runs?

A session runs one turn at a time. A `Send` that arrives while a turn runs follows the session's busy policy, set with [`thread.BusyPolicy(p)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#BusyPolicy) or for one send with [`thread.As(p)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#As): `Queue` (the default) runs it next, `Reject` fails it with `thread.ErrBusy`, `Steer` delivers it into the running turn, `Interrupt` cancels the turn and queues the message behind any sends already waiting, and `Rollback` also branches back before the interrupted turn. Every message accepted while a turn runs is written to the storage, as a receipt entry, before `Send` returns; an idle `Send` writes its prompt entry instead.

`sessions/busy.go` builds a `Reject` session, sends while its tool runs, then steers one message in with `As(Steer)`:

```go title="sessions/busy.go"
s, err := thread.Create(ctx, thread.Memory(), weft.New(model, work),
	ctxWindow, ids("s_reject", "a"), thread.BusyPolicy(thread.Reject))
if err != nil {
	return err
}
turn, err := s.Send(ctx, weft.User("How far is the lighthouse?"))
if err != nil {
	return err
}
<-started // the tool is running

_, err = s.Send(ctx, weft.User("Also, the ferry times?"))
fmt.Fprintln(w, "while busy:", errors.Is(err, thread.ErrBusy))

steer, err := s.Send(ctx, weft.User("Use metric units."), thread.As(thread.Steer))
if err != nil {
	return err
}
close(release)
res, err := turn.Wait()
if err != nil {
	return err
}
if _, err := steer.Wait(); err != nil { // nil result: a steer has no run of its own
	return err
}
fmt.Fprintln(w, "steer:", steer.Outcome())
fmt.Fprintln(w, "the model's last request ends with:", model.LastRequest().LastText())
fmt.Fprintln(w, "answer:", res.Text())
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
while busy: true
steer: delivered
the model's last request ends with: Use metric units.
answer: About 8 kilometres.
```

The rejected send wrote nothing. The steered one joined the running turn: the model's second request ended with it, and the answer is the running turn's. In the demos, `ids` pins the ids for stable output and `ctxWindow` is `thread.ContextWindow(128_000)`, the model's context window ([why](https://weftgo.dev/docs/sessions/turns/#best-practices--gotchas)).

## Busy policies

[`thread.Policy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Policy) is what a `Send` does when the session is already running a turn:

| Policy | `String()` | What a busy `Send` does | Its `Turn` |
|---|---|---|---|
| [`thread.Queue`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Queue) | `queue` | Holds the message and runs it as the next turn, in acceptance order. An `accepted` receipt carries it until its turn starts. The default. | the queued turn |
| [`thread.Reject`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Reject) | `reject` | Fails with [`thread.ErrBusy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrBusy); nothing written. | none |
| [`thread.Steer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Steer) | `steer` | Delivers the message into the running turn at its next drain point; a `queued` receipt carries it until then. | a receipt with no run of its own: `delivered`, `deferred` or `dropped` |
| [`thread.Interrupt`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Interrupt) | `interrupt` | Cancels the running turn and queues the message at the back, as `Queue` does: sends already waiting run first. | a queued turn |
| [`thread.Rollback`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Rollback) | `rollback` | An `Interrupt` that also branches the leaf back to before the interrupted turn's receipt entry. Sends already waiting run first, on the rolled-back line. | a queued turn |

The policy is captured when `Send` is called and recorded on the turn entry (`TurnEntry.Policy`, the [`Policy.String`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Policy.String) value). On a session that is not busy every policy does the same thing: the message runs as a plain turn. That includes the window between a turn's end and the session's between-turn work. A `Send` while approval requests are pending is queued behind the boundary; under `Reject` a pending boundary reads as busy. Concurrent sends are accepted in the order they take the session's lock. The package examples are [`ExampleBusyPolicy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-BusyPolicy) and [`ExampleAs`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-As).

### Steer into the running turn

A steer is delivered at the loop's two drain points ([ADR 0019](https://github.com/weftgo/weft/blob/v0.20.2/docs/adr/0019-steering-hook.md)): after a step's tool batch, when every call already has its result, and at what would have been the final step, which the delivery turns into one more step. The delivered message is an ordinary user message in that run's transcript. The model sees it once.

A steer that meets an intended end (`StopWhen`) or an open approval boundary is never drained, and neither is one that arrives after the run's last drain point. It becomes a deferred follow-up that runs as the next turn, and [`steer.Next()`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Turn.Next) is that turn. Here the tool that a `StopWhen` condition ends on steers:

```go title="sessions/busy.go"
turn, err := s.Send(ctx, weft.User("File a ticket: my parcel is late."))
if err != nil {
	return err
}
if _, err := turn.Wait(); err != nil { // StopWhen ended the run after submit
	return err
}
if _, err := steer.Wait(); err != nil {
	return err
}
fmt.Fprintln(w, "steer:", steer.Outcome())
followUp := steer.Next() // the turn the steer became
res, err := followUp.Wait()
if err != nil {
	return err
}
fmt.Fprintln(w, "follow-up:", res.Text(), "run:", followUp.RunID())
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
steer: deferred
follow-up: Added your phone number to ticket 77. run: s_ticket-t3
```

The follow-up runs under the run options of the turn the steer was aimed at, with the steer's own options after them, so a turn sent with `weft.ParkAllExcept` keeps its follow-ups parked. It runs on the steer's `Send` context for cancellation. The steer reports run id `t2`, minted at acceptance and used by no run; the follow-up is `t3`. The package examples are [`ExampleSteer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Steer) and [`ExampleTurn_Next`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Turn.Next).

### Queue, list and clear

[`s.Queue()`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Queue) returns what the session has accepted and not yet given to a model, as [`thread.QueuedSteer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#QueuedSteer) values: first the steers waiting for the running turn (`Policy` is `Steer`), then the sends waiting for a turn of their own (`Policy` is `Queue`). `Receipt` is the id the message's `Turn` reports and `Msg` the message. [`s.ClearQueue(ctx)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.ClearQueue) drops all of them in one atomic append and returns how many:

```go title="sessions/busy.go"
later, err := s.Send(ctx, weft.User("Then email it to me.")) // Queue, the default
if err != nil {
	return err
}
nudge, err := s.Send(ctx, weft.User("Skip the archived orders."), thread.As(thread.Steer))
if err != nil {
	return err
}
for _, q := range s.Queue() { // steers first, then sends
	fmt.Fprintln(w, "waiting:", q.Policy, q.Receipt, q.Msg.Text())
}
n, err := s.ClearQueue(ctx)
fmt.Fprintln(w, "dropped:", n, err)

close(release)
if _, err := running.Wait(); err != nil {
	return err
}
_, err = later.Wait()
fmt.Fprintln(w, "queued send:", later.Outcome(), errors.Is(err, thread.ErrDropped))
fmt.Fprintln(w, "steer:", nudge.Outcome(), "model calls:", len(model.Requests()))
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
waiting: steer e_a5 Skip the archived orders.
waiting: queue e_a3 Then email it to me.
dropped: 2 <nil>
queued send: dropped true
steer: dropped model calls: 2
```

Each dropped message's `Turn` ends `TurnDropped` and its `Wait` returns an error wrapping [`thread.ErrDropped`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrDropped). The model was called twice, both for the running turn. Delivered or deferred steers are untouched, though a deferred steer's follow-up is a queued send and is dropped. The queue is unbounded: if users can pile messages onto a running turn, check `len(s.Queue())` before you send. The package example is [`ExampleSession_Queue`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Session.Queue).

### Interrupt and roll back

`As(thread.Interrupt)` cancels the running turn's context and queues the new message. Here nothing else is waiting, so it runs next:

```go title="sessions/busy.go"
long, err := s.Send(ctx, weft.User("Research everything about tides."))
if err != nil {
	return err
}
<-started
short, err := s.Send(ctx, weft.User("Stop. Just the short version."), thread.As(thread.Interrupt))
if err != nil {
	return err
}
_, err = long.Wait()
fmt.Fprintln(w, "first turn:", long.Outcome(), errors.Is(err, context.Canceled))
res, err := short.Wait()
if err != nil {
	return err
}
fmt.Fprintln(w, "second turn:", res.Text())
for _, m := range s.Context() {
	for _, p := range m.Content {
		if r, ok := p.(weft.ToolResultPart); ok {
			fmt.Fprintln(w, "the model reads:", r.Content)
		}
	}
}
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
first turn: canceled true
second turn: Two tides a day.
the model reads: tool call research was interrupted: the run was canceled for a newer message
```

The calls the interrupted turn left without a result carry that interruption text, so the next model sees what was cut off. An approval boundary the interrupt supersedes is denied with the interrupted reason. The interrupted turn's entries stay on the tree as evidence. An interrupt that lands between `Send` and the run's start still fells the run at birth.

`Rollback` does the same and moves the leaf back to before the interrupted turn's receipt entry: the follow-up answers as though the interrupted message was never sent, while its entries keep their own line of the tree. The package examples are [`ExampleInterrupt`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Interrupt) and [`ExampleRollback`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Rollback).

## Receipts

A message accepted while the session is busy is durable at acceptance (thread rule T4): its receipt entry is appended to the storage and flushed before `Send` returns, so neither a queued send nor a steer is lost to a crash. The `busy-policy` session above holds two receipt entries:

```go title="sessions/busy.go"
for _, e := range s.Entries() {
	r, ok := e.(thread.ReceiptEntry)
	if !ok {
		continue
	}
	switch r.Status {
	case thread.ReceiptQueued, thread.ReceiptAccepted: // acceptance: the message rides here
		fmt.Fprintf(w, "receipt %s: %s %q\n", r.ID, r.Status, r.Msg.Text())
	default: // a fate: delivered, deferred or dropped
		fmt.Fprintf(w, "receipt %s: %s, settles %s\n", r.ID, r.Status, r.Receipt)
	}
}
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
receipt e_a3: queued "Use metric units."
receipt e_a8: delivered, settles e_a3
```

A [`thread.ReceiptEntry`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptEntry)'s `Status` is one of:

| Status | Meaning |
|---|---|
| [`ReceiptQueued`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptQueued) `queued` | A steer's acceptance: the message is held for the running turn's drain. |
| [`ReceiptAccepted`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptAccepted) `accepted` | A queued send's acceptance: the message is held for a turn of its own; `Turn` names the id its prompt entry will take. |
| [`ReceiptDelivered`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDelivered) `delivered` | The running run drained the steer; `RunID` names the run. `Unanswered` marks a run that ended before the model answered it. |
| [`ReceiptDeferred`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDeferred) `deferred` | The steer became a follow-up turn; `Turn` names its prompt entry. |
| [`ReceiptDropped`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDropped) `dropped` | Removed before it reached a model: `ClearQueue`, or an interrupting send that was refused. |

A fate links to its acceptance through `Receipt`. A queued send is settled by its prompt entry landing, or by a `dropped` receipt. Receipt entries never enter the model's context: the message reaches the model through the run that delivered it or the turn that ran it, exactly once. An acceptance with no fate is a message the writer never got to; `Open` restores it to `s.Queue()` and runs nothing until `Send`, `Decide`, `Resume` or `Continue` ([What is a session?](https://weftgo.dev/docs/sessions/overview/#create-and-open)).

## Steer a running turn

`Send(…, As(Steer))` on an idle session runs the message as a plain turn. That is right for the session's owner, and wrong for a caller acting on a turn it does not own, such as a debugger: its "is a turn running?" check could never be atomic with the send. [`s.Steer(ctx, runID, msgs...)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Steer) is that caller's verb. Under the session's lock it checks that a turn is running now and is `runID` (`""` accepts any running turn), and accepts the messages as a `Steer`-policy `Send` would:

```go title="sessions/busy.go"
err = s.Steer(ctx, "", weft.User("Use metric units."))
fmt.Fprintln(w, "idle:", errors.Is(err, thread.ErrNotRunning), "entries:", len(s.Entries()))

turn, err := s.Send(ctx, weft.User("How far is the lighthouse?")) // its tool steers the run
if err != nil {
	return err
}
res, err := turn.Wait()
if err != nil {
	return err
}
fmt.Fprintln(w, "steer from the tool:", steerErr)
fmt.Fprintln(w, "answer:", res.Text(), "after:", model.LastRequest().LastText())

err = s.Steer(ctx, turn.RunID(), weft.User("Thanks."))
fmt.Fprintln(w, "after the turn:", errors.Is(err, thread.ErrNotRunning))
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

```text
idle: true entries: 0
steer from the tool: <nil>
answer: About 8 kilometres. after: Use metric units.
after the turn: true
```

When no turn is running (idle, between turns, parked at an approval boundary, or a session reopened after a crash mid-turn), or the running turn is another run, `Steer` returns [`thread.ErrNotRunning`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrNotRunning) and writes nothing. The call never starts a turn. A steer it delivered that then misses its drain point (the turn meets `StopWhen`, parks, or ends first) still defers to a follow-up turn, under the aimed turn's options: that is the delivered steer's fate, recorded on its receipt.

Every message must have the user role, or the call fails with `weft.ErrInvalidSteer` before anything is written; a closed session is `ErrClosed`. A multi-message `Steer` whose later append fails returns that error with the earlier messages already accepted.

## Complete example

`sessions/busy.go` runs each policy against a slow tool:

```go title="sessions/busy.go"
package main

import (
	"context"
	"errors"
	"fmt"
	"io"

	"github.com/weftgo/weft"
	"github.com/weftgo/weft/thread"
	"github.com/weftgo/weft/wefttest"
)

// demoBusy is the page "What happens when you send while a turn runs?".
func demoBusy(ctx context.Context, w io.Writer, _ string) error {
	for _, demo := range []func(context.Context, io.Writer) error{
		rejectAndSteer, queueAndClear, interrupt, steerVerb, deferred,
	} {
		if err := demo(ctx, w); err != nil {
			return err
		}
	}
	return nil
}

// rejectAndSteer: a Reject session refuses a send while a turn runs; one
// Send overrides the policy with As(Steer) and joins the running turn.
func rejectAndSteer(ctx context.Context, w io.Writer) error {
	fmt.Fprintln(w, "== reject, and steer one send")
	work, started, release := slowTool("convert")
	model := wefttest.Script(
		wefttest.ToolCalls(wefttest.Call{Name: "convert", ID: "call_1"}),
		wefttest.Say("About 8 kilometres."),
	)
	s, err := thread.Create(ctx, thread.Memory(), weft.New(model, work),
		ctxWindow, ids("s_reject", "a"), thread.BusyPolicy(thread.Reject))
	if err != nil {
		return err
	}
	turn, err := s.Send(ctx, weft.User("How far is the lighthouse?"))
	if err != nil {
		return err
	}
	<-started // the tool is running

	_, err = s.Send(ctx, weft.User("Also, the ferry times?"))
	fmt.Fprintln(w, "while busy:", errors.Is(err, thread.ErrBusy))

	steer, err := s.Send(ctx, weft.User("Use metric units."), thread.As(thread.Steer))
	if err != nil {
		return err
	}
	close(release)
	res, err := turn.Wait()
	if err != nil {
		return err
	}
	if _, err := steer.Wait(); err != nil { // nil result: a steer has no run of its own
		return err
	}
	fmt.Fprintln(w, "steer:", steer.Outcome())
	fmt.Fprintln(w, "the model's last request ends with:", model.LastRequest().LastText())
	fmt.Fprintln(w, "answer:", res.Text())

	printReceipts(w, s)
	return s.Close(ctx)
}

// queueAndClear: the default policy queues; Queue lists what waits and
// ClearQueue drops it.
func queueAndClear(ctx context.Context, w io.Writer) error {
	fmt.Fprintln(w, "== queue and clear")
	work, started, release := slowTool("export")
	model := wefttest.Script(
		wefttest.ToolCalls(wefttest.Call{Name: "export", ID: "call_1"}),
		wefttest.Say("Exported."),
	)
	s, err := thread.Create(ctx, thread.Memory(), weft.New(model, work), ctxWindow, ids("s_queue", "a"))
	if err != nil {
		return err
	}
	running, err := s.Send(ctx, weft.User("Export my order history."))
	if err != nil {
		return err
	}
	<-started
	later, err := s.Send(ctx, weft.User("Then email it to me.")) // Queue, the default
	if err != nil {
		return err
	}
	nudge, err := s.Send(ctx, weft.User("Skip the archived orders."), thread.As(thread.Steer))
	if err != nil {
		return err
	}
	for _, q := range s.Queue() { // steers first, then sends
		fmt.Fprintln(w, "waiting:", q.Policy, q.Receipt, q.Msg.Text())
	}
	n, err := s.ClearQueue(ctx)
	fmt.Fprintln(w, "dropped:", n, err)

	close(release)
	if _, err := running.Wait(); err != nil {
		return err
	}
	_, err = later.Wait()
	fmt.Fprintln(w, "queued send:", later.Outcome(), errors.Is(err, thread.ErrDropped))
	fmt.Fprintln(w, "steer:", nudge.Outcome(), "model calls:", len(model.Requests()))
	printReceipts(w, s)
	return s.Close(ctx)
}

// interrupt: As(Interrupt) cancels the running turn and runs the new
// message next.
func interrupt(ctx context.Context, w io.Writer) error {
	fmt.Fprintln(w, "== interrupt")
	research, started, _ := slowTool("research")
	model := wefttest.Script(
		wefttest.ToolCalls(wefttest.Call{Name: "research", ID: "call_1"}),
		wefttest.Say("Two tides a day."),
	)
	s, err := thread.Create(ctx, thread.Memory(), weft.New(model, research), ctxWindow, ids("s_tides", "a"))
	if err != nil {
		return err
	}
	long, err := s.Send(ctx, weft.User("Research everything about tides."))
	if err != nil {
		return err
	}
	<-started
	short, err := s.Send(ctx, weft.User("Stop. Just the short version."), thread.As(thread.Interrupt))
	if err != nil {
		return err
	}
	_, err = long.Wait()
	fmt.Fprintln(w, "first turn:", long.Outcome(), errors.Is(err, context.Canceled))
	res, err := short.Wait()
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "second turn:", res.Text())
	for _, m := range s.Context() {
		for _, p := range m.Content {
			if r, ok := p.(weft.ToolResultPart); ok {
				fmt.Fprintln(w, "the model reads:", r.Content)
			}
		}
	}
	return s.Close(ctx)
}

// steerVerb: Session.Steer joins the turn running now, and never starts
// one.
func steerVerb(ctx context.Context, w io.Writer) error {
	fmt.Fprintln(w, "== Session.Steer")
	var s *thread.Session
	var steerErr error
	convert := weft.Tool("convert", "Convert a length.", func(ctx context.Context, _ struct{}) (string, error) {
		call, _ := weft.CallFromContext(ctx)
		steerErr = s.Steer(ctx, call.RunID, weft.User("Use metric units.")) // this run, by id
		return "5 miles", nil
	})
	model := wefttest.Script(
		wefttest.ToolCalls(wefttest.Call{Name: "convert", ID: "call_1"}),
		wefttest.Say("About 8 kilometres."),
	)
	var err error
	s, err = thread.Create(ctx, thread.Memory(), weft.New(model, convert), ctxWindow, ids("s_steer", "a"))
	if err != nil {
		return err
	}
	err = s.Steer(ctx, "", weft.User("Use metric units."))
	fmt.Fprintln(w, "idle:", errors.Is(err, thread.ErrNotRunning), "entries:", len(s.Entries()))

	turn, err := s.Send(ctx, weft.User("How far is the lighthouse?")) // its tool steers the run
	if err != nil {
		return err
	}
	res, err := turn.Wait()
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "steer from the tool:", steerErr)
	fmt.Fprintln(w, "answer:", res.Text(), "after:", model.LastRequest().LastText())

	err = s.Steer(ctx, turn.RunID(), weft.User("Thanks."))
	fmt.Fprintln(w, "after the turn:", errors.Is(err, thread.ErrNotRunning))
	return s.Close(ctx)
}

// deferred: a steer that meets an intended end (StopWhen) is never
// drained; it becomes a follow-up turn.
func deferred(ctx context.Context, w io.Writer) error {
	fmt.Fprintln(w, "== deferred steer")
	var s *thread.Session
	var steer *thread.Turn
	// The user types while submit runs. The steer is sent on the app's
	// ctx, not the tool's: a deferred steer's follow-up runs on the
	// context its Send was given, and the tool's ends with the run.
	submit := weft.Tool("submit", "Submit the ticket.", func(context.Context, struct{}) (string, error) {
		steer, _ = s.Send(ctx, weft.User("Add my phone number too."), thread.As(thread.Steer))
		return "ticket 77 submitted", nil
	})
	model := wefttest.Script(
		wefttest.ToolCalls(wefttest.Call{Name: "submit", ID: "call_1"}),
		wefttest.Say("Added your phone number to ticket 77."),
	)
	agent := weft.New(model, submit, weft.StopWhen(weft.HasToolCall("submit")))
	var err error
	s, err = thread.Create(ctx, thread.Memory(), agent, ctxWindow, ids("s_ticket", "a"))
	if err != nil {
		return err
	}
	turn, err := s.Send(ctx, weft.User("File a ticket: my parcel is late."))
	if err != nil {
		return err
	}
	if _, err := turn.Wait(); err != nil { // StopWhen ended the run after submit
		return err
	}
	if _, err := steer.Wait(); err != nil {
		return err
	}
	fmt.Fprintln(w, "steer:", steer.Outcome())
	followUp := steer.Next() // the turn the steer became
	res, err := followUp.Wait()
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "follow-up:", res.Text(), "run:", followUp.RunID())
	return s.Close(ctx)
}

// printReceipts lists a session's receipt entries: acceptance first, then
// each fate, linked to the acceptance it settles.
func printReceipts(w io.Writer, s *thread.Session) {
	for _, e := range s.Entries() {
		r, ok := e.(thread.ReceiptEntry)
		if !ok {
			continue
		}
		switch r.Status {
		case thread.ReceiptQueued, thread.ReceiptAccepted: // acceptance: the message rides here
			fmt.Fprintf(w, "receipt %s: %s %q\n", r.ID, r.Status, r.Msg.Text())
		default: // a fate: delivered, deferred or dropped
			fmt.Fprintf(w, "receipt %s: %s, settles %s\n", r.ID, r.Status, r.Receipt)
		}
	}
}
```

[sessions/busy.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/busy.go)

[View on GitHub](https://github.com/weftgo/weftgo.dev/tree/main/docs-site/examples/sessions) · run it from `docs-site/examples`:

```sh
go run ./sessions busy
go test ./sessions
```

```text
== reject, and steer one send
while busy: true
steer: delivered
the model's last request ends with: Use metric units.
answer: About 8 kilometres.
receipt e_a3: queued "Use metric units."
receipt e_a8: delivered, settles e_a3
== queue and clear
waiting: steer e_a5 Skip the archived orders.
waiting: queue e_a3 Then email it to me.
dropped: 2 <nil>
queued send: dropped true
steer: dropped model calls: 2
receipt e_a4: accepted "Then email it to me."
receipt e_a5: queued "Skip the archived orders."
receipt e_a6: dropped, settles e_a5
receipt e_a7: dropped, settles e_a4
== interrupt
first turn: canceled true
second turn: Two tides a day.
the model reads: tool call research was interrupted: the run was canceled for a newer message
== Session.Steer
idle: true entries: 0
steer from the tool: <nil>
answer: About 8 kilometres. after: Use metric units.
after the turn: true
== deferred steer
steer: deferred
follow-up: Added your phone number to ticket 77. run: s_ticket-t3
```

## Best practices & gotchas

- **Send a steer on a context that outlives the turn.** A deferred steer's follow-up runs on its `Send` context; a tool's context ends with the run, and the follow-up then fails with `ErrNotRun`. (Source: ADR 0019 amendment 2026-10-07; `thread/errors.go:150`)
- **Use `s.Steer`, not `As(Steer)`, when you do not own the turn.** `As(Steer)` on an idle session starts a turn; `Steer` never does. (Source: ADR 0019 amendment 2026-10-11; `thread/steer.go:145`)
- **Bound the queue yourself.** The session does not cap waiting steers or sends; each costs one entry. (Source: `docs/thread-operations.md` §8; ADR 0019 amendment 2026-10-01)
- **A steer cannot decide a parked call.** On an open approval boundary it defers to a follow-up turn that runs after the boundary resolves. (Source: ADR 0019 §2; `ExampleTurn_Next`)
- **Expect `Interrupt` and `Rollback` to wait behind the queue.** They cancel the running turn but enqueue at the back, exactly as `Queue` does. With a turn running, then sends A and B queued, then C sent `As(Interrupt)`, the model answers A, B and C in that order. Under `Rollback`, A and B also run on the rolled-back line. To run the new message next, call `s.ClearQueue(ctx)` before the send: the waiting sends and steers are dropped, and their Turns end with `ErrDropped`. (Source: `thread/interrupt.go:25-49`; `thread/turn.go:372-383`)
- **Treat `ErrBusy` as retry.** The same call succeeds once the turn has ended (`turn.Wait` or `s.WaitIdle` first), or, when the turn parked, once its approval boundary is decided: under `Reject` an open boundary reads as busy. (Source: `thread/errors.go:8-15`; `thread/turn.go:290-300`; `docs/thread-operations.md` §7)

## See also

- [Send turns and wait for them](https://weftgo.dev/docs/sessions/turns/)
- [Approvals in sessions](https://weftgo.dev/docs/sessions/approvals/): `Send` and steers while calls are parked
- [ADR 0019](https://github.com/weftgo/weft/blob/v0.20.2/docs/adr/0019-steering-hook.md): steering, one pull hook in the loop
- [Glossary: steer](https://weftgo.dev/docs/reference/glossary/#steer)

Symbols used: [`thread.Policy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Policy) · [`Policy.String`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Policy.String) · [`thread.Queue`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Queue) · [`thread.Reject`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Reject) · [`thread.Steer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Steer) · [`thread.Interrupt`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Interrupt) · [`thread.Rollback`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Rollback) · [`thread.BusyPolicy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#BusyPolicy) · [`thread.As`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#As) · [`Session.Queue`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Queue) · [`Session.ClearQueue`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.ClearQueue) · [`Session.Steer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Steer) · [`thread.QueuedSteer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#QueuedSteer) · [`thread.ReceiptEntry`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptEntry) · [`thread.ReceiptQueued`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptQueued) · [`thread.ReceiptAccepted`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptAccepted) · [`thread.ReceiptDelivered`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDelivered) · [`thread.ReceiptDeferred`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDeferred) · [`thread.ReceiptDropped`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ReceiptDropped) · [`Turn.Next`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Turn.Next) · [`thread.ErrBusy`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrBusy) · [`thread.ErrNotRunning`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrNotRunning) · [`thread.ErrDropped`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrDropped) · [`weft.StopWhen`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#StopWhen) · [`weft.HasToolCall`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#HasToolCall) · [`weft.CallFromContext`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#CallFromContext) · [`weft.ToolResultPart`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#ToolResultPart) · [`weft.ErrInvalidSteer`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#ErrInvalidSteer) · [`wefttest.Script`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/wefttest#Script)
