feat(opencode): add experimental HttpApi coverage - #1382
Conversation
|
Warning Review limit reached
More reviews will be available in 44 minutes and 27 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 adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTen instance-level handler functions in ChangesExperimental Routes HttpApi Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
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 |
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
`@packages/opencode/src/server/routes/instance/httpapi/handlers/experimental.ts`:
- Line 26: The constant `WorktreeCreateBody` currently uses a Zod schema
reference (Worktree.CreateInput.optional()) but the file location requires
Effect Schema patterns per project guidelines. Replace the Zod schema definition
of `WorktreeCreateBody` with an Effect Schema equivalent that matches the
structure of `WorktreeCreatePayload` from groups/experimental.ts, ensuring it
includes the same optional fields for `name` and `startCommand`.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7b0b721d-d3e9-4bc9-b6f2-4f6473f0ce50
📒 Files selected for processing (5)
packages/opencode/src/server/instance/experimental.tspackages/opencode/src/server/routes/instance/httpapi/groups/experimental.tspackages/opencode/src/server/routes/instance/httpapi/handlers/experimental.tspackages/opencode/test/server/experimental-routes.test.tspackages/opencode/test/server/route-inventory-harness.test.ts
## Summary Add local Effect HttpApi declarations and handlers for root instance and global JSON/control routes while keeping production routing on Hono. ## Change Boundary - Adds root instance coverage for `/instance/dispose`, `/path`, VCS JSON/raw/apply routes, and metadata routes for command, agent, skill, and LSP. - Adds global coverage for config get/update, health, dispose, and upgrade. - Updates the route inventory harness after rebasing on #1382 so the coverage map keeps both #1382 experimental routes and this PR's root/global routes. - Leaves automation, session, streaming, websocket, static, production server switching, OpenAPI/SDK generation, and `POST /log` out of scope. ## Verification Local verification from `packages/opencode` after rebasing onto `5296b823f73f5a841b363f633867fb98450cbbc4`: - `bun test test/server/route-inventory-harness.test.ts test/server/instance-root-routes.test.ts test/server/global-config-routes.test.ts test/server/vcs-routes.test.ts` passed, 50 tests. - Route inventory count: Hono 128, local HttpApi 64, including the #1382 experimental routes and #1383 root/global routes. - `git diff --check origin/dev...HEAD` passed. - `GOMAXPROCS=2 bun run typecheck` passed. GitHub verification: - PR CI green after rebase: CodeQL, CI, desktop smoke, dependency review, dev-dep audit, e2e artifacts, pr-triage, pr-title-lint, and windows-advisory all passed. ## Review Gate - Fresh-eye post-rebase review: PASS, no P0/P1/P2/P3 blockers. - Claude post-rebase review: PASS, no P0/P1 blockers. Non-blocking P2/P3 notes were limited to future production-switch parity cleanup around chunked oversized apply bodies, global request-context coverage, and duplicated helper code. ## Risk Notes No production server switch is included; this is local HttpApi coverage only. Future production switching should revisit the non-blocking parity notes above before routing live traffic through these handlers. Related to #936
Summary
Adds local Effect HttpApi declarations and handlers for ordinary experimental JSON routes: console, tool, resource, and worktree. The handlers reuse the existing Hono route Effect helpers so the service behavior stays shared.
Why
Related to #936. This expands local HttpApi migration coverage without switching the production server away from Hono.
/experimental/sessionstays Hono-only in this PR because it owns pagination cursors, sort-specific next-cursor headers, and broader Session list internals that should be mirrored in a separate session-route slice.Related Issue
Related to #936
Human Review Status
Pending
Review Focus
Please focus on whether the new HttpApi declarations exactly match the scoped experimental JSON routes, whether handlers preserve Hono body parsing and Worktree error status behavior, and whether the route inventory assertion is strong enough without touching automation, workspace, session, streaming, or websocket routes.
Risk Notes
/experimental/sessionis intentionally skipped because honest parity would broaden into Session pagination/cursor behavior beyond this PR. No visible UI or copy changed. No platform, packaging, docs, release notes, dependency, credential, generated-content, or local-file surface was touched.How To Verify
Screenshots or Recordings
Not applicable; no visible UI changes.
Checklist
bug,enhancement,task,documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.app,ui,platform,harness,ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.P0,P1,P2,P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.Pending,Approved by @<reviewer>, orNot required: <reason>(default isPending; "not required" is restricted to bot-authored low-risk PRs).dev, and my PR title and commit messages use Conventional Commits in English.Summary by CodeRabbit
New Features
Tests