fix(memgw): catch ValueError on malformed URL in is_available (Codex PR#31 review) - #32
Conversation
🔎 Lint report:
|
Codex Review Coverage SummaryThis PR closes one of the two P2 items from the PR #31 Codex review (ValueError on malformed URL). Here is the current state of all Codex findings from the PR #30 review chain: Fixed ✅
Deferred — tracking neededP1 items (higher risk):
P2 items (still open):
Automated Codex review audit by Claude Code. Generated by Claude Code |
Corrected Codex Review Status (post-merge audit)The prior summary overstated the number of open items. After reading the merged code in All P2 items — confirmed FIXED in main ✅
P1 items — status
Remaining open: 1 P1 bugSource: Codex comment on PR #30 at
Fix needed: Pass Automated Codex review audit by Claude Code. Generated by Claude Code |
Automated follow-up — P1 user-scope bug fixedPR #33 ( Finding: Fix: All 28 tests pass. Automated Codex review follow-up by Claude Code. Generated by Claude Code |
Summary
This fixes a P2 issue identified by Codex during review of PR #31 ("fix(memgw): cancel timed-out MCP calls + strict loopback host parsing").
Problem
In
plugins/memory/memgw/__init__.py, theis_available()method accessesurlparse(url).hostnameto validate loopback URLs in keyless mode. However,urlparse().hostnameraisesValueErrorfor malformed URLs — for example:http://[::1:8081/mcp(missing closing])Some status/setup paths call
p.is_available()directly without a try/except, so thisValueErrorwould propagate as an uncaught exception rather than gracefully returningFalse(unavailable).Fix
Wrapped the
urlparse(url).hostnamecall in atry/except ValueErrorblock inis_available(). A malformed URL now returnsFalse(treating the provider as unavailable) instead of raising.Change in
plugins/memory/memgw/__init__.py(around line 177):References
Generated by Claude Code