Skip to content

feat: improve native Pi integration and prepare package releases - #108

Merged
zeldrisho merged 6 commits into
mainfrom
fix/opencode-free-usage-limit
Oct 24, 2026
Merged

zeldrisho merged 6 commits into
mainfrom
fix/opencode-free-usage-limit

Conversation

@zeldrisho

Copy link
Copy Markdown
Owner

Improve native Pi integration across OpenCode Free, gate, and the web tools, and prepare their next releases.

  • OpenCode Free stops retrying exhausted usage quotas while keeping ordinary rate limits retryable. Model discovery follows Pi’s four-hour refresh policy, revalidates metadata with ETags, and retains endpoint-scoped fallback catalogs. Reset times use local 24-hour, minute-precision formatting.
  • Gate creates starter configuration at session start and cancels active and queued approvals on shutdown or session replacement. A real SDK regression test covers nested tool-call gating without shell execution.
  • Web fetch and search show cache progress and compact result summaries in tool previews without changing model-facing output, and expose read-only network permission hints. Fetch also declares its existing input bounds in its schema.

Release manifests and dated changelogs prepare pi-gate@0.7.1, pi-opencode-free@0.2.1, and both web packages at 0.14.0. Publishing remains a separate post-merge step triggered by individual component tags.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bfb01066-839a-4726-8f80-d355c5defb2d

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30207e86-7da5-4191-b9f0-f72e8fc36e90
Commits

Reviewing files that changed from the base of the PR and between c6dee82 and 95c75b4.

Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 27
  • docs/architecture.md
  • packages/pi-gate/CHANGELOG.md
  • packages/pi-gate/README.md
  • packages/pi-gate/package.json
  • packages/pi-gate/src/index.ts
  • packages/pi-gate/tests/index.test.ts
  • packages/pi-gate/tests/nested-calls.test.ts
  • packages/pi-opencode-free/CHANGELOG.md
  • packages/pi-opencode-free/README.md
  • packages/pi-opencode-free/package.json
  • packages/pi-opencode-free/src/index.ts
  • packages/pi-opencode-free/src/models.ts
  • packages/pi-opencode-free/src/quota.ts
  • packages/pi-opencode-free/tests/extension.test.ts
  • packages/pi-opencode-free/tests/models.test.ts
  • packages/pi-opencode-free/tests/stream.test.ts
  • packages/pi-web-fetch/CHANGELOG.md
  • packages/pi-web-fetch/package.json
  • packages/pi-web-fetch/src/index.ts
  • packages/pi-web-fetch/tests/limits.test.ts
  • packages/pi-web-fetch/tests/rendering.test.ts
  • packages/pi-web-fetch/tests/transport.test.ts
  • packages/pi-web-search/CHANGELOG.md
  • packages/pi-web-search/package.json
  • packages/pi-web-search/src/index.ts
  • packages/pi-web-search/tests/harness.ts
  • packages/pi-web-search/tests/schema-rendering.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

This pull request updates Pi Gate session handling, OpenCode Free catalog refresh and quota messages, and web fetch and search tool contracts and previews. It also updates release metadata and documentation.

Changes: Pi Gate session lifecycle

Layer / File(s) Summary
Session startup and approval cancellation
packages/pi-gate/src/index.ts, packages/pi-gate/tests/*, packages/pi-gate/README.md, packages/pi-gate/CHANGELOG.md, packages/pi-gate/package.json
Starter configuration is created at session start. Session cancellation signals reach queued tool calls and approval prompts. Tests cover shutdown, session replacement, stale calls, and nested calls. The package version and release notes are updated.

OpenCode Free catalog refresh

Layer / File(s) Summary
Catalog snapshots and conditional discovery
packages/pi-opencode-free/src/models.ts, packages/pi-opencode-free/tests/models.test.ts
Discovery supports validated persisted catalog snapshots, conditional requests, and HTTP status reporting. A 304 reuses the cached snapshot; 404 and 501 produce an empty snapshot.
Endpoint-scoped refresh and persistence
packages/pi-opencode-free/src/index.ts, packages/pi-opencode-free/tests/extension.test.ts, packages/pi-opencode-free/README.md, docs/architecture.md, packages/pi-opencode-free/CHANGELOG.md, packages/pi-opencode-free/package.json
Refresh uses endpoint-matching snapshots and a four-hour freshness check. It persists catalog metadata and validators with model data. Tests cover refresh boundaries, failures, cancellation, and forced refreshes.

OpenCode Free quota messages

Layer / File(s) Summary
Quota error and reset-time display
packages/pi-opencode-free/src/quota.ts, packages/pi-opencode-free/tests/stream.test.ts
Quota errors use updated wording. Reset times use 24-hour formatting with minute precision and a short timezone name. Tests check retryability and formatting.

Web fetch tool contract and preview

Layer / File(s) Summary
Fetch input validation and preview rendering
packages/pi-web-fetch/src/index.ts, packages/pi-web-fetch/tests/*, packages/pi-web-fetch/CHANGELOG.md, packages/pi-web-fetch/package.json
The schema validates configured URL, query, and offset bounds. The tool adds read-only annotations and renders call details, partial text, and result metadata. Tests also update transport retry fixtures.

Web search tool preview

Layer / File(s) Summary
Search annotations and result summaries
packages/pi-web-search/src/index.ts, packages/pi-web-search/tests/*, packages/pi-web-search/CHANGELOG.md, packages/pi-web-search/package.json
The tool adds read-only annotations and renders partial text plus result count, cache status, and truncation details.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant session_start
  participant piGate
  participant ToolCall
  participant ApprovalDialog
  participant session_shutdown
  session_start->>piGate: Create starter configuration and session controller
  ToolCall->>piGate: Queue call with combined signal
  piGate->>ApprovalDialog: Open prompt with combined signal
  session_shutdown->>piGate: Abort session signal
  piGate-->>ApprovalDialog: Cancel pending prompt
  ApprovalDialog-->>piGate: Return cancellation
  piGate-->>ToolCall: Reject cancelled call
Loading
sequenceDiagram
  participant ModelPicker
  participant refreshModels
  participant discoverFreeModels
  participant CatalogEndpoint
  participant ModelsStore
  ModelPicker->>refreshModels: Request model refresh
  refreshModels->>ModelsStore: Read endpoint-matching snapshot
  refreshModels->>discoverFreeModels: Pass cached catalog and validators
  discoverFreeModels->>CatalogEndpoint: Send conditional catalog request
  alt Catalog unchanged
    CatalogEndpoint-->>discoverFreeModels: Return 304
    discoverFreeModels->>discoverFreeModels: Reuse cached snapshot
  else Catalog changed
    CatalogEndpoint-->>discoverFreeModels: Return 200 and catalog metadata
    discoverFreeModels->>discoverFreeModels: Build updated snapshot
  end
  discoverFreeModels-->>refreshModels: Return models and snapshot
  refreshModels->>ModelsStore: Publish models, catalog, and check time
Loading
Merge Risk: Minimal · up to 95c75

The release entry is correctly prepared ahead of tagging, and the catalog snapshot can persist across restarts. No identified issue blocks merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 72.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 16 files. (11 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description accurately summarizes the integration changes, release preparation, and publishing scope covered by the pull request.
Title check Passed The title clearly summarizes the main goals: improving native Pi integration and preparing package releases.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 72.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 16 files. (11 skipped: 11 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
📝 Generate docstrings
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@zeldrisho
zeldrisho marked this pull request as ready for review October 24, 2026 17:27
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Completed: Generate docstrings for PR #108 — View commit 21dcd72

@zeldrisho
zeldrisho merged commit 52dd167 into main Oct 24, 2026
6 checks passed
@zeldrisho
zeldrisho deleted the fix/opencode-free-usage-limit branch October 24, 2026 17:57
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