Skip to content

fix: agent runtime bugs#1290

Merged
MODSetter merged 2 commits intodevfrom
dev_mod
Apr 22, 2026
Merged

fix: agent runtime bugs#1290
MODSetter merged 2 commits intodevfrom
dev_mod

Conversation

@MODSetter
Copy link
Copy Markdown
Owner

@MODSetter MODSetter commented Apr 22, 2026

Description

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR fixes two critical runtime bugs in the agent system: first, it addresses a TypeError crash in the summarization middleware caused by AIMessage objects with content=None (common with Azure OpenAI gpt-5.x responses through LiteLLM) by wrapping the upstream middleware with a safe version that sanitizes message content before processing; second, it prevents LLM routing failures where requests were incorrectly routed to wrong endpoints (e.g., OpenRouter requests hitting Azure endpoints) by adding provider-aware default api_base URLs and general-purpose fallback configurations in the LLM router service. The changes also include a LiteLLM version bump from >=1.83.0 to >=1.83.4 and corresponding lock file updates.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/pyproject.toml
2 surfsense_backend/uv.lock
3 surfsense_web/pnpm-lock.yaml
4 surfsense_backend/app/agents/new_chat/middleware/safe_summarization.py
5 surfsense_backend/app/agents/new_chat/chat_deepagent.py
6 surfsense_backend/app/services/llm_router_service.py

Need help? Join our Discord

Analyze latest changes

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
surf-sense-frontend Ready Ready Preview, Comment Apr 22, 2026 8:00am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c4a7624-4472-435d-b64d-a84e9f19e7ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev_mod

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MODSetter MODSetter merged commit c85c3a4 into dev Apr 22, 2026
7 of 9 checks passed
Copy link
Copy Markdown

@recurseml recurseml Bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 9b56d45..95de054

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (6)

surfsense_backend/app/agents/new_chat/chat_deepagent.py
surfsense_backend/app/agents/new_chat/middleware/safe_summarization.py
surfsense_backend/app/services/llm_router_service.py
surfsense_backend/pyproject.toml
surfsense_backend/uv.lock
surfsense_web/pnpm-lock.yaml

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.

1 participant