[BUG]: Race condition & state tearing in multi-org explore and audit pipelines causing stale state overwrite and quota exhaustion
Maintainer thường phản hồi trong vòng 1 ngày
@Sandeepkg123 đang làm issue này rồi.
Từ ngày 30/10/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/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ệ
- github, javascript, react
- Lĩnh vực
- backend-api-design, frontend
Hướng nghiên cứu
Start with src/context/AppContext.jsx and src/services/github.js, tracing how explore and audit runs call fetchRepos and update state. Then inspect the existing request queue and its tests, if present. Done means superseded requests stop, queued work is discarded, and an older run cannot overwrite the active run’s state.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
When users initiate multi-org exploration or trigger audit runs (e.g., clicking "Run Complete Analysis" or switching/re-searching organizations while an exploration pipeline is actively streaming network requests), AppContext.jsx triggers parallel un-cancellable promise chains (explore, runAudit, runAdvanceAnalytics, runFullAnalytics).
Because none of the fetch workflows in src/services/github.js and src/context/AppContext.jsx accept or propagate an AbortSignal, the following critical failures occur:
- State Tearing & Stale Model Overwrite:
If a user searches for Organization A, realizes a typo, and quickly searches for Organization B, both explore() pipelines run concurrently against the GitHub REST API. Whichever promise chain resolves last (Promise.allSettled in buildAnalyticalModel) overwrites model, orgs, and totalRepo in React state. As a result, the UI displays Organization A's metrics while the search bar and URL state display Organization B (or vice versa). - Quota Wastage on Navigation:
If a user navigates between routes or kicks off runAdvanceAnalytics() followed by runAudit(), unmounted components or superseded search sessions continue greedily draining the user's finite GitHub API rate limit (5,000 req/hr authenticated or 60 req/hr unauthenticated) in the background without any abort mechanism. - Ghost State & Zombie Loading Loops:
If an earlier search encounters a rate limit or HTTP failure after a later search has already settled, the catch block of the superseded promise invokes setError() and wipes the active model with setModel(null), crashing an otherwise successful second exploration.
Steps to Reproduce
- Enter a large organization into the explore bar (e.g. facebook or microsoft) without a PAT.
- While the banner displays "Fetching organization metadata..." or "Fetching repositories...", immediately enter a different organization (e.g. google).
- Observe the network tab: All concurrent paginated requests for the first organization continue executing and consuming rate limit.
- When the first organization's promise resolves after the second, the displayed data model, contributors, and health metrics violently tear and get overwritten by the obsolete first search.
Logs and Screenshots
Lines in src/context/AppContext.jsx:
const repoRes = await Promise.allSettled(validOrgs.map(async org => {
const repos = await fetchRepos(org.login, org.public_repos, pat) // Cannot be aborted
reposPerOrg[org.login] = repos
return repos
}))
Proposed Technical Solution (Senior Architectural Fix)
- Pipeline Session Cancellation via AbortController:
Introduce a mutable session reference (currentSessionAbortController = useRef(null)) within AppContext.jsx. When explore(), runAudit(), or runFullAnalytics() is triggered, any in-flight controller must immediately receive .abort() with an AbortError. - Signal Propagation in HTTP Service:
Extend fetchWithCache(url, pat, signal) in src/services/github.js to accept AbortSignal and pass it directly to the browser's native fetch(url, { headers, signal }). - Throttler Queue Purging:
Update enqueueRequest in src/services/github.js so tasks queued behind MAX_CONCURRENT_REQUESTS are pruned immediately if their associated signal is aborted, preventing backlogged obsolete requests from ever hitting the wire. - State Guarding:
Wrap state updates (setModel, setOrgs, setIssuesData, setPullsData) in generation checks (currentSessionId) to guarantee that discarded or aborted runs can never mutate active state.
Environment Details
- OS: macOS / Linux / Windows
- Browser: Chrome, Firefox, Safari (All browsers)
- Application Version: v1.0.0
Impact
- High - Major feature is broken
Code of Conduct
- I have joined the Discord server (https://discord.gg/hjUhu33uAn) and will post updates there
- I have searched existing issues to avoid duplicates
- Ngôn ngữ chính
- JavaScript
- Star
- 53
- Fork
- 187
- Merge trung bình
- 18 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AOSSIE-Org/OrgExplorer
-
[BUG]: Organization filter dropdown in AnalyticsPage renders empty list due to truthy evaluation of empty issuesDataCó thể đã có người làm @havyasreekuppam đã nhận 5 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
AOSSIE-Org/OrgExplorer#476 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add Pat for 5000 req/hr button not visible when pat expiresCó thể đã có người làm @Rajvardhan-Singh-Rathore đã nhận 7 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
AOSSIE-Org/OrgExplorer#473 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: PAT popup input lacks label association and visibility button lacks an accessible nameCó thể đã có người làm @prasanm1423 đã nhận 10 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AOSSIE-Org/OrgExplorer#466 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE]: Set dynamic document.title based on active page routeCó thể đã có người làm @23241a6749 đã nhận 8 ngày trước. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AOSSIE-Org/OrgExplorer#462 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: SocialShareButton logs unconditional console.warn when script is not loadedCó thể đã có người làm @vivekrajputofficial29-afk đã nhận 8 ngày trước. Đang mởbug enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 89/100
AOSSIE-Org/OrgExplorer#461 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của AOSSIE-Org/OrgExplorer
Issue tương tự
-
marketing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Kanevry/session-orchestrator#108 ·
-
PHP 8.6: "Returning a value from a constructor is deprecated" in app/Common/Models/Model.phpĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
awesomemotive/all-in-one-seo-pack#3238 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
andromarces/agent-loops#2055 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày