Conversation
Review Summary by QodoAdd HTTP client timeout to Membase plugin
WalkthroughsDescription• Add 5-second timeout to Membase HTTP client • Improve HTTP request reliability with timeout configuration Diagramflowchart LR
A["MembasePlugin RegisterDI"] -- "ConfigureHttpClient" --> B["HTTP Client Configuration"]
B -- "Set BaseAddress" --> C["Membase API Connection"]
B -- "Set Timeout 5s" --> C
File Changes1. src/Plugins/BotSharp.Plugin.Membase/MembasePlugin.cs
|
Code Review by Qodo
1. Unvalidated settings.Host URI
|
| .ConfigureHttpClient(c => c.BaseAddress = new Uri(settings.Host)); | ||
| .ConfigureHttpClient(c => | ||
| { | ||
| c.BaseAddress = new Uri(settings.Host); |
There was a problem hiding this comment.
1. Unvalidated settings.host uri 📘 Rule violation ⛯ Reliability
The new code constructs and assigns BaseAddress directly from settings.Host without null/empty/format validation, which can throw during startup if config is missing or not an absolute URI. This violates the requirement to add null/empty guards and safe fallbacks at external/config boundaries.
Agent Prompt
## Issue description
`settings.Host` is used at a configuration boundary without null/empty/format checks (`new Uri(settings.Host)`), which can throw at runtime (e.g., missing scheme, empty string).
## Issue Context
`MembaseSettings` is populated via `config.Bind("Membase", settings)`, so `Host` is externally provided and should be validated before using it as `HttpClient.BaseAddress`.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.Membase/MembasePlugin.cs[30-34]
- src/Plugins/BotSharp.Plugin.Membase/Settings/MembaseSettings.cs[3-8]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| .ConfigureHttpClient(c => | ||
| { | ||
| c.BaseAddress = new Uri(settings.Host); | ||
| c.Timeout = TimeSpan.FromSeconds(5); |
There was a problem hiding this comment.
2. Timeout masked as success 🐞 Bug ✓ Correctness
When IMembaseApi calls fail (including from the new 5s timeout), MembaseGraphDb catches the
exception and returns an empty GraphQueryResult, and MembaseController then returns HTTP 200 with
empty Columns/Items. This turns timeouts into silent, incorrect "successful" responses for
/membase/{graphId}/query.
Agent Prompt
### Issue description
Failures from Membase API calls (including HttpClient timeouts introduced in this PR) are swallowed in `MembaseGraphDb.ExecuteQueryAsync` and returned as `new GraphQueryResult()`. `MembaseController` then always returns `200 OK` with empty `Columns/Items`, masking timeouts as successful responses.
### Issue Context
This becomes significantly more impactful after the PR because a 5-second HttpClient timeout will trigger cancellations in normal operation.
### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs[39-60]
- src/Plugins/BotSharp.Plugin.Membase/Controllers/MembaseController.cs[40-60]
- src/Plugins/BotSharp.Plugin.Membase/MembasePlugin.cs[30-34]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.