Skip to content

fix(cache): tolerate list bodies from JSON-RPC batch (rpc_batch post-payment crash)#17

Merged
VickyXAI merged 1 commit into
mainfrom
fix/cache-list-body
Jul 4, 2026
Merged

fix(cache): tolerate list bodies from JSON-RPC batch (rpc_batch post-payment crash)#17
VickyXAI merged 1 commit into
mainfrom
fix/cache-list-body

Conversation

@VickyXAI

@VickyXAI VickyXAI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What

Follow-up to #16. rpc_batch() sends a JSON-RPC list body through _request_with_payment_raw, which on the paid path calls save_to_cache(endpoint, body, ...). Both _readable_filename (body.get("query")) and the cost-log model lookup (body.get("model")) assume a dict — so every paid rpc_batch() call raised AttributeError after the USDC settlement, in both sync and async Solana clients.

Fix

  • _readable_filename: treat non-dict bodies as unlabelable (empty label).
  • save_to_cache: only pull model from the body when it is a dict.

Validation

  • Repro script: save_to_cache("/v1/rpc/eth", [<batch>], ...) crashed before, passes now; dict-body labeling unchanged.
  • black, ruff, and full pytest tests/unit (271 passed) on the branch.

@VickyXAI VickyXAI merged commit 01b9b29 into main Jul 4, 2026
0 of 3 checks passed
@VickyXAI VickyXAI deleted the fix/cache-list-body branch July 4, 2026 02:18
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