mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-19 06:30:54 +08:00
A turn the provider's safety system declines (Anthropic stop_reason "refusal", OpenAI-compatible finish_reason "content_filter") has no text and no tool calls. Norma passes the stop reason through and the harness ends any tool-less turn with ReasonCompleted, so the run summary said the model "ended this turn normally", and steerHooks.Stop took the empty turn for an idle one and resent the conversation up to the empty-response retry count. The LLM recorder is the one layer that sees the stop reason. It now hands each completed call's stop reason to an optional context sink (llmrec.WithStopSink). captureRunSession installs a per-run tracker (agent.WithStopTracker) on that sink. With it: - steerHooks.Stop does not inject the idle-turn rerun after a refusal; - terminalText reports "provider refusal (stop_reason ...)" and says the intent was not completed, instead of the completed wording. Other terminal states and ordinary empty turns are unchanged. Fixes #327 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>