Add structured error propagation for API failures#127
Open
bledden wants to merge 1 commit intokarpathy:masterfrom
Open
Add structured error propagation for API failures#127bledden wants to merge 1 commit intokarpathy:masterfrom
bledden wants to merge 1 commit intokarpathy:masterfrom
Conversation
Fixes karpathy#62 - propagates actual error details instead of generic messages - Add ModelQueryError dataclass with error types (auth, payment, rate_limit, not_found, server, timeout) - Handle specific HTTP status codes (401, 402, 404, 429, 5xx) with helpful messages - Propagate errors through all 3 stages to the frontend - Include error summaries in failure responses 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eddiefleurent
added a commit
to eddiefleurent/llm-council
that referenced
this pull request
Jan 30, 2026
Tier 1 (High Value, Low Risk): - PR #72: Use CHAIRMAN_MODEL for title generation (configurable) - PR #51: Validate OPENROUTER_API_KEY at startup (fail fast) - PR #5: Fix text overflow on chat interface (CSS fixes) - PR #69: Prevent conversation switching while streaming - PR karpathy#110: Copy functionality (copy buttons for responses) Tier 2 (Good Features, Moderate Complexity): - PR karpathy#126: Fix model.split error when model is array (defensive) - PR karpathy#127: Structured error propagation for API failures - PR #67: Continuous conversation mode + prevent empty convos - PR #90: Clear History button with confirmation - PR karpathy#128: Tournament-style pairwise ranking (Condorcet voting) Tier 3 (Nice-to-Have, More Complex): - PR karpathy#109: Multi-message conversation support with context - PR #24: Test suite infrastructure (pytest setup) New files: - backend/context.py: Smart conversation context management - frontend/src/utils.js: getModelDisplayName helper - frontend/src/components/CopyButton.jsx: Reusable copy button - tests/: Unit test infrastructure - pytest.ini, conftest.py: Test configuration
eddiefleurent
added a commit
to eddiefleurent/llm-council
that referenced
this pull request
Jan 30, 2026
…opy, tests) (#1) * Integrate valuable PRs from abandoned upstream Tier 1 (High Value, Low Risk): - PR #72: Use CHAIRMAN_MODEL for title generation (configurable) - PR #51: Validate OPENROUTER_API_KEY at startup (fail fast) - PR #5: Fix text overflow on chat interface (CSS fixes) - PR #69: Prevent conversation switching while streaming - PR karpathy#110: Copy functionality (copy buttons for responses) Tier 2 (Good Features, Moderate Complexity): - PR karpathy#126: Fix model.split error when model is array (defensive) - PR karpathy#127: Structured error propagation for API failures - PR #67: Continuous conversation mode + prevent empty convos - PR #90: Clear History button with confirmation - PR karpathy#128: Tournament-style pairwise ranking (Condorcet voting) Tier 3 (Nice-to-Have, More Complex): - PR karpathy#109: Multi-message conversation support with context - PR #24: Test suite infrastructure (pytest setup) New files: - backend/context.py: Smart conversation context management - frontend/src/utils.js: getModelDisplayName helper - frontend/src/components/CopyButton.jsx: Reusable copy button - tests/: Unit test infrastructure - pytest.ini, conftest.py: Test configuration * Enhance backend and frontend functionality - Added defensive check in `run_full_council` to handle empty messages. - Improved error handling in `send_message_stream` with logging and sanitized error messages. - Updated `delete_all_conversations` to return a list of deletion results, including any failures. - Modified API call in frontend to require confirmation for deleting conversations. - Enhanced `getModelDisplayName` to handle multi-slash identifiers. - Updated `CopyButton` component to clear timeout on unmount and improve success state handling. - CSS adjustments for better styling and functionality across components. - Added unit tests for conversation retrieval and management functions. * Refactor tournament ranking calculation and enhance frontend message handling - Updated `calculate_tournament_rankings` to use actual matchups for win percentage calculation. - Integrated `calculate_tournament_rankings` into the message streaming process in `send_message_stream`. - Improved loading state management for message updates in the frontend, ensuring immutability and clarity in state changes.
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
Fixes #62 - Generic "Unable to generate final synthesis" error now shows actual error details.
Problem
When API calls fail, users see a generic message that hides the actual cause:
This makes it impossible to diagnose issues like invalid API keys, rate limits, or missing models.
Solution
backend/openrouter.py:
ModelQueryErrordataclass with error typesbackend/council.py:
Validation
Test plan
🤖 Generated with Claude Code