fix: bug fixes in backend and frontend integration
Bugs Fixed in Devr.AI Project
This document lists the bugs that have been identified and fixed in the Devr.AI project.
β Fixed Bugs
1. Console.error Statements in Production Code
Severity: Medium
Location: Frontend
Files Affected:
frontend/src/App.tsxfrontend/src/lib/api.tsfrontend/src/components/integration/BotIntegration.tsx
Issue: Console.error statements were left in production code, which can expose sensitive error information in browser console and impact performance.
Fix Applied:
- Removed console.error from session check in App.tsx
- Removed console.error from logout handler in App.tsx
- Removed console.error from API client interceptor in api.ts
- Removed console.error from healthCheck method in api.ts
- Removed console.error from BotIntegration.tsx and added proper error handling
Impact: Improved security and performance by removing unnecessary console logging.
2. Missing exc_info in Backend Exception Logging
Severity: Medium
Location: Backend
Files Affected:
backend/app/database/weaviate/client.pybackend/app/core/orchestration/queue_manager.py
Issue:
Exception logging without exc_info=True makes debugging difficult as stack traces are not captured.
Fix Applied:
- Added
exc_info=Trueto all exception logging statements in Weaviate client - Added
exc_info=Trueto RabbitMQ connection error logging
Impact: Better debugging capabilities with full stack traces in logs.
3. Improved Error Handling in BotIntegration
Severity: Low
Location: Frontend
Files Affected:
frontend/src/components/integration/BotIntegration.tsx
Issue:
Error in loadIntegrationStatus was only logged but didn't reset component state, potentially leaving UI in inconsistent state.
Fix Applied:
- Added proper state reset (setIsConnected(false), setIntegration(null)) in catch block
- Removed console.error and added descriptive comment
Impact: More robust error handling and consistent UI state.
Summary by CodeRabbit
-
Refactor
- Improved error logging to include full tracebacks for better diagnostics.
- Switched to per-request client lifecycles and tightened exception handling.
-
Bug Fixes / Behavior
- Messages now persist and are serialized as JSON for more reliable delivery.
- Authentication now deduplicates 401 handling, prevents redirect loops, and clears sessions reliably.
- UI integration and logout flows now fail silently while correctly updating visible connection state.
-
New Feature
- Login now respects and safely validates an encoded return URL before redirecting.
Backend: tightened queue connectivity checks, message serialization to JSON with persistent delivery, and richer exc_info logging; migrated Weaviate client from a module singleton to per-context creation and narrowed exception handling. Frontend: silenced some console.error calls, added deduplicated 401 handling, and implemented validated returnUrl redirects on login. π― 3 (Moderate) | β±οΈ ~20 minutes π I hop through logs both near and far, Tracebacks gleam like a careful star, βοΈ Tip: You can configure your own custom pre-merge checks in the settings.π Walkthrough
Walkthrough
Changes
Cohort / File(s)
Summary
Backend β queue manager
backend/app/core/orchestration/queue_manager.pyAdded connectivity guard (raise if no/closed channel), serialize priority as string, publish using persistent
Message with content-type: application/json, and enable exc_info=True on failure logs.
Backend β weaviate client
backend/app/database/weaviate/client.pyRemoved module-level cached client;
get_client() now returns a per-context weaviate.use_async_with_local() instance; narrowed exception handling to weaviate.exceptions.WeaviateBaseError; updated closing/exception logs to use exc_info=True.
Frontend β auth & error handling
frontend/src/App.tsx, frontend/src/lib/api.tsSilenced
console.error in auto-login/logout handlers; added deduplicated async 401 handling with sign-out/redirect and PUBLIC_PATHS bypass; health-check logs limited to DEV; exported apiClient singleton.
Frontend β integration & login flow
frontend/src/components/integration/BotIntegration.tsx, frontend/src/components/pages/LoginPage.tsxBotIntegration catch now silently resets
isConnected and clears integration state; LoginPage reads and validates returnUrl query param and conditionally navigates to the decoded internal path.Sequence Diagram(s)
sequenceDiagram
autonumber
actor Producer
participant QueueMgr
participant Broker
Producer->>QueueMgr: enqueue(message, priority)
alt no channel / channel closed
QueueMgr-->>Producer: raise ConnectivityError
else channel available
QueueMgr->>QueueMgr: serialize priority as string
QueueMgr->>Broker: publish(Message persistent, content-type=application/json)
Broker-->>QueueMgr: ack
end
sequenceDiagram
autonumber
actor Worker
participant QueueMgr
participant Processor
Worker->>QueueMgr: poll/receive message
QueueMgr->>Processor: process(message)
alt processing error
Processor-->>QueueMgr: error
QueueMgr-->>QueueMgr: log error (exc_info=True)
QueueMgr->>Worker: nack / handle failure
else success
Processor-->>QueueMgr: success
QueueMgr->>Worker: ack
end
Estimated code review effort
Possibly related PRs
frontend/src/App.tsx authentication/login/logout logic.console.error calls in frontend/src/App.tsx.Suggested reviewers
Poem
Messages stamped persistent and neat,
Frontend hushes, redirects greet,
A snug little burrow, code complete.π₯ Pre-merge checks | β
1 | β 2
β Failed checks (1 warning, 1 inconclusive)
Check name
Status
Explanation
Resolution
Docstring Coverage
β οΈ Warning
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check
β Inconclusive
The title is overly vague and generic. It uses non-descriptive terms like 'bug fixes' without specifying which bugs or what the main changes accomplish, making it unclear what the primary issue addressed is.
Replace with a more specific title that highlights the main change, such as 'fix: improve error logging and state handling in backend and frontend' or focus on the primary fix if one issue dominates.
β
Passed checks (1 passed)
Check name
Status
Explanation
Description Check
β
Passed
Check skipped - CodeRabbitβs high-level summary is enabled.
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
could you please review the coderabit suggested changes @Aditya30ag?
Yaa sure
@smokeyScraper Done
hey @Aditya30ag, Thanks for the improvements! The error handling and logging changes are solid. However, the 401 handler implementation has a few issues that need to be addressed before it can be merged.
Issues to Address
-
returnUrlfeature is incomplete You're appending returnUrl to the login redirect, but LoginPage.tsx doesn't read or use this parameter. Users won't actually be redirected back to their original page after login. Please either: Add logic to LoginPage.tsx to read returnUrl from query params and redirect after successful login, OR Remove the returnUrl logic from this PR and we can tackle it as a separate feature -
Path check will break other public pages
if (!window.location.pathname.includes('/login'))This misses our other public routes. If a 401 happens on /forgot-password, /reset-password, or /signup, users will get incorrectly yanked to the login page mid-flow. -
Race condition with multiple 401s On page load, multiple components often fire API requests simultaneously. If they all return 401, the current code will call signOut() and trigger redirects multiple times.
Could you please make these changes @Aditya30ag ? Rest, the PR seems ready to be merged.
@smokeyScraper yeah sure i will do the changes
Please have a look done the requested changes
@Zahnentferner please have a look into this