fix(pi): publish typed response schemas for every function - #317
Conversation
CI's worker-interface gate rejects untyped (AnyValue/empty) response schemas. Declare a typed response_format on every pi:: function via z.toJSONSchema, and give pi::on-config-change a typed request_format plus a null response_format. All schemas satisfy the collector's typed-keyword check; 69 tests still pass.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 49 minutes and 45 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughZod schemas are added for all run/session/steering lifecycle response payloads in ChangesResponse Format Metadata Wiring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
skill-check — worker0 verified, 25 skipped (no docs/).
Four for four. Nicely done. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pi/src/run.ts`:
- Around line 131-138: The schemas StatusResultSchema and SessionsResultSchema
use z.unknown() for record values which serializes to empty-schema nodes in Zod
4, violating the typed-keyword requirement. Replace z.unknown() with a Zod type
that properly serializes to valid JSON-Schema (such as z.any() or a union of
concrete types) in both locations: the record value type in the
StatusResultSchema's record field and the record value type in the
SessionsResultSchema's sessions array elements.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8ddd0135-854b-454b-b88a-ebb798ac89b4
📒 Files selected for processing (2)
pi/src/configuration.tspi/src/run.ts
Replace the open z.record(z.string(), z.unknown()) in the status and sessions::list response schemas with a concrete SessionRecordSchema, so the published nested schema carries the real record contract instead of an empty additionalProperties node.
The registry publish validator has no draft-2020-12 meta-schema, so the $schema key z.toJSONSchema stamps at the root fails publish with 'no schema with key or ref ...draft/2020-12/schema'. Add a jsonSchema() helper that strips the root $schema from every request and response format, and do the same in runtimeJsonSchema. Builds on the typed schemas from #317; 69 tests pass.
CI's worker-interface gate rejects untyped (AnyValue/empty) response schemas. Declare a typed response_format on every pi:: function via z.toJSONSchema, and give pi::on-config-change a typed request_format plus a null response_format. All schemas satisfy the collector's typed-keyword check; 69 tests still pass.
Summary by CodeRabbit