Repository navigation
What a declined request added goes to later requests as a note naming the refusal - #361
Conversation
… the refusal When a turn ends with `provider_refusal` (its fallback, if any, declined too), what the declined request added since the model last answered becomes a note in its place, as Anthropic says to remove it before going on: the prompt, when it was the turn's first request, or the latest tool results and any steer. A tool result keeps its call with "[This tool result is left out: ...]"; a message becomes "[A message here is left out: ...]", both naming the category. Each note is padded to the size of the item it replaces, so context byte accounting is unchanged, and nothing before it changes, so no thinking binding or prompt cache is touched. The originals are kept in a new `declined` table (schema 61): turn listings show the person's prompt and an idempotent retry still matches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGCoLcHQMmGw188SP8o
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d52c00fe04
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A fork taken while the request was out shares the prompt, and one taken after tool results shares those: replacing them in place changed the fork's history too. The walk now stops at the first node another bot reaches (a head, fork point or saved start, or a child off this branch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGCoLcHQMmGw188SP8o
A fork's fork point is on its own head's branch, so its head or a child off this branch already shows it; bots.closed has no index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGCoLcHQMmGw188SP8o
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f048e9bd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
history_items, history_read, history_search and result_lines read the original from declined; only the model's context carries the notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGCoLcHQMmGw188SP8o
What
Follow-up to #349. When a turn still ends with
provider_refusal, because the bot has no fallback or the fallback declined too, the part of the turn that the declined request added becomes a short note. Later requests see the note in its place. Anthropic says the turn that set off a refusal must be removed or rephrased before going on; otherwise the refusals continue. With this change the bot can carry on, and the model knows something was left out and why.[This tool result is left out: the provider's safety classifier declined the request that carried it (category: cyber).]. A message reads[A message here is left out: ...], and any further message reads[Another message here is left out, for the same reason.]. Shorter wordings are used for items too small for these.declined(node, item)table (schema 61). Turn listings still show the person's prompt, and an idempotent retry of the same request id still matches it. Deleting a bot deletes those rows too.turn_finishedfor a refused turn carriesleft_out, the number of items replaced.Only the typed
provider_refusalcode triggers this, and nothing matches message text.Tests
call_idandtool_use_idkept; padding to the exact length;Nonewhen nothing fits.turnsstill shows the original prompt, and an idempotent retry of the refused request id answers with the same turn.Not tested live: a real classifier refusal was not reproduced.
Generated by Claude Code