Skip to content

fix(anthropic): stop retrying content-filter refusals - #162

Closed
KooshaPari wants to merge 5 commits into
mainfrom
fix/upstream-anthropic-refusal-20260813
Closed

fix(anthropic): stop retrying content-filter refusals#162
KooshaPari wants to merge 5 commits into
mainfrom
fix/upstream-anthropic-refusal-20260813

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Aug 13, 2026

Copy link
Copy Markdown
Owner

User description

Semantic upstream reconciliation of tailcallhq/forgecode commit b8ac475 (tailcallhq#3640).

Anthropic stop_reason: refusal now parses, maps to ContentFilter, and terminates as a non-retryable domain error when no tool calls exist.

Verification:

  • cargo test -p forge_app message_delta_refusal_stop_reason --lib
  • cargo test -p forge_app refusal_maps_to_content_filter --lib
  • cargo test -p forge_domain into_full_refusal_is_non_retryable_error --lib
  • cargo test -p forge_domain result_stream_ext::tests --lib
  • rustfmt and diff checks

CodeAnt-AI Description

Stop retrying Anthropic refusals and explain how to recover

What Changed

  • Anthropic refusal responses are recognized and reported separately from normal content-filter completions
  • Refusals without tool calls now end immediately with guidance to rephrase the request or use another model
  • Existing content-filter completions with no text continue to complete normally

Impact

✅ Fewer repeated requests for refused prompts
✅ Clearer safety-filter guidance
✅ Correct handling of Anthropic refusal responses

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Copilot AI lite review requested due to automatic review settings August 13, 2026 11:58
@codeant-ai

codeant-ai Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 87c5504 Aug 15, 2026 · 14:32 14:33
✅ Incremental review completed 3f1d0d2 Aug 14, 2026 · 08:08 08:09
✅ Reviewed your PR 2865c53 Aug 13, 2026 · 11:58 12:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai

codeant-ai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:M label Aug 13, 2026
@mergify mergify Bot added the rust label Aug 13, 2026
Comment thread crates/forge_domain/src/result_stream_ext.rs Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • crates/forge_app/src/dto/anthropic/response.rs
  • crates/forge_domain/src/message.rs
  • crates/forge_domain/src/result_stream_ext.rs
Previous Review Summary (commit 2865c53)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 2865c53)

Status: 1 Warning Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 1
Issue Details (click to expand)

WARNING

File Line Issue
crates/forge_domain/src/result_stream_ext.rs 262 Anthropic-specific refusal logic applied globally to all providers
Files Reviewed (3 files)
  • crates/forge_app/src/dto/anthropic/response.rs
  • crates/forge_domain/src/error.rs
  • crates/forge_domain/src/result_stream_ext.rs - 1 warning

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 67.1K · Output: 9.3K · Cached: 725.8K

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing as empty mergify config duplicate (the same mergify config update was already merged to main in tailcallhq#3834, tailcallhq#3829, tailcallhq#3817, etc.). This PR has 0 file changes — mergify auto-respawned its housekeeping branch post-merge.

@KooshaPari KooshaPari closed this Aug 13, 2026
@KooshaPari

Copy link
Copy Markdown
Owner Author

Reopening — I accidentally closed this in a bulk-cleanup pass that was targeting a different mergify duplicate. This is a real Anthropic-related fix and should not have been closed. Apologies for the churn.

@KooshaPari KooshaPari reopened this Aug 13, 2026
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@mergify mergify Bot added the rust label Aug 14, 2026
…c-refusal-20260813

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@codeant-ai

codeant-ai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:M label Aug 14, 2026
@mergify mergify Bot added the rust label Aug 14, 2026
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@github-actions github-actions Bot removed the rust label Aug 15, 2026
@mergify mergify Bot added the rust label Aug 15, 2026
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@codeant-ai

codeant-ai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:M label Aug 15, 2026
@github-actions github-actions Bot removed the size:M label Aug 16, 2026
@KooshaPari

Copy link
Copy Markdown
Owner Author

Superseded by #166.

main advanced to the v2.13.21 sync and now already contains the generic no-retry refusal fix. #166 preserves only the valid provider-scoped semantic delta on a fresh, non-force branch, with focused tests. This PR branch is intentionally retained as provenance evidence.

Co-Authored-By: ForgeCode noreply@forgecode.dev

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closed as superseded by #166; branch retained.

@KooshaPari KooshaPari closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants