Skip to content

feat(opencode): add killswitch indicators to TUI sidebar#39

Open
iceteaSA wants to merge 5 commits into
cortexkit:mainfrom
iceteaSA:feat/killswitch-sidebar
Open

feat(opencode): add killswitch indicators to TUI sidebar#39
iceteaSA wants to merge 5 commits into
cortexkit:mainfrom
iceteaSA:feat/killswitch-sidebar

Conversation

@iceteaSA
Copy link
Copy Markdown
Contributor

@iceteaSA iceteaSA commented May 21, 2026

Dependencies: Requires #35 (killswitch) and #37 (TUI sidebar) to be merged first.

Adds killswitch awareness to the TUI sidebar widget:

  • Red dot for killed accounts, green for active
  • Quota/refresh backoff state display
  • Kill summary section showing which accounts are blocked
  • writeSidebarState() computes killswitch policy for all accounts

Files:

  • packages/opencode/src/sidebar-state.ts — adds killed, backoff fields
  • packages/opencode/src/tui.tsx — killed indicator, kill status section
  • packages/opencode/src/index.ts — killswitch-aware sidebar state

Summary by cubic

Adds killswitch status to the TUI sidebar and wires it to a shared QuotaManager for real-time quota and backoff with persisted state and cross-process dedupe. Also writes a sidebar state file and exposes the TUI module so the UI can render without extra fetches.

  • New Features
    • Enforces killswitch thresholds: blocks killed accounts, returns Retry-After based on earliest reset, eager initial quota refresh, and skip-main routing if killed.
    • Sidebar: per-account status dot (green/red), kill summary, and quota/refresh backoff indicators with “retry at” timestamps.
    • QuotaManager: unified cache for main + fallbacks with inflight dedupe, exponential backoff, request-count-based refresh, persisted main quota/backoff, and cross-process file-lock dedup.
    • writeSidebarState() computes killswitch/quota/backoff for main and fallbacks and persists it for the TUI.
    • Adds /claude-killswitch command to view, enable/disable, and set per-account thresholds.
    • Exposes the TUI via @cortexkit/opencode-anthropic-auth ./tui export and copies tui.tsx at build.

Written for commit 583586a. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 16 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread packages/core/src/accounts.ts
Comment thread packages/opencode/src/tui.tsx Outdated
iceteaSA added 2 commits May 21, 2026 21:50
Unified quota cache and API gateway for main + fallback quota state.
All consumers share one QuotaManager instance for consistent caching.

Features:
- Inflight deduplication prevents concurrent API calls
- Exponential backoff (60s-15min) for 429/5xx errors
- Persists main quota and backoff state to disk via callbacks
- Cross-process file lock guard for quota API dedup
- Seeds from persisted storage on construction
- Integrates with FallbackAccountManager for shared staleness
- Captures storage path at init to prevent test config corruption
- Request-count-based refresh trigger (refreshEveryNRequests)
…reshold

Per-account request blocking when remaining quota drops below configurable
thresholds. Returns synthetic 429 when all accounts (main + fallbacks) are
below their thresholds. Includes /claude-killswitch slash command for
runtime management.

Features:
- Per-account threshold overrides (5h and 7d windows)
- Eager quota refresh on first request for killswitch evaluation
- Skip-main routing when main is killed (try surviving fallbacks)
- Filter killed accounts from reactive fallback path
- Retry-After header with earliest quota reset time
@iceteaSA iceteaSA force-pushed the feat/killswitch-sidebar branch from bfdd490 to 84f44e5 Compare May 21, 2026 20:05
iceteaSA added 3 commits May 21, 2026 22:17
Adds a TUI sidebar widget showing real-time quota usage for main and
fallback accounts. Displays usage bars, reset times, relay status,
fast mode, and cache-keepalive state.

New files: sidebar-state.ts, tui.tsx, scripts/copy-tui.mjs
Modified: package.json (TUI deps, exports), index.ts (writeSidebarState)
Shows killed account status (red dot), quota/refresh backoff state,
and kill summary in the sidebar widget.
@iceteaSA iceteaSA force-pushed the feat/killswitch-sidebar branch from 84f44e5 to 583586a Compare May 21, 2026 20:20
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​opentui/​core@​0.2.15931009298100
Addedsolid-js@​1.9.1310010010096100
Added@​opentui/​solid@​0.2.159710010098100

View full report

@socket-security
Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm entities is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: ?npm/@opentui/solid@0.2.15npm/entities@6.0.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/entities@6.0.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

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