Cache Review archive reads and scope triageQueueItem to the target item's producer(s)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- backend, performance
調査の方向性
Start in server/services/review.js at loadArchive() (around lines 162-164), comparing it with the itemsCache pattern in loadItems() (lines 132-152), then check getItems() for the new Date() calls in the sort comparator. Next, read triageQueueItem() in server/services/reviewQueue.js (around lines 1378-1387) and its gatherFullQueue() call. Done means archive reads are cached and coalesced, archive writes invalidate the cache, triage gathers only the producers for the item's source prefix, and the 503, 404 and 400 responses are unchanged, with tests in server/services/review.test.js and server/services/reviewQueue.test.js.
索引モデルが issue の本文から書いたものです。
説明
Audit slice: server/services/review.js, server/services/reviewQueue.js (re-verification of 2026-11-24 performance-efficiency slice) — Date: 2026-11-26
Scope: small
Batched model:light + effort:low performance-efficiency findings in the Review Hub services:
-
Cache
archive.jsonbymtimeMs/sizewith in-flight coalescing inserver/services/review.js- Problem:
loadItems()(server/services/review.js:132-152) cachesitems.jsonby{ mtimeMs, size }, butloadArchive()(server/services/review.js:162-164) has no cache or in-flight deduplication. Even after#18598paged the HTTP responses, everyGET /api/review/itemspage navigation re-reads andJSON.parse()s the entire multi-MBarchive.jsonfrom disk, and everyGET /api/review/queue?view=historytriggers two concurrent reads + parses ofarchive.jsonin parallel (from thetodoproducer atserver/services/reviewQueue.js:562and thehistoryproducer atserver/services/reviewQueue.js:591). Additionally,getItems()(review.js:276-280) allocates twonew Date(...)objects per comparator call while sorting all live + archived items before slicing. - Impact: Repeated multi-MB disk reads and main-thread
JSON.parse()stalls on every Review History open and page turn, doubled onview=history. - Fix: Add an
mtimeMs + sizecache (archiveCache) and in-flight read coalescing toloadArchive()inserver/services/review.js(mirroringitemsCache), invalidate it on everyARCHIVE_FILEwrite (applyRetention,loadItemCollection's save wrapper,reopenItem,removeMemoryApprovalItems), clone only the returned items ingetItems()(after filter/sort/paginate; mutation paths still clone before mutating), and useDate.parse(or pre-parsed timestamps) instead ofnew Date(...)inside thesort()comparator.
- Problem:
-
Scope
triageQueueItem()to the target item's owning producer(s) inserver/services/reviewQueue.js- Problem: In
server/services/reviewQueue.js:1378-1387,triageQueueItem()callsgatherFullQueue({}, { applyTriageState: false, now })to validate a single item before snoozing, unsnoozing, or dismissing it. That runsgetActiveGoalOptions()and fans out across all 15 live producers (Brain, Threads with per-task/per-app lookups, Ask, CoS approvals, CoS feedback, Message drafts, Review items, Todos, Notifications, GitHub notifications DB query, Stacker News, X, Product engagement, System health alerts, Software updates, Backup state), immediately beforePOST /api/review/queue/triage(server/routes/review.js:110) emitsqueue:changedand triggers connected clients to rebuild the full queue a second time. - Impact: Every single snooze, unsnooze, or dismiss click pays a full 15-source cross-domain fan-out (DB queries, filesystem reads, and potential system-health sweep) twice in a row.
- Fix: Map the parsed
sourceprefix ofqueueItemIdinserver/services/reviewQueue.jsto the minimal producer set that can emit it (PRODUCERS_BY_SOURCE[source]for direct sources;['review', 'notifications']for adapted sourcesmemory,goal-fidelity,plan,content,autopilot;['cos', 'review', 'notifications']forcos), pass anonlySourcesoption togatherFullQueue(), and skipgetActiveGoalOptions()unless'ask'is included. Preserve the exact 503SOURCE_UNAVAILABLE, 404NOT_FOUND, and 400CAPABILITY_UNAVAILABLEresponses.
- Problem: In
Acceptance Criteria
-
loadArchive()inserver/services/review.jscaches parsed archive data by{ mtimeMs, size }, coalesces concurrent reads soGET /api/review/queue?view=historyparsesarchive.jsonat most once, and invalidates the cache on every write toARCHIVE_FILE. -
getItems()does not allocatenew Date()objects inside thesort()comparator and clones only returned items (preserving cache immutability for callers). -
triageQueueItem()inserver/services/reviewQueue.jsgathers only the producer(s) capable of emitting the targetqueueItemId's source prefix and skipsgetActiveGoalOptions()when'ask'is not among them. - Unit tests in
server/services/review.test.jsandserver/services/reviewQueue.test.jsverify archive cache hits/invalidation/coalescing and scoped producer gathering intriageQueueItem().
- 主要言語
- JavaScript
- スター
- 38
- フォーク
- 32
- 平均マージ
- 14分
- マージ済み PR(30日)
- 995
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
atomantic/PortOS のほかの issue
-
area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area:media effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Eliminate O(N×L) live-metadata JSON.stringify and sequential full-archive scans in cosAgentStorageオープンarea:cos-agents effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
data-integrity-safety data-safety effort:low model:light plan planner:gemini-4-neon source:data-integrity-safety
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
bug effort:low model:light plan planner:gemini-4-neon source:ui-runtime-bugs ui-runtime-bugs
難易度 3/5 半日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
atomantic/PortOS の issue をすべて見る
似ている issue
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
Agent360dk/browser-mcp#124 ·
メンテナーはふだん 2 日以内に返信
-
area:site feature good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
pacocartones/free-llm-api-hub#829 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Jason-Vaughan/TangleClaw#3270 ·
メンテナーはふだん 1 日以内に返信
-
Range with start greater than end crashes the server process (bytes=100-50)対応中かも @draarivpatel-ui が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100