Chat usage: a member refused usage still re-requests it after every chat turn

Đang mở Phù hợp với người mới
#2,085 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Đọc src/features/instance/applications/components/Chat/index.tsx và src/react-query/pollUnlessForbidden.ts để theo dõi việc sử dụng vô hiệu hóa truy vấn và xử lý 403. Kiểm tra trạng thái lỗi của truy vấn đã được lưu vào bộ nhớ đệm trước khi vô hiệu hóa trong onFinish; xác minh rằng 403 không kích hoạt yêu cầu khác sau một lượt chat, trong khi lấy lại tiêu điểm hoặc gắn kết lại vẫn có thể khôi phục. Không cần dọn dẹp tùy chọn vị từ thử lại để sửa lỗi này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

rum
Problem

Org members who aren't admins or chat-read staff get a 403 from GET /Chat/Usage/<org> (central manager's chat usage resource refuses them). The fix-chat-usage-403 branch stops the retries and the toast, but the query still re-asks:

  • src/features/instance/applications/components/Chat/index.tsx:45 invalidates ['getMyUsage'] in onFinish, so every assistant turn sends one more request that is refused.
  • The query stays in error state, so a window refocus or remount sends one more as well. src/react-query/pollUnlessForbidden.ts:79-82 treats refocus and remount as the way to recover from a 403, so that part is deliberate.
  • retryUnlessRejected() is called on every render, so a new closure is built each time. This is minor and not on a hot path.

Each case is one silent request, down from four requests and a toast.

Fix

Skip the onFinish invalidation while the cached usage query holds a 403. Or resolve a 403 to null with a long staleTime, which means a newly granted permission only shows up after a reload. Hoisting the retry predicate to module scope is optional.

Review-Deferral: 88c3da70d8bcb076 severity=nit category=performance
Review-Deferral: 5ee4dd3d93066134 severity=nit category=performance

🤖 Generated by Anthropic Claude (Claude Code); posted via @dawsontoth.

Ngôn ngữ chính
TypeScript
Star
5
Fork
4
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
60

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của HarperFast/studio

Tất cả issue của HarperFast/studio

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.