Skip to content

[MC:   NN.1.S] Add OpenCode Go, endpoint plugins, and review fixes (Refs OPS-1122) - #556

Open
jaywedgeworth22 wants to merge 5 commits into
mainfrom
muse-code/opencode-go-plugins-review
Open

jaywedgeworth22 wants to merge 5 commits into
mainfrom
muse-code/opencode-go-plugins-review

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Refs OPS-1122. Refs CC-238 (already landed in #554/#555; verified here, not duplicated).

Summary

Adds built-in OpenCode Go quota monitoring and declarative endpoint plugins, plus review-driven UI, reliability, and accessibility fixes. Refs OPS-1122.

What changed

  • Added OpenCode Go as an optional built-in source under opencode-go with 5-hour, weekly, and monthly windows read from OpenCode's usage endpoint using the CLI's locally saved Go key. Missing sign-in reports no windows and no issue; 401/403 and service failures surface as provider issues. New Settings row enables toggling without an app update.
  • Added declarative endpoint plugins loaded from ~/Library/Application Support/CodeCaps/Plugins/*.json. Descriptors define one GET endpoint, auth as none or Bearer env-var name, and 1–10 windows via restricted JSON paths for remaining/used percent or absolute balances plus reset stamps. Validation refuses reserved provider keys, non-HTTPS endpoints except opted-in loopback, private/metadata literals, userinfo/query/fragment URLs, oversize/invalid files, and duplicates. Plugins register as optional readers with plugin:<slug> ids and flow through existing snapshots, ranking, and toggles.
  • Updated Settings Sources & Fleet and Logo Style lists to include OpenCode Go and current plugins, and fixed optional-reader disable to purge plugin windows by provider key. Added docs/ENDPOINT-PLUGINS.md and extended docs/TOKEN-PLAN-SOURCES.md.
  • Added bounded retry for v2 quota publish on 502/503/504 and timeouts, with no retry for generic webhooks. Added 10-second timeout for snapshot predecessor wait so one stuck disk write reports failure instead of stalling later writes.
  • Applied UI/accessibility fixes: menu tooltip hint, PiP and console keyboard support, VoiceOver handling for PiP controls and exhaustion popups, and text/contrast sizing updates. Runtime verification was not reported.

Tests added

  • Added EndpointPluginTests covering descriptor validation, SSRF matrix, loopback opt-in, JSON path grammar, generic reader mapping, missing-key behavior, loader fail-closed behavior, and disabled-plugin factory non-invocation.
  • Added OpenCodeGoQuotaReaderTests covering percent inversion, rate-limited exhaustion, absent-key behavior, auth wording, unparseable payloads, and auth-file extraction.
  • Extended QuotaPublisherTests with transient retry and no-retry webhook cases, and SnapshotWriteDrainTests with predecessor-timeout coverage. Test execution results were not reported, so passing status is unverified.

Open review findings / risks

Automated review reported 5 unresolved findings, described here as reported and unverified:

  • Critical: missing plugin token error omits the exact env variable name in GenericEndpointQuotaReader.swift:48.
  • Medium: optional reader toggle may scan disk on every toggle in MonitorModel.swift:1358.
  • Medium: out-of-range quota percent is clamped rather than rejected in GenericEndpointQuotaReader.swift:94.
  • Medium: unrestricted bearerEnv may allow reading any environment variable in GenericEndpointQuotaReader.swift:29.
  • Low: alert text rendering issue in ConsoleViews.swift:340.

DNS-rebinding residual risk for plugins is noted in code comments as trusted local configuration.


Summary

Fixes punctuation in the Console unavailable-source alert. Adds a period after the provider / window identifier before the Sources & Fleet guidance.

Impact

User-visible text correction only with no logic or flow change. Refs OPS-1122.

Verification

No test evidence is included in the provided changes; behavior is unverified.

…iew fixes (Refs OPS-1122)

- OpenCode Go: documented usage endpoint via the CLI's local auth file
- Endpoint plugins: validated JSON descriptors in the Plugins folder,
  generic bounded reader, SSRF gate, Settings toggles without recompiling
- Alibaba/MiMo/Qwen verified against #554/#555 (already on main), docs updated
- UI: sentenceGap, accent-ink shortcut, logo fallback from reader list,
  PiP keyboard/VoiceOver access, larger tertiary labels, keyboard splitter,
  popup no longer auto-expires for VoiceOver/Reduce Motion, right-click hint
- Perf: snapshot-write chain predecessor deadline surfaces a stuck write
  instead of stalling silently; v2 publisher retries transient 502/503/504
@linear-code

linear-code Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

CC-238

OPS-1122

@kody-ai

kody-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

Comment thread Sources/CodeCaps/SettingsViews.swift Resolved
@kody-ai

kody-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Automatic approval held

Kody's assessment:

Risk was identified in this PR.

@kody-ai

This comment has been minimized.

Comment thread Sources/CodeCaps/ConsoleViews.swift Resolved
Comment thread Sources/CodeCaps/MonitorModel.swift Resolved

@kody-ai kody-ai 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.

Found critical issues please review the requested changes

Kody takes this request back once the findings above are resolved.

@kody-ai

This comment has been minimized.

- Restrict bearerEnv to CODECAPS_PLUGIN_-prefixed variables and name the
  missing variable in the plugin issue
- Refuse non-canonical IP literals (hex/octal/bare-integer/leading-zero)
  and scope the loopback port exception to loopback hosts only
- Reject descriptors with both percent paths; dedicated badDisplayName error
- Reject out-of-range percentages instead of clamping them
- Cache plugin loads for Settings rows and reader toggles
@kody-ai

kody-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

PR Summary (Comment created by Kody 🤖)

Code Review Started! 🚀

✋ Hi, team! I'm already looking at the changed files and starting the review to ensure everything is in order. If you need more details, I'm here! Kody

📂 Changed Files
File Status ➕ Additions ➖ Deletions 🔄 Changes
Sources/CodeCaps/MonitorModel.swift modified 2 1 3
Sources/CodeCaps/SettingsViews.swift modified 1 1 2
Sources/QuotaCore/EndpointPluginDescriptor.swift modified 38 8 46
Sources/QuotaCore/EndpointPluginLoader.swift modified 21 0 21
Sources/QuotaCore/GenericEndpointQuotaReader.swift modified 12 4 16
Tests/QuotaCoreTests/EndpointPluginTests.swift modified 48 2 50
docs/ENDPOINT-PLUGINS.md modified 3 3 6
📊 Summary of Changes
  • Total Files: 7
  • Total Lines Added: 125
  • Total Lines Removed: 19
  • Total Changes: 144

​

This branch has not been deployed

No deployments
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