Skip to content

fix(pi): publish typed response schemas for every function - #317

Merged
rohitg00 merged 2 commits into
mainfrom
fix/pi-typed-response-schemas
Jun 23, 2026
Merged

fix(pi): publish typed response schemas for every function#317
rohitg00 merged 2 commits into
mainfrom
fix/pi-typed-response-schemas

Conversation

@rohitg00

@rohitg00 rohitg00 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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

  • Chores
    • Enhanced internal API metadata and response schema definitions for improved validation and documentation of system functions.

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.
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jun 23, 2026 3:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rohitg00, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3e16ddd-92b8-4d75-970c-b8d1b0ad3d08

📥 Commits

Reviewing files that changed from the base of the PR and between 2367bea and 23529ea.

📒 Files selected for processing (1)
  • pi/src/run.ts
📝 Walkthrough

Walkthrough

Zod schemas are added for all run/session/steering lifecycle response payloads in run.ts, and the derived JSON schema constants are wired as response_format into each iii.registerFunction call. configuration.ts receives the same treatment for CONFIG_FN_ID, also gaining description and request_format metadata.

Changes

Response Format Metadata Wiring

Layer / File(s) Summary
Zod response schemas and JSON schema constants
pi/src/run.ts
Defines UsageSchema and result schemas for all run/session/steering lifecycle endpoints, then derives *_RESPONSE_FORMAT JSON schema constants from each via Zod.
response_format wired into all registerFunction calls
pi/src/run.ts, pi/src/configuration.ts
Adds response_format to the iii.registerFunction calls for pi::run, pi::start, pi::steer, pi::follow_up, pi::stop, pi::status, pi::sessions::list, run::start_and_wait, and CONFIG_FN_ID; CONFIG_FN_ID also receives description and request_format.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the schemas are here,
Each response now perfectly clear!
Zod shapes the payload with care,
Format metadata fills the air.
A bunny stamps every reply —
No mystery shapes slipping by! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(pi): publish typed response schemas for every function' clearly and accurately describes the main change: adding typed response schemas to pi functions to address a CI gate issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pi-typed-response-schemas

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 25 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4ce49 and 2367bea.

📒 Files selected for processing (2)
  • pi/src/configuration.ts
  • pi/src/run.ts

Comment thread pi/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.
@rohitg00
rohitg00 merged commit 7124d16 into main Jun 23, 2026
12 checks passed
@rohitg00
rohitg00 deleted the fix/pi-typed-response-schemas branch June 23, 2026 15:43
rohitg00 added a commit that referenced this pull request Jun 23, 2026
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.
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