Cache Review archive reads and scope triageQueueItem to the target item's producer(s)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- backend, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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().
- Lingua principale
- JavaScript
- Stelle
- 38
- Fork
- 32
- Merge medio
- 14m
- PR unite (30g)
- 995
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di atomantic/PortOS
-
area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
area:media effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Eliminate O(N×L) live-metadata JSON.stringify and sequential full-archive scans in cosAgentStorageApertaarea:cos-agents effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
data-integrity-safety data-safety effort:low model:light plan planner:gemini-4-neon source:data-integrity-safety
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
-
bug effort:low model:light plan planner:gemini-4-neon source:ui-runtime-bugs ui-runtime-bugs
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di atomantic/PortOS
Issue simili
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Agent360dk/browser-mcp#124 ·
I maintainer di solito rispondono entro 2 giorni
-
area:site feature good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
pacocartones/free-llm-api-hub#829 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
Jason-Vaughan/TangleClaw#3270 ·
I maintainer di solito rispondono entro 1 giorno
-
Range with start greater than end crashes the server process (bytes=100-50)Forse già presa @draarivpatel-ui l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100