Skip to content

fix: Required fields dropped from tools/list for all Actors#676

Merged
jirispilka merged 1 commit intomasterfrom
claude/investigate-rag-web-browser-issue-KVTI9
Apr 15, 2026
Merged

fix: Required fields dropped from tools/list for all Actors#676
jirispilka merged 1 commit intomasterfrom
claude/investigate-rag-web-browser-issue-KVTI9

Conversation

@jirispilka
Copy link
Copy Markdown
Collaborator

Fixes #637.

Root cause

filterSchemaProperties() unconditionally assigns default: property.default on every whitelisted property, creating a phantom default: undefined key on properties with no upstream default. The previous key-presence check ('default' in field) matched these phantoms and cleared the required array for every Actor in tools/list — so query, startUrls, queries, etc. all appeared optional.

Fix

Switch to a value-check (field.default !== undefined) in fixZodSchemaRequired() — same pattern used by the Apify platform-side input-schema validator.

Verified

Tested with mcpc on @stdio-full against apify/rag-web-browser, apify/google-search-scraper, apify/web-scraper, apify/instagram-scraper, and others — all required fields now correctly populated.

Follow-up

The phantom-key corruption itself (in filterSchemaProperties) is tracked in #675.

filterSchemaProperties() writes phantom `default: undefined` on every property.
The previous key-presence check (`'default' in field`) matched these phantoms
and cleared the required array for every Actor. Switch to a value-check
(`field.default !== undefined`) — same pattern used by the Apify platform validator.

Adds unit tests for fixZodSchemaRequired and an end-to-end pipeline test
modelled on apify/rag-web-browser. Adds a TODO(#675) on filterSchemaProperties
for the follow-up cleanup at the source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics. labels Apr 15, 2026
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — targeted one-line fix with solid regression coverage.

Extended reasoning...

Overview

Patches a bug in fixZodSchemaRequired() (src/utils/ajv.ts) where a key-presence check ('default' in fieldSchema) was incorrectly treating phantom default: undefined entries — produced by filterSchemaProperties() — as real defaults, stripping every Actor's required fields in tools/list.

Fix

Single-line change: replace the key-presence check with a value-check (fieldSchema.default === undefined). This matches the pattern used by Apify's platform-side input-schema validator and correctly ignores undefined-valued phantom keys.

Security risks

None. The change only affects JSON schema normalization for MCP tool listings; no auth, crypto, or permission logic is touched.

Level of scrutiny

Low. The root cause is clearly explained, the fix is minimal and isolated, and the follow-up phantom-key cleanup is deferred to #675 with a TODO comment. New tests in utils.ajv.test.ts, tools.mode_contract.test.ts, and tools.utils.test.ts directly exercise the regression cases.

Other factors

Non-code changes (docs, .gitignore) are trivial. No outstanding reviewer comments. PR is labeled tested.

@jirispilka jirispilka merged commit 02c4600 into master Apr 15, 2026
10 checks passed
@jirispilka jirispilka deleted the claude/investigate-rag-web-browser-issue-KVTI9 branch April 15, 2026 13:18
@jirispilka jirispilka changed the title fix(#637): required fields dropped from tools/list for all Actors fix: Required fields dropped from tools/list for all Actors Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RAG Web Browser: query input reported as optional; tool field ordering incorrect

2 participants