revert: PR #313 + #318 (mastracode 0.14 アップグレードに伴う DiffViewer 表示崩れ)#332
revert: PR #313 + #318 (mastracode 0.14 アップグレードに伴う DiffViewer 表示崩れ)#332
Conversation
#313 の revert で消えた mastracode externalize エントリを復元。 mastracode は @mastra/fastembed → onnxruntime-node を引き込み、 onnxruntime-node の native binding は dynamic require で読まれるため Rollup が bundle 時に解決できず、main プロセスの起動が失敗する。
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughモデルプロバイダー診断システムの導入、AIモデル呼び出しパイプラインの再設計(プロバイダー反復に基づく)、エラー分類メカニズムの強化、デスクトップ設定UIのリファクタリング、 Changes
Sequence Diagram(s)sequenceDiagram
participant Client as クライアント
participant CallSmallModel as callSmallModel
participant ProviderLoop as プロバイダー反復
participant Auth as 認証情報解決
participant Model as モデル作成
participant Invocation as モデル呼び出し
participant Classify as エラー分類
participant Diagnostics as 診断レジストリ
Client->>CallSmallModel: invoke(プロバイダーリスト, ...)
loop 各プロバイダー
CallSmallModel->>ProviderLoop: 次のプロバイダーを取得
ProviderLoop->>Auth: 認証情報を解決
alt 認証情報がない
Auth-->>Diagnostics: missing-credentials を記録
ProviderLoop->>ProviderLoop: スキップ
else OAuth トークン期限切れ
Auth-->>Diagnostics: expired-credentials を記録
ProviderLoop->>ProviderLoop: スキップ
else 有効な認証情報
Auth->>Model: クレデンシャルを渡す
alt モデル作成成功
Model->>Invocation: モデルで invoke() 実行
alt invocation が成功
Invocation-->>CallSmallModel: 結果を返す
CallSmallModel->>Diagnostics: succeeded を記録、問題をクリア
CallSmallModel-->>Client: 結果を返す
else invocation が失敗
Invocation->>Classify: エラーメッセージを分類
Classify-->>Diagnostics: unknown_error/empty_result を記録
ProviderLoop->>ProviderLoop: 次のプロバイダーへ
end
else モデル作成失敗
Model->>Classify: 例外を分類
Classify-->>Diagnostics: unsupported_credentials/unknown_error を記録
ProviderLoop->>ProviderLoop: 次のプロバイダーへ
end
end
end
CallSmallModel-->>Client: { result: null, attempts: [...] }
sequenceDiagram
participant UI as 設定UI
participant TRPC as TRPCエンドポイント
participant ChatService as ChatService
participant Diagnostics as 診断レジストリ
participant AuthStorage as 認証ストレージ
UI->>TRPC: modelProviders.getStatuses をクエリ
TRPC->>ChatService: getAnthropicAuthStatus()
TRPC->>ChatService: getOpenAIAuthStatus()
ChatService->>AuthStorage: 認証情報を読み取り
AuthStorage-->>ChatService: AuthStatus を返す
ChatService-->>TRPC: ステータス配列
TRPC->>Diagnostics: 各プロバイダーの診断を取得
Diagnostics-->>TRPC: ProviderDiagnostic[]
TRPC-->>UI: { status, issue, capabilities }
UI->>UI: AccountCard/ボタンの状態を派生
alt ユーザーがクリアを実行
UI->>TRPC: modelProviders.clearIssue.mutate
TRPC->>Diagnostics: clearProviderIssue(providerId)
TRPC->>TRPC: modelProviders.getStatuses を無効化
TRPC-->>UI: { success: true }
UI->>TRPC: getStatuses を再取得
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9cd508932
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| authStorage.set(providerId, { | ||
| type: "api_key", | ||
| key: trimmedApiKey, | ||
| }); |
There was a problem hiding this comment.
Preserve API key when OAuth overwrites provider credential slot
setApiKeyForProvider now saves the key only in the same providerId record used by OAuth credentials, so a user who saves an API key, signs in with OAuth, and later disconnects OAuth can lose the original key and end up fully disconnected. The OAuth login path writes OAuth data into this slot and disconnect removes it, so without a separate backup/restore path the prior API key is not recoverable after this flow.
Useful? React with 👍 / 👎.
| if ( | ||
| credential.type === "oauth" && | ||
| typeof credential.access === "string" && | ||
| credential.access.trim().length > 0 | ||
| ) { |
There was a problem hiding this comment.
Refresh Anthropic OAuth before returning expired auth-storage token
This path returns the stored Anthropic OAuth access token directly, including expired ones, without attempting refresh via auth storage. Downstream, callSmallModel treats expired OAuth as a hard failure (expired-credentials) and skips the provider, so users with refreshable Anthropic sessions are incorrectly forced into fallback/failure until manual reconnect instead of auto-refreshing.
Useful? React with 👍 / 👎.
概要
upstream取り込み PR #313 (mastracode 0.14 + small-model refactor) とその regression 修正 #318 を revert します。
発生していた問題
PR #313 マージ後に以下の症状を確認:
LightDiffViewer/MultiFileDiff使用箇所全般)onnxruntime_binding.nodeの dynamic require を@rollup/plugin-commonjsが解決できず main プロセス起動失敗(mastracode が @mastra/fastembed 経由で onnxruntime-node を引き込むため)切り分け手順
`main-test` ブランチで 10 本の upstream取り込み PR を全て revert してから 1 件ずつ un-revert し、Vite / dist キャッシュも完全クリアした状態で動作確認:
この PR の内容
workspace-creation.tsの import 競合を手動解決)根本原因(未特定)
#313 のファイル変更自体には DiffViewer /
@pierre/diffs/ shiki 関連のコードは含まれない。`@pierre/diffs` や `shiki` のバージョンも不変。mastracode `0.9.2` → `0.14.0` で発生する大量の transitive 依存(`@mastra/agent-browser`, `@mastra/stagehand`, `@mastra/fastembed`, `@browserbasehq/stagehand`, `chat@4.26.0` など)が Vite の renderer bundle / deps 最適化に副作用を与えている可能性が高い。
根本原因の深掘りは別途フォローアップで実施予定。
影響
Summary by CodeRabbit
リリースノート
新機能
バグ修正
改善