Skip to content

Conversation

@shuv1337
Copy link
Collaborator

@shuv1337 shuv1337 commented Nov 21, 2025

Summary by CodeRabbit

  • New Features

    • Model favorites: mark models, cycle forwards/back via new shortcuts, and navigate favorites in the model selector
    • Model selector: prioritized favorites + recents, keyboard favorite toggle, and clearer ordering
    • Token visibility: per-session toggle showing token estimates and context usage in messages
    • Live config updates: hot-reload with richer feedback after saving (sections changed shown in toast)
  • Bug Fixes

    • Improved conversation title generation accuracy
  • Documentation

    • Keybinds and config PATCH API docs updated (includes favorite-cycle bindings and hot-reload behavior)

✏️ Tip: You can customize this high-level summary in your review settings.

shuv1337 and others added 2 commits November 25, 2025 02:12
Resolved conflicts by taking add-model-favorites version:
- nix/hashes.json: use hash from add-model-favorites
- dialog-model.tsx: use version from add-model-favorites (includes .slice(0,5) for recents, removes unused ModelValue interface and Free component)
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx (1)

205-211: Guard favorite toggle to only operate on model entries.

The ctrl+f keybind handler casts option.value to { providerID: string; modelID: string } without verification. When !connected(), provider options from lines 180-191 are included with a different value shape. Hitting ctrl+f on a provider option will cause a runtime error or corrupt favorites.

Apply the type guard suggested in the previous review to prevent this:

 {
   keybind: Keybind.parse("ctrl+f")[0],
   title: "Favorite",
   onTrigger: (option) => {
+    const value = option.value as any
+    if (
+      !value ||
+      typeof value.providerID !== "string" ||
+      typeof value.modelID !== "string"
+    ) {
+      return
+    }
-    local.model.toggleFavorite(option.value as { providerID: string; modelID: string })
+    local.model.toggleFavorite(value)
   },
 },

Based on past review comments.

packages/opencode/src/cli/cmd/tui/context/local.tsx (1)

130-138: Add error handling for file write operations.

The save() function calls Bun.write() without handling promise rejection. If the write fails (disk full, permissions, I/O errors), the failure will be silent, leading to potential data loss without user feedback.

Apply this diff to add error handling:

 function save() {
   Bun.write(
     file,
     JSON.stringify({
       recent: modelStore.recent,
       favorite: modelStore.favorite,
     }),
-  )
+  ).catch((error) => {
+    toast.show({
+      variant: "error",
+      message: `Failed to save model preferences: ${error.message}`,
+      duration: 5000,
+    })
+  })
 }

Based on past review comments.

🧹 Nitpick comments (3)
UPSTREAM-SYNC-PLAN.md (2)

9-19: Add language specifier to code block.

The ASCII diagram block at line 9 should explicitly specify a language (e.g., text) to comply with markdown linting standards.

-```
+```text
 integration (DEFAULT)  ← Your working branch, custom features, workflow configs
      ↑
      │ merge
      │
    dev (MIRROR)        ← Read-only mirror of upstream release tags
      ↑
      │ hard reset
      │
 upstream/tags          ← sst/opencode release tags
-```
+```

265-327: Add language specifier to ASCII diagram code block.

The workflow diagram at line 265 should explicitly specify a language (e.g., text) to comply with markdown linting standards.

-```
+```text
 ┌─────────────────┐
 │ Schedule/Manual │
 ...
     [Workflow End]
-```
+```
packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx (1)

28-54: Consider extracting ordering logic into helper functions.

The ordering logic for orderedRecents, orderedFavorites, and orderedRecentList is correct but dense. Extracting these into named helper functions would improve readability and testability.

Example refactor:

function orderWithCurrentFirst<T extends { providerID: string; modelID: string }>(
  items: T[],
  current: { providerID: string; modelID: string } | undefined
): T[] {
  if (!current) return items
  return [
    ...items.filter(item => isCurrent(item, current)),
    ...items.filter(item => !isCurrent(item, current))
  ]
}

function isCurrent(
  item: { providerID: string; modelID: string },
  current: { providerID: string; modelID: string }
) {
  return item.providerID === current.providerID && item.modelID === current.modelID
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd6efe0 and 25f3396.

📒 Files selected for processing (4)
  • UPSTREAM-SYNC-PLAN.md (1 hunks)
  • packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx (6 hunks)
  • packages/opencode/src/cli/cmd/tui/context/local.tsx (4 hunks)
  • packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx}: DO NOT do unnecessary destructuring of variables
DO NOT use else statements unless necessary
DO NOT use try/catch if it can be avoided
AVOID try/catch where possible
AVOID let statements
PREFER single word variable names where possible
Use as many Bun APIs as possible like Bun.file()

Files:

  • packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
  • packages/opencode/src/cli/cmd/tui/context/local.tsx
  • packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

AVOID using any type

Files:

  • packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
  • packages/opencode/src/cli/cmd/tui/context/local.tsx
  • packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
packages/opencode/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

Use Bun with TypeScript ESM modules as the runtime environment

Files:

  • packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
  • packages/opencode/src/cli/cmd/tui/context/local.tsx
  • packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
packages/opencode/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

packages/opencode/**/*.{ts,tsx}: Use relative imports for local modules with named imports preferred
Use Zod schemas for validation
Use TypeScript interfaces for defining data structures
Use camelCase for variable and function names
Use PascalCase for class and namespace names
Use Result patterns for error handling; avoid throwing exceptions in tools
Organize code using namespace-based structure (e.g., Tool.define(), Session.create())
Pass sessionID in tool context and use App.provide() for dependency injection
Validate all inputs with Zod schemas
Use Log.create({ service: "name" }) pattern for logging
Use Storage namespace for data persistence

Files:

  • packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
  • packages/opencode/src/cli/cmd/tui/context/local.tsx
  • packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
🧬 Code graph analysis (1)
packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx (1)
packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx (1)
  • filter (149-151)
🪛 LanguageTool
UPSTREAM-SYNC-PLAN.md

[uncategorized] ~333-~333: The official name of this software platform is spelled with a capital “H”.
Context: ... Files to Create/Modify 1. Create: .github/workflows/upstream-sync.yml - Main wor...

(GITHUB)


[uncategorized] ~335-~335: The official name of this software platform is spelled with a capital “H”.
Context: ...onflict detection helper 3. Create: .github/last-synced-tag - Tracks last synced u...

(GITHUB)


[uncategorized] ~336-~336: The official name of this software platform is spelled with a capital “H”.
Context: ...ced upstream release tag 4. Create: `.github/ISSUE_TEMPLATE/upstream-sync-conflict.m...

(GITHUB)


[uncategorized] ~355-~355: The official name of this software platform is spelled with a capital “H”.
Context: ...Actions run history + commit messages + .github/last-synced-tag | --- ## Risks and M...

(GITHUB)

🪛 markdownlint-cli2 (0.18.1)
UPSTREAM-SYNC-PLAN.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


265-265: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: update
🔇 Additional comments (5)
UPSTREAM-SYNC-PLAN.md (2)

331-338: Note: Ignore false-positive GitHub capitalization warnings.

Static analysis tools flagged .github/ paths for capitalization, but this is incorrect. The .github/ directory is GitHub's reserved path and must be lowercase by convention. The current formatting is correct.


1-327: Comprehensive upstream sync pipeline blueprint.

This document provides a well-structured, phased approach to automating upstream synchronization while preserving custom features. The workflow architecture (4-phase design with tag detection, conflict auto-resolution, post-merge validation, and issue reporting) is sound and operationally complete.

Key strengths:

  • Clear branch architecture (dev as read-only mirror, integration as default)
  • Intelligent conflict-resolution strategies (lock file regeneration, categorized handling)
  • Robust failure modes (issue creation, validation gates)
  • Practical runbooks for manual intervention
  • Comprehensive risk mitigations
packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx (1)

240-240: LGTM! Improved keybind bar spacing.

The increased gap improves visual clarity for the keybind items in the bottom bar.

packages/opencode/src/cli/cmd/tui/context/local.tsx (2)

228-254: LGTM! Well-implemented favorite cycling.

The cycleFavorite function correctly handles:

  • Filtering invalid favorites before cycling
  • User feedback when no favorites exist
  • Wrap-around navigation in both directions
  • Deduplication and size limiting of the recent list
  • Persistence via save()

274-293: LGTM! Robust favorite toggle implementation.

The toggleFavorite function properly validates the model before mutation, provides user feedback for invalid models, and correctly toggles the favorite state with proper filtering logic and persistence.

@shuv1337 shuv1337 merged commit 122015b into dev Nov 26, 2025
6 checks passed
@shuv1337
Copy link
Collaborator Author

shuv1337 commented Dec 2, 2025

/oc rerun with fork action

@shuv1337
Copy link
Collaborator Author

shuv1337 commented Dec 2, 2025

/oc retry with local build

@shuv1337
Copy link
Collaborator Author

shuv1337 commented Dec 2, 2025

/oc retry with bun runner

@shuv1337
Copy link
Collaborator Author

shuv1337 commented Dec 2, 2025

/oc retry after app install

@opencode-agent
Copy link

opencode-agent bot commented Dec 2, 2025

The repository is on the integration branch with a clean working tree. The workflow successfully:

  1. Checked out the repository
  2. Set up Bun
  3. Installed dependencies
  4. Triggered opencode

The /oc retry after app install command has successfully invoked the opencode GitHub Action workflow. The workflow is running correctly on the integration branch.

Since there's no specific task in the comment beyond "retry after app install", this appears to be a test to verify that:

  1. The GitHub App is properly installed
  2. The opencode workflow triggers correctly on /oc comments
  3. The workflow can access the repository and run

All of these are working correctly. The workflow has successfully executed and I (opencode) am now running and able to interact with the repository. Is there a specific task you'd like me to perform?

New%20session%20-%202025-12-02T08%3A24%3A54.386Z
opencode session  |  github run

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.