Add observable model operations UI#14
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughAdds a dedicated ChangesEvals Admin Page
Sequence Diagram(s)sequenceDiagram
participant Browser
participant handleModelCheck
participant modelEvalMu
participant saveModelCheck
participant modelProbe
Browser->>handleModelCheck: POST /models/check
handleModelCheck->>modelEvalMu: TryLock()
alt already locked
handleModelCheck-->>Browser: 429 another model operation is already running
else lock acquired
handleModelCheck->>saveModelCheck: checkingModelCheck(provider, modelID)
saveModelCheck-->>handleModelCheck: ok
handleModelCheck->>modelProbe: probe(provider, modelID)
modelProbe-->>handleModelCheck: latency / error
handleModelCheck->>saveModelCheck: free_verified status + latency
handleModelCheck-->>Browser: 200
handleModelCheck->>modelEvalMu: Unlock()
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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: 709a17f525
ℹ️ 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".
| return | ||
| } | ||
| defer s.modelEvalMu.Unlock() | ||
| if err := s.saveModelEval(r.Context(), provider, modelID, runningModelEval(provider, modelID)); err != nil { |
There was a problem hiding this comment.
Clear persisted running state after request cancellation
After this write succeeds, the only path that replaces running uses ctx derived from r.Context() below. If the browser or proxy cancels the htmx request while the eval is in flight, the final saveModelEval(ctx, ...) runs with a canceled context and PutSetting fails, leaving this model permanently marked running in kv_settings and the UI disables the eval button; the /models/check path has the same pattern for checking. Use a detached bounded context for the final status update or expire stale running/checking records.
Useful? React with 👍 / 👎.
Summary
Tests
Summary by CodeRabbit
Release Notes
New Features
Improvements