Resolves #13965
Related: #12073
Threads complete raw memory-turn documents from DreamService into topology inference, then makes TopologyInferenceEngine chunk by memory-turn boundary before each graph-provider call. Each topology chunk now goes through the ConsumerFriction guardrail, uses graph-provider structured output/no-think options, and reports chunk totals into REM state. This keeps the broader #12073 Tri-Vector map/reduce lane open while removing the proven topology-side over-cap burn.
Evidence: L2 focused unit/static evidence landed; L3 live REM validation remains required after merge/restart because the over-cap symptom only appears during real local-model REM runs. Residual: full Tri-Vector map/reduce remains #12073.
Deltas from ticket
The implementation uses the existing sessionChunker primitive and subtracts the topology prompt envelope before chunking so “safe” chunks do not become unsafe after instructions are added. It adds no new deployment config leaf; required AiConfig.localModels.chat.* leaves are read at the topology use site and fail loud when stale or malformed.
Test Evidence
npm run agent-preflight -- ai/daemons/orchestrator/services/DreamService.mjs ai/services/graph/TopologyInferenceEngine.mjs test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjs
npm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjs → 33/33 passed
git diff --check
Post-Merge Validation
Commit
51116b608a — fix(ai): chunk REM topology inference by turn (#12073)
Authored by Euclid (GPT-5, Codex Desktop). Session 019ef378-527d-7393-bc74-ec3a1d3f2ddf.
Resolves #13965
Related: #12073
Threads complete raw memory-turn documents from
DreamServiceinto topology inference, then makesTopologyInferenceEnginechunk by memory-turn boundary before each graph-provider call. Each topology chunk now goes through the ConsumerFriction guardrail, uses graph-provider structured output/no-think options, and reports chunk totals into REM state. This keeps the broader #12073 Tri-Vector map/reduce lane open while removing the proven topology-side over-cap burn.Evidence: L2 focused unit/static evidence landed; L3 live REM validation remains required after merge/restart because the over-cap symptom only appears during real local-model REM runs. Residual: full Tri-Vector map/reduce remains #12073.
Deltas from ticket
The implementation uses the existing
sessionChunkerprimitive and subtracts the topology prompt envelope before chunking so “safe” chunks do not become unsafe after instructions are added. It adds no new deployment config leaf; requiredAiConfig.localModels.chat.*leaves are read at the topology use site and fail loud when stale or malformed.Test Evidence
npm run agent-preflight -- ai/daemons/orchestrator/services/DreamService.mjs ai/services/graph/TopologyInferenceEngine.mjs test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjsnpm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/services/DreamService.spec.mjs→ 33/33 passedgit diff --checkPost-Merge Validation
Commit
51116b608a—fix(ai): chunk REM topology inference by turn (#12073)Authored by Euclid (GPT-5, Codex Desktop). Session 019ef378-527d-7393-bc74-ec3a1d3f2ddf.