sipeed/picoclaw · error

turn cannot accept graceful interrupt

Error message

turn %s cannot accept graceful interrupt

What it means

Transition guard in AgentLoop.InterruptGraceful: an active turn exists, but its turn state rejected requestGracefulInterrupt — the turn is already terminal, already interrupting, or otherwise in a phase that cannot accept a new graceful-interrupt request. The turnID in the message identifies the stuck/rejecting turn; no event is emitted on this path.

Solutions

  1. Check turn state: if it is already finishing or interrupting, simply wait
  2. Retry the interrupt shortly if the turn was mid-transition
  3. Fall back to HardAbort(sessionKey) if graceful interrupt must succeed immediately
  4. Ensure the interrupt isn't issued after the turn already completed
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/agent/steering.go:429 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/d26b3c4b9bdf5752. Report an issue: GitHub.

Appendix: source

Thrown at pkg/agent/steering.go:429

			resetter.ResetSentInRound(sessionKey)
		}
	}

	var scope *session.SessionScope
	if metaStore, ok := agent.Sessions.(session.MetadataAwareSessionStore); ok {
		scope = metaStore.GetSessionScope(sessionKey)
	}

	return al.continueWithSteeringMessages(ctx, agent, sessionKey, channel, chatID, scope, steeringMsgs)
}

func (al *AgentLoop) InterruptGraceful(hint string) error {
	ts := al.getAnyActiveTurnState()
	if ts == nil {
		return fmt.Errorf("no active turn")
	}
	if !ts.requestGracefulInterrupt(hint) {
		return fmt.Errorf("turn %s cannot accept graceful interrupt", ts.turnID)
	}

	al.emitEvent(
		runtimeevents.KindAgentInterruptReceived,
		ts.eventMeta("InterruptGraceful", "turn.interrupt.received"),
		InterruptReceivedPayload{
			Kind:    InterruptKindGraceful,
			HintLen: len(hint),
		},
	)

	return nil
}

// InterruptHard aborts an arbitrary active turn. In parallel mode this may
// target the wrong session. Prefer HardAbort(sessionKey) instead.
//
// Deprecated: Use HardAbort(sessionKey) for session-safe aborts.

View on GitHub (pinned to 49183d7e8d)