fix: harden REST tools and config loading against empty/malformed input - #18
Conversation
…p-level config keys
backend.get() returns None on an empty 2xx body, but 11 REST call sites
dereferenced the result unguarded, sending raw AttributeError/TypeError
tracebacks to the MCP client. Read tools now degrade to empty results
(matching the already-guarded list_conversations / get_file_info sites).
custom_instructions_set refuses to proceed when the current state is
unreadable (None) — blind-posting only the supplied fields would silently
clear the other one — while a known-empty {} still allows the write.
load_config crashed with TypeError: 'bool' object is not iterable on a
top-level scalar key (a [server] header forgotten); it now raises a clean
actionable ValueError, consistent with its fail-loudly FileNotFoundError.
All 9 new guard tests fail on the unfixed code (repro verified live);
full suite: 140 passed, 9 skipped.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nt claim CLAUDE.md claimed 25 tool modules (actual: 10 registering 19 of the 25 tools, the 6 SSE tools live in server.py) and a hardcoded '129 passed' that drifts every PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
✨ 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 |
…uards # Conflicts: # CHANGELOG.md
Summary
Two crash-hardening fixes from the 2026-07-01 round-2 audit (independent of open PR #17 — the two PRs share no source files except a trivial CHANGELOG
[Unreleased]union), plus a CLAUDE.md accuracy fix.1. Unguarded
backend.get()→Noneat 11 REST call sites (P1)backend.get()deliberately returnsNoneon an empty 2xx body (gateway/Cloudflare glitch), but onlyconversations.pyandimages.pyguarded it. The other 11 sites (memory, account ×2, models, custom GPTs, apps, codex ×2, instructions-get, and bothwrites.pypaths) dereferenced the result and sent a rawAttributeError/TypeErrortraceback to the MCP client. Reproduced pre-fix:custom_instructions_set(read-modify-write) instead refuses onNone: the current state is unknown, and blind-posting only the supplied fields would silently clear the other field on the account. A known-empty{}(fresh account) still allows the write — covered by a dedicated regression test.2.
load_configTypeError on top-level scalar keys (P2)A user forgetting the
[server]header (port = 9001at top level) killed server startup withTypeError: 'bool' object is not iterable(reproduced). Now a clean, actionableValueErrornaming the offending key — consistent withload_config's existing fail-loudlyFileNotFoundError.3. CLAUDE.md drift (docs)
Claimed "25 MCP tool modules" (actual: 10 modules registering 19 of the 25 tools; the 6 SSE tools live in
server.py) and a hardcoded "129 passed" that drifts every PR.Test evidence
Oracle — new tests against the UNFIXED code:
This branch:
(main baseline: 129 passed, 9 skipped)
Notes for reviewer
[Unreleased]will trivially conflict with PR fix: 2026-07-01 audit remediation — body redaction, TOML subtable orphan, DR clarification false-positive #17's entries; union-merge both blocks.func_metadata.py:92-95); token source pinned at construction; install.py comment-tolerant-header P1 (separate stacked PR).🤖 Generated with Claude Code