Cache Review archive reads and scope triageQueueItem to the target item's producer(s)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- backend, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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().
- Lenguaje dominante
- JavaScript
- Estrellas
- 38
- Forks
- 32
- Merge medio
- 14 min
- PR fusionados (30 d)
- 995
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de atomantic/PortOS
-
area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
area:media effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Eliminate O(N×L) live-metadata JSON.stringify and sequential full-archive scans in cosAgentStorageAbiertoarea:cos-agents effort:medium model:medium performance performance-efficiency plan planner:gemini-4-neon source:performance-efficiency
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
data-integrity-safety data-safety effort:low model:light plan planner:gemini-4-neon source:data-integrity-safety
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
bug effort:low model:light plan planner:gemini-4-neon source:ui-runtime-bugs ui-runtime-bugs
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
Todos los issues de atomantic/PortOS
Issues similares
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Agent360dk/browser-mcp#124 ·
Los mantenedores suelen responder en 2 días
-
area:site feature good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
pacocartones/free-llm-api-hub#829 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Jason-Vaughan/TangleClaw#3270 ·
Los mantenedores suelen responder en 1 día
-
Range with start greater than end crashes the server process (bytes=100-50)Posiblemente ocupada @draarivpatel-ui la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100