---
title: Sign approval decisions
description: 'Make weft/thread approval decisions that cross a process boundary verifiable: a Keyring of HMAC keys, a challenge from s.Request, a signature from ring.Sign or key.Sign, and DecideSigned, which verifies fail-closed; RequireSigned closes the unsigned door for the session''s whole life.'
url: https://weftgo.dev/docs/sessions/signed-approvals/
type: how-to
sources:
  - 'W11-auditA2-fix, v0.20.2: weft/thread Session.Request godoc (the boundary resumes when that completes it (AutoResume)); AutoResume godoc (default on)'
  - weft/AGENTS.md:569 (s.RequiresSigned), 589-590 (block 8, Signed)
  - weft/README.md:681-689 (signed decisions), 692-699 (Quorum, RequireSigned, occurrence binding)
  - weft/docs/adr/0021-thread-approvals.md (§3 signed decisions, §5 quorum; amendment 2026-10-01, the approvals hardening)
  - 'weft/docs/thread-operations.md (§11 approvals operations: keys, rotation, RequireSigned, binding, quorum, the audit trail)'
  - weft/thread/signing.go:16-41 (Keyring), 43-52 (Key), 54-71 (Key.Sign), 73-103 (NewKeyring), 105-127 (Keyring.Sign), 136-139 (WithKeyring), 141-162 (RequireSigned), 164-169 (weft.require_signed), 171-188 (checkApprovals), 207-226 (Open and Fork), 229-235 (the challenge domains), 251-279 (challengeMAC), 281-322 (the nonce tag), 327-362 (SignedDecision), 364-394 (SignDecision), 397-406 (RequiresSigned), 408-455 (Request), 492-495 (maxSignedRefusals), 497-583 (DecideSigned), 596-689 (verifySignedLocked), 691-736 (auditSignedRefusalLocked)
  - weft/thread/approval.go:89-139 (Request), 1437-1451 (approverIdentity)
  - 'v0.20.2: weft/thread/signing.go:408-427 (Request writes nothing for a live request; a lapsed one is swept, denied and the boundary resumed before ErrExpired returns); weft/thread/approval.go:313-326 (once denied, a later Decide, DecideSigned or Request reads ErrNotPending)'
  - weft/thread/errors.go:93-124 (ErrUnknownKey, ErrBadSignature, ErrExpired, ErrReplay, ErrArgsChanged, ErrSignatureRequired), 86 (ErrNotPending)
  - weft/thread/entry.go:322-364 (ApprovalDecisionEntry Nonce, KeyID, RequestID)
  - weft/thread/signing.go:571-583, 645-656 (a refusal's audit entry, the expiry sweep)
  - weft/thread/compaction.go:1306-1319 (the no-window WARN fires at a turn)
  - weft/CHANGELOG.md:3616, 3624, 3627, 3632, 3638, 3642, 3644, 3647 (thread 0.9.0, the signing hardening), 3866 (Keyring.Sign, Key.Sign, Request.ID, SignedDecision.RequestID and RunID), 3898 (SignDecision with a hand-kept key map → ring.Sign or key.Sign), 5250 (thread 0.2.0, signed decisions)
  - weft/thread/example_approvals_test.go ExampleSession_DecideSigned, ExampleQuorum
  - weft/thread/examples/approvals/main.go
  - docs-site/examples/sessions/signed.go, sessions_test.go TestDemos/signed, TestSignedRefusalsAndReopen
---

# Sign approval decisions

A signed decision is an approval that crossed a process boundary, a web UI or a chat integration, and can be checked: the session mints a challenge over one pending request with [`s.Request(callID)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Request), the signing side signs a decision over it with [`ring.Sign`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Keyring.Sign) or [`key.Sign`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Key.Sign), and [`s.DecideSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.DecideSigned) verifies it before anything is recorded. [`thread.RequireSigned()`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#RequireSigned) refuses every unsigned decision, for the session's whole life.

`sessions/signed.go` builds a keyring and a session that requires signed decisions:

```go title="sessions/signed.go"
ring, err := thread.NewKeyring(thread.Key{
	ID:     "ops-1",                                     // only the id is ever written to the session
	Secret: []byte("held by the approval service only"), // never written anywhere by thread
	Active: true,                                        // new challenges are minted under it
})
if err != nil {
	return err
}
s, err := thread.Create(ctx, st, agent, ids("s_signed", "a"), thread.Clock(c.now),
	thread.WithKeyring(ring),
	thread.RequireSigned(), // stored in the header: every Open enforces it
	thread.RequestExpiry(time.Hour))
if err != nil {
	return err
}
```

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

Then it parks a deploy and decides it signed:

```go title="sessions/signed.go"
_, err = s.Decide(ctx, thread.Approve("call_1"))
fmt.Fprintln(w, "unsigned:", errors.Is(err, thread.ErrSignatureRequired), "| requires signed:", s.RequiresSigned())

challenge, err := s.Request("call_1") // a fresh challenge; travels to the signing side
if err != nil {
	return err
}
fmt.Fprintln(w, "challenge: request", challenge.ID, "run", challenge.RunID, "key", challenge.KeyID,
	"| nonce:", challenge.Nonce != "", "| expires:", challenge.Expiry.Format(time.RFC3339))

signed, err := ring.Sign(challenge, thread.Approve("call_1")) // travels back
if err != nil {
	return err
}
resume, err := s.DecideSigned(ctx, signed) // verified, then recorded, then resumed
if err != nil {
	return err
}
res, err := resume.Wait()
if err != nil {
	return err
}
fmt.Fprintln(w, "resumed:", res.Text())
```

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

```text
unsigned: true | requires signed: true
challenge: request e_a4 run s_signed-t1 key ops-1 | nonce: true | expires: 2026-10-18T10:00:00Z
resumed: Prod is live.
```

The unsigned `Decide` was refused with [`thread.ErrSignatureRequired`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrSignatureRequired). The challenge names the request entry and the run that parked the call, and the signed approval resumed the session as `Decide` would ([Approvals in sessions](https://weftgo.dev/docs/sessions/approvals/)).

## Sign a decision

**The keyring.** A [`thread.Keyring`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Keyring) holds HMAC-SHA256 keys by id. [`thread.NewKeyring(keys...)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#NewKeyring) needs at least one [`thread.Key`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Key): each a non-empty, unique `ID`, a non-empty `Secret` of any length, and `Active` on at most one. Every key verifies; the active key is the one new challenges are minted under. A ring with no active key is verify-only: it checks decisions over earlier challenges and mints none. A ring is immutable and safe for concurrent use. Keys never touch the session file, only key ids do, so a leaked file cannot forge a decision.

**The session.** [`thread.WithKeyring(r)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#WithKeyring) makes the session verify under `r` and mint challenges from its active key. A ring is configuration, not state: pass it at every `Create` and `Open`. `RequireSigned` adds the rule that only signed decisions count. `Create` writes it into the header as the metadata key `weft.require_signed`, so every later `Open` enforces it whether or not it passes the option, a `Fork` inherits it (with the origin's keyring unless given its own), and pool children inherit it. Nothing loosens it. [`s.RequiresSigned()`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.RequiresSigned) reports it, for a caller that must know before it promises a decision:

```go title="sessions/signed.go"
_, err = thread.Open(ctx, st, "s_signed", agent) // no keyring: the header's rule cannot be met
fmt.Fprintln(w, "open without a keyring:", err)

again, err := thread.Open(ctx, st, "s_signed", agent, ids("", "b"), thread.WithKeyring(ring)) // no RequireSigned passed
if err != nil {
	return err
}
fmt.Fprintln(w, "requires signed:", again.RequiresSigned(), "| header:", again.Meta()["weft.require_signed"])
```

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

```text
open without a keyring: thread: RequireSigned needs WithKeyring: without a keyring no decision could be verified
requires signed: true | header: true
```

`Create` and `Open` fail when `RequireSigned` is in force and the session has no keyring, or a ring with no active key: no call it parked could ever be decided. Under the rule the session's own machinery still records, each with its audit entry: grants, the Approver, expiry, an interrupting `Send`'s denial, a pool delegation's resolution.

**The challenge.** `s.Request(callID)` returns the pending [`thread.Request`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Request) with a fresh nonce and the active key's id. For a live request it writes nothing and may be called any number of times, each call minting another valid challenge. It fails with `ErrNotPending` for a call that is not pending, `ErrDelegated` for a call that delegates to a pool child, `ErrExpired` for a request past its expiry, and an error when the session has no keyring with an active key.

A lapsed request is swept before `ErrExpired` returns, as every other path sweeps it. `Request` records the expiry's denial, so `Pending` stops offering it, and, under `AutoResume` (the default), resumes the boundary when that completes it. Under `RequireSigned` no unsigned `Decide` comes to sweep it. Once any path has denied it, `Request`, `Decide` and `DecideSigned` for it fail with `ErrNotPending`, not `ErrExpired` ([expiry](https://weftgo.dev/docs/sessions/approvals/#approvers-quorum-and-expiry)). The `Pending()` view of the same request carries no nonce.

| `Request` field | Holds |
|---|---|
| `ID` | The request entry's id: this occurrence of the call. Empty on the request an Approver is handed. |
| `Session` | The session the request lives in. |
| `CallID`, `Tool` | The pending call's id and tool name. |
| `Args`, `ArgsSHA256` | The arguments as the model wrote them, and their hex SHA-256. |
| `RunID` | The run that parked the call. |
| `Reason` | Why it parked. |
| `Expiry`, `Created` | When it lapses (zero: never) and when it was persisted. |
| `Nonce`, `KeyID` | The challenge and the key it was minted under; set by `Request` only. |
| `Child` | The pool child session a mirrored request parks in; empty on an ordinary request. |

**The signature.** The signing side signs with what it holds, and each returns a [`thread.SignedDecision`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#SignedDecision):

- **`ring.Sign(req, d)`** for a process holding the whole ring: it looks up the key the challenge names, and fails with [`thread.ErrUnknownKey`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrUnknownKey) when the ring does not hold it.
- **`key.Sign(req, d)`** for an approver holding a key of their own: the signature names that key, whichever key minted the challenge, so under `Quorum` it counts as this approver. The verifying ring must hold the key ([`ExampleQuorum`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Quorum)).
- **[`thread.SignDecision(secret, req, d)`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#SignDecision)** for a signer with a bare secret, the key `req.KeyID` names. An empty `d.Who` is signed as the key's id.

`ring.Sign` and `key.Sign` fail on a request without a nonce, the `Pending` view; `key.Sign` also on a key with no id or secret. Both arrived in thread 0.9.0, replacing a hand-kept map of secrets passed to `SignDecision`. The MAC covers the challenge and the decision together, so neither can be altered in flight:

| `SignedDecision` field | Holds |
|---|---|
| `Session`, `RequestID`, `RunID` | The occurrence the challenge was minted for. |
| `CallID`, `Tool`, `ArgsSHA256` | The call it answers, and the arguments hash the signer approved. |
| `Expiry` | The request's expiry as the challenge stated it; it must equal the request's own. |
| `Kind`, `Reason`, `Content`, `Always` | The decision: the outcome, a deny reason, a resolve payload, approve-and-always-allow. |
| `Who` | A label for the audit trail; the identity is `KeyID`. |
| `Nonce`, `KeyID`, `MAC` | The challenge answered, the signing key, and the HMAC-SHA256 over every field above. |

**The verification.** `s.DecideSigned(ctx, sd)` records no decision until every check passes (the expiry sweep's own denials and a refusal's audit entry may still land), then records the decision with `Via` `signed`, its nonce and key id, and resumes when the boundary completes, as `Decide` does. The checks, in order:

| Check | Error |
|---|---|
| The MAC under the key `sd.KeyID` names (constant-time), an outcome that is one of the four, this session, a non-empty nonce. An unknown key id fails the same way, in the same words. | [`ErrBadSignature`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrBadSignature) |
| The nonce has not answered a recorded decision. | [`ErrReplay`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrReplay) |
| The request is not past its own expiry, by the session's clock. | `ErrExpired` |
| A pending call with that id, and the occurrence signed (request entry and run). | `ErrNotPending` |
| A nonce the ring minted for this request, and the request's own expiry. | `ErrBadSignature` |
| The arguments hash is the request's. | [`ErrArgsChanged`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrArgsChanged) |
| The tool is the request's. | `ErrBadSignature` |

A signature that passes every check but names a call delegating to a pool child fails with `ErrDelegated`, unrecorded. `DecideSigned` without a keyring fails. The package example is [`ExampleSession_DecideSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#example-Session.DecideSigned).

**Rotation.** Build a new ring with the new key active and the old keys still in it, and hand it to sessions as they open: requests challenged under an old key keep verifying. Drop an old key only when nothing minted under it can still be pending; after that a decision signed with it is `ErrBadSignature`.

## Security properties

No refusal records a decision from the signer:

```go title="sessions/signed.go"
_, err = s.DecideSigned(ctx, signed) // the same bytes again
fmt.Fprintln(w, "replayed:", errors.Is(err, thread.ErrReplay))

parked, err = s.Send(ctx, weft.User("Deploy to prod again."))
if err != nil {
	return err
}
if _, err := parked.Wait(); err != nil {
	return err
}
challenge, err = s.Request("call_2")
if err != nil {
	return err
}
forged, err := thread.Key{ID: "ops-1", Secret: []byte("a guess")}.Sign(challenge, thread.Approve("call_2"))
if err != nil {
	return err
}
_, err = s.DecideSigned(ctx, forged)
fmt.Fprintln(w, "forged:", errors.Is(err, thread.ErrBadSignature), "| still pending:", len(s.Pending()))

stranger := challenge
stranger.KeyID = "ops-9" // a key this ring does not hold
_, err = ring.Sign(stranger, thread.Approve("call_2"))
fmt.Fprintln(w, "unknown key:", errors.Is(err, thread.ErrUnknownKey))

late, err := ring.Sign(challenge, thread.Approve("call_2")) // genuine, but signed too late
if err != nil {
	return err
}
c.advance(2 * time.Hour) // past the request's own expiry
_, err = s.DecideSigned(ctx, late)
fmt.Fprintln(w, "expired:", errors.Is(err, thread.ErrExpired))
if _, err := parked.Next().Wait(); err != nil { // the session denied it and resumed
	return err
}
for _, e := range s.Audit() {
	if a, ok := e.(thread.ApprovalAuditEntry); ok && a.Step == thread.StepSigned {
		fmt.Fprintln(w, "audit:", a.Step, a.Outcome, a.CallID, "|", a.Detail)
	}
}
```

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

```text
replayed: true
forged: true | still pending: 1
unknown key: true
expired: true
audit: signed refused call_1 | replayed
audit: signed refused call_2 | bad signature
audit: signed refused call_2 | expired
```

The forged signature left the call pending. The unknown key was refused on the signer's side, by `ring.Sign`. The expired request was then denied by the session itself, with its stated reason, and the parked turn's `Next` resumed it. What the signing guarantees, as of thread 0.9.0:

- **A signature answers one occurrence.** The challenge signs the request entry's id and the run id beside the call id, and both are checked against the pending request, so a signature for one turn's `call_1` cannot approve a later turn's `call_1` (`ErrNotPending`). The challenge domain is `weft/approval-challenge/v2`; no v1 signature verifies, so a challenge minted before thread 0.9.0 must be requested again.
- **A nonce is the session's.** An empty nonce is a bad signature, and the nonce must carry a tag only a ring key can compute for that request, so a nonce made up elsewhere or lifted from another challenge fails. Nonces are recorded on decision entries, so the replay guard survives restarts.
- **The request's expiry rules.** The session enforces the request's own expiry, by its clock, on every path that records a decision or arms a resume (`Decide`, `DecideSigned`, `Resume`, `Send`, the runner's pickup), never the expiry the signer stated.
- **`RequireSigned` is durable.** It lives in the header: every `Open` enforces it, a fork and a pool child inherit it, and it does not block the session's own denials and resolutions.
- **A decision is spent by its resume.** After a `Branch` back to a decided boundary the calls are pending again and need new signatures.
- **Quorum counts keys.** One key that signs as two `Who`s is one approver; give every approver their own key.
- **Key ids stay private.** An unknown key id and a bad MAC both read `ErrBadSignature` and cost the same time, so `DecideSigned` tells a caller nothing about which ids exist. Only `ring.Sign`, on the ring holder's side, says `ErrUnknownKey`.
- **Refusals are audited, within bounds.** A refused signature leaves a [`StepSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#StepSigned) audit entry naming the reason, the call and, when the ring holds it, the key; at most 16 per request, and nothing for a signature that fails its MAC and names no pending call ([the audit trail](https://weftgo.dev/docs/sessions/approvals/#the-audit-trail)).

What it does not cover: `s.Grant` stays an in-process, unsigned call, so whoever can call it can pre-approve; the audit trail is plain appended lines, not tamper-evidence; and a signed decision's `Who` is a label, its key the identity.

## Complete example

`sessions/signed.go` decides signed, then shows each refusal and a reopen:

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

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

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

// demoSigned is the page "Sign approval decisions".
func demoSigned(ctx context.Context, w io.Writer, dir string) error {
	agent := weft.New(wefttest.Script(
		deployCall("call_1", "prod"), wefttest.Say("Prod is live."),
		deployCall("call_2", "prod"), wefttest.Say("The second deploy lapsed."),
	), deployTool())
	st, err := jsonl.Open(dir)
	if err != nil {
		return err
	}
	c := &clock{t: base}
	fmt.Fprintln(w, "== signed decision")
	ring, err := thread.NewKeyring(thread.Key{
		ID:     "ops-1",                                     // only the id is ever written to the session
		Secret: []byte("held by the approval service only"), // never written anywhere by thread
		Active: true,                                        // new challenges are minted under it
	})
	if err != nil {
		return err
	}
	s, err := thread.Create(ctx, st, agent, ids("s_signed", "a"), thread.Clock(c.now),
		thread.WithKeyring(ring),
		thread.RequireSigned(), // stored in the header: every Open enforces it
		thread.RequestExpiry(time.Hour))
	if err != nil {
		return err
	}
	parked, err := s.Send(ctx, weft.User("Deploy to prod."))
	if err != nil {
		return err
	}
	if _, err := parked.Wait(); err != nil {
		return err
	}
	_, err = s.Decide(ctx, thread.Approve("call_1"))
	fmt.Fprintln(w, "unsigned:", errors.Is(err, thread.ErrSignatureRequired), "| requires signed:", s.RequiresSigned())

	challenge, err := s.Request("call_1") // a fresh challenge; travels to the signing side
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "challenge: request", challenge.ID, "run", challenge.RunID, "key", challenge.KeyID,
		"| nonce:", challenge.Nonce != "", "| expires:", challenge.Expiry.Format(time.RFC3339))

	signed, err := ring.Sign(challenge, thread.Approve("call_1")) // travels back
	if err != nil {
		return err
	}
	resume, err := s.DecideSigned(ctx, signed) // verified, then recorded, then resumed
	if err != nil {
		return err
	}
	res, err := resume.Wait()
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "resumed:", res.Text())

	fmt.Fprintln(w, "== refusals")
	_, err = s.DecideSigned(ctx, signed) // the same bytes again
	fmt.Fprintln(w, "replayed:", errors.Is(err, thread.ErrReplay))

	parked, err = s.Send(ctx, weft.User("Deploy to prod again."))
	if err != nil {
		return err
	}
	if _, err := parked.Wait(); err != nil {
		return err
	}
	challenge, err = s.Request("call_2")
	if err != nil {
		return err
	}
	forged, err := thread.Key{ID: "ops-1", Secret: []byte("a guess")}.Sign(challenge, thread.Approve("call_2"))
	if err != nil {
		return err
	}
	_, err = s.DecideSigned(ctx, forged)
	fmt.Fprintln(w, "forged:", errors.Is(err, thread.ErrBadSignature), "| still pending:", len(s.Pending()))

	stranger := challenge
	stranger.KeyID = "ops-9" // a key this ring does not hold
	_, err = ring.Sign(stranger, thread.Approve("call_2"))
	fmt.Fprintln(w, "unknown key:", errors.Is(err, thread.ErrUnknownKey))

	late, err := ring.Sign(challenge, thread.Approve("call_2")) // genuine, but signed too late
	if err != nil {
		return err
	}
	c.advance(2 * time.Hour) // past the request's own expiry
	_, err = s.DecideSigned(ctx, late)
	fmt.Fprintln(w, "expired:", errors.Is(err, thread.ErrExpired))
	if _, err := parked.Next().Wait(); err != nil { // the session denied it and resumed
		return err
	}
	for _, e := range s.Audit() {
		if a, ok := e.(thread.ApprovalAuditEntry); ok && a.Step == thread.StepSigned {
			fmt.Fprintln(w, "audit:", a.Step, a.Outcome, a.CallID, "|", a.Detail)
		}
	}
	if err := s.Close(ctx); err != nil {
		return err
	}

	fmt.Fprintln(w, "== reopen")
	_, err = thread.Open(ctx, st, "s_signed", agent) // no keyring: the header's rule cannot be met
	fmt.Fprintln(w, "open without a keyring:", err)

	again, err := thread.Open(ctx, st, "s_signed", agent, ids("", "b"), thread.WithKeyring(ring)) // no RequireSigned passed
	if err != nil {
		return err
	}
	fmt.Fprintln(w, "requires signed:", again.RequiresSigned(), "| header:", again.Meta()["weft.require_signed"])
	return again.Close(ctx)
}
```

[sessions/signed.go on GitHub](https://github.com/weftgo/weftgo.dev/blob/main/docs-site/examples/sessions/signed.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 signed
go test ./sessions
```

```text
== signed decision
unsigned: true | requires signed: true
challenge: request e_a4 run s_signed-t1 key ops-1 | nonce: true | expires: 2026-10-18T10:00:00Z
resumed: Prod is live.
== refusals
replayed: true
forged: true | still pending: 1
unknown key: true
expired: true
audit: signed refused call_1 | replayed
audit: signed refused call_2 | bad signature
audit: signed refused call_2 | expired
== reopen
open without a keyring: thread: RequireSigned needs WithKeyring: without a keyring no decision could be verified
requires signed: true | header: true
```

Stderr also carries the no-window `WARN` line once per `Session` value that runs a turn: once here, since the reopened session runs none. `sessions/sessions_test.go` also pins that a forged signature records no decision and resolves nothing, and that `RequireSigned` survives a reopen that does not pass it. weft's [`thread/examples/approvals`](https://github.com/weftgo/weft/tree/v0.20.2/thread/examples/approvals) runs the same flow across a restart ([the approvals example](https://weftgo.dev/docs/sessions/approvals/#the-approvals-example)).

## Best practices & gotchas

- **Keep secrets in the signing process.** The session needs the ring to verify; the session file never holds key bytes, only ids. (Source: `thread/signing.go:23-25`; ADR 0021 §3)
- **Mint a fresh challenge per signature.** `Request` writes nothing for a live request, and each nonce answers one decision; a reused signature is `ErrReplay`. (Source: `thread/signing.go:408-420`)
- **Pass `WithKeyring` on every `Open`.** A session created with `RequireSigned` cannot be opened without a ring that has an active key. (Source: `thread/signing.go:171-188`; thread-operations §11)
- **Give each approver their own key under `Quorum`.** A key is one identity whatever `Who` it signs. (Source: `thread/approval.go:1437-1451`; CHANGELOG.md:3642)
- **Keep old keys through a rotation.** Drop one only when nothing it challenged can still be pending. (Source: thread-operations §11)
- **Put an opaque id in `KeyID` and `Who`.** The signed decision's key id rides the resumed run as `weft.approval.actor`. (Source: `thread/approval.go:157-166`)

## See also

- [Approvals in sessions](https://weftgo.dev/docs/sessions/approvals/): `Pending`, `Decide`, grants, quorum and expiry
- [Require human approval for a tool](https://weftgo.dev/docs/guides/approvals/): the core boundary
- [Operate sessions in production](https://weftgo.dev/docs/sessions/operations/): key rotation and the approvals runbook

Symbols used: [`thread.NewKeyring`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#NewKeyring) · [`thread.Keyring`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Keyring) · [`Keyring.Sign`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Keyring.Sign) · [`thread.Key`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Key) · [`Key.Sign`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Key.Sign) · [`thread.SignDecision`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#SignDecision) · [`thread.SignedDecision`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#SignedDecision) · [`thread.WithKeyring`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#WithKeyring) · [`thread.RequireSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#RequireSigned) · [`thread.Request`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Request) · [`Session.Request`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Request) · [`Session.DecideSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.DecideSigned) · [`Session.RequiresSigned`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.RequiresSigned) · [`Session.Audit`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Session.Audit) · [`thread.RequestExpiry`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#RequestExpiry) · [`thread.Clock`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#Clock) · [`thread.ErrBadSignature`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrBadSignature) · [`thread.ErrReplay`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrReplay) · [`thread.ErrExpired`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrExpired) · [`thread.ErrArgsChanged`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrArgsChanged) · [`thread.ErrUnknownKey`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrUnknownKey) · [`thread.ErrSignatureRequired`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread#ErrSignatureRequired) · [`jsonl.Open`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/thread/jsonl#Open)
