Conversation
Replace the shared delegation_call_stack with Fiber-local path tracking so parallel fan-out (A→B, A→B) is no longer falsely detected as circular. Each Async Fiber tracks its own delegation chain via Fiber[:delegation_path], while nested delegations correctly accumulate the full path through Fiber storage inheritance. Add concurrent delegation context isolation: when multiple parallel tool calls target the same delegate, an active_count tracks concurrency. The first call preserves context normally; subsequent concurrent calls force clear_context: true. Context clearing happens inside Agent::Chat's ask_semaphore to prevent race conditions between parallel callers. Fix ThreadError in run_with_sync by checking Async::Task.current? instead of defined?(Sync). When already inside an async reactor, just yield directly — avoids creating a nested reactor whose Promise#wait triggers "Attempt to unlock a mutex which is not locked". Co-Authored-By: Claude (claude-fudge-eap-cc) <noreply@anthropic.com>
Include the actual Faraday request URL in the llm_api_request event payload to enable verifying requests are sent to the correct endpoint. Co-Authored-By: Claude (claude-fudge-eap-cc) <noreply@anthropic.com>
…vent Co-Authored-By: Claude (claude-fudge-eap-cc) <noreply@anthropic.com>
… base URLs When anthropic_api_base includes a path segment (e.g., https://proxy.dev/apis/anthropic), the leading slash in `/v1/messages` caused Faraday to resolve against the host root, discarding the path. Override Anthropic::Chat#completion_url to return `v1/messages` (relative path). Since stream_url delegates to completion_url, this fixes both sync and streaming requests. Co-Authored-By: Claude (claude-fudge-flow[1m]) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Anthropic API 404 with proxy base URLs: Patch
Anthropic::Chat#completion_urlto returnv1/messages(relative path) instead of/v1/messages(absolute). The leading slash caused Faraday to discard the base URL path component whenanthropic_api_baseincludes a path segment (e.g.,https://proxy.dev/apis/anthropic). Fixes both sync and streaming requests sincestream_urldelegates tocompletion_url.Fix false circular delegation detection: Replace the shared
delegation_call_stackarray onSwarmwith Fiber-local path tracking (Fiber[:delegation_path]). Each Async Fiber tracks its own delegation chain, so parallel fan-out (A→B, A→B) is no longer falsely flagged as circular while true cycles (A→B→A) are still caught.Add concurrent delegation context isolation: When multiple parallel tool calls target the same delegate, only the first call preserves context; subsequent concurrent calls auto-clear via a new
clear_context:parameter onAgent::Chat#ask. Clearing happens inside theask_semaphoreto prevent race conditions between parallel callers.Fix
ThreadError: Attempt to unlock a mutex which is not locked: Replacedefined?(Sync)check inrun_with_syncwithAsync::Task.current?. When already inside an async reactor, just yield directly — avoids creating a nested reactor whosePromise#waittriggers the mutex error.Add request URL to
llm_api_requestevent: Include the actual Faraday request URL in thellm_api_requestevent payload, enabling verification that LLM requests are sent to the correct endpoint.Test plan
🤖 Generated with Claude Code