Skip to content

[FIX][AuctionSwarm.run][Raise when every winning agent fails instead of returning the bid table] - #2493

Open
sakshamchitkara-dotcom wants to merge 2 commits into
kyegomez:masterfrom
sakshamchitkara-dotcom:fix/auction-swarm-all-winners-fail
Open

sakshamchitkara-dotcom wants to merge 2 commits into
kyegomez:masterfrom
sakshamchitkara-dotcom:fix/auction-swarm-all-winners-fail

Conversation

@sakshamchitkara-dotcom

Copy link
Copy Markdown
Contributor

Fixes #2492

Problem

If every winning agent fails, AuctionSwarm.run still returns normally. successful stays empty, the award block is skipped, and the swarm formats what is left in the conversation, which is the task and the bid summary. With output_type="final", a provider outage during the work phase comes back as a "successful" run whose answer is "Bids: A=0.9000, B=0.4000". No exception reaches the caller, so SwarmRouter's fallback_swarms never fires. The only trace is a log warning.

Change

When no winner produced an answer, run raises RuntimeError("[<name>] every winning agent failed"), chained to the top-scoring winner's exception, so the real error stays visible. A run where at least one winner succeeds is unchanged, and failed winners are still skipped with a warning. The run docstring lists the new Raises. This follows the same direction as #2408, where Agent.run now raises after its retries run out instead of returning ''.

Verification

  • New tests/structs/test_auction_swarm.py (the module had no test file). It stubs the auction and the winners' execution so both winners fail, then asserts the RuntimeError and its provider down cause. On master it fails with DID NOT RAISE and returns the bid table. It passes here.
  • black and ruff are clean.

🤖 Generated with Claude Code

sakshamchitkara-dotcom and others added 2 commits October 6, 2026 16:30
…of returning the bid table]

With no successful winner, run() skipped the award and formatted the conversation, so output_type='final' returned the bid summary as the answer and fallback_swarms never saw a failure. It now raises a RuntimeError chained to the top winner's error; a run with at least one successful winner is unchanged.

Fixes kyegomez#2492

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -0,0 +1,35 @@
import pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][AuctionSwarm.run][Returns the bid table as the answer when every winning agent fails]

2 participants