Skip to content

fix(proxy): normalize optional Caido GraphQL arguments - #1142

Draft
gnai-creator wants to merge 2 commits into
usestrix:mainfrom
gnai-creator:fix/caido-optional-id-normalization
Draft

fix(proxy): normalize optional Caido GraphQL arguments#1142
gnai-creator wants to merge 2 commits into
usestrix:mainfrom
gnai-creator:fix/caido-optional-id-normalization

Conversation

@gnai-creator

@gnai-creator gnai-creator commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Normalize optional Caido GraphQL IDs and pagination cursors before passing them to the Caido SDK.

Some LLM tool calls encode omitted optional arguments as strings such as "null" or "". These values are truthy and were being forwarded as GraphQL ID variables. Caido expects integer-shaped i32 IDs or an actual null value, resulting in:

Invalid ID format, should be an i32
Failed to parse cursor

Changes

  • Add a shared helper for normalizing optional Caido IDs.
  • Treat empty strings and the null-like values "null", "none", and "undefined" as omitted values.
  • Validate that provided IDs are integer-shaped and fit in a signed 32-bit integer.
  • Apply normalization to:
    • list_requests.scope_id
    • list_requests.after
    • list_sitemap.scope_id
    • list_sitemap.parent_id
  • Add regression tests for LLM-generated null-like strings and invalid IDs.

Why

The tool schema declares these fields as optional strings, but LLMs may emit a textual null instead of JSON null. Validation at the Strix/Caido boundary prevents invalid GraphQL requests and replaces SDK tracebacks with clear local errors.

Before this change, scope_id="null" was sent to Caido as scopeId: "null" and rejected. Likewise, after="null" was forwarded as a pagination cursor and failed with Failed to parse cursor. After this change, both values are normalized to None, so the omitted optional arguments are not sent to the SDK builders.

Tests

20 passed
ruff: All checks passed

@gnai-creator gnai-creator changed the title fix(proxy): normalize optional Caido GraphQL IDs fix(proxy): normalize optional Caido GraphQL arguments Aug 21, 2026
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