BUG (motir-ai) — the `augment` and `expand_item` handlers ALSO ignore `context.generateExplanations`, so two of the three plan-edit paths still drop explanations
Repo: motir-ai. One PR. Surfaced while running MOTIR-2111 (notes.html #27 — an out-of-scope defect found mid-subtask is logged as its own card, never absorbed).
The defect
MOTIR-2110's producer half puts generateExplanations on the envelope for all three plan-edit job kinds — aiPlanEditsService.ts:43 types them as Extract<JobKind, 'augment' | 'expand_item' | 'replan'> and line 134 sets the flag on every one of them. MOTIR-2111 fixed the replan consumer. The other two consumers still ignore it (verified on origin/main @ 9d41e8d, counted with python since grep finds nothing in these long-line files):
| handler | runGenerationPass calls | mentions generateExplanations |
|---|---|---|
generateTree.ts | 1 | 4 ✅ |
replan.ts | 1 | 2 ✅ (MOTIR-2111) |
augment.ts | 1 | 0 ❌ |
expandItem.ts | 1 | 0 ❌ |
So a project with "AI-drafted explanations" ON still gets explanation-less nodes from an augment or an expand — the same silent no-op MOTIR-2110/2111 fixed for re-plan. aiPlanEditsService.ts:129-130 even notes the contextual turn can resolve an augment submit into a re-plan, which is why the producer set the flag on all three rather than replan alone.
Acceptance criteria
augment.tsandexpandItem.tseach read the flag off the job envelope exactly asgenerateTree.ts/replan.tsdo (the same defensivereq?.context?.generateExplanations === true) and pass it to theirrunGenerationPasscall.- A grep for
runGenerationPass(acrosssrc/jobs/handlers/**finds NO call site that omits the option spread — write the AC as the grep, so it does not go stale on a new handler. - With the flag ON, each path's
propose_nodeproposals carryexplanationMd+explanationSource: 'ai_draft'through toaddProposals— asserted by a test per handler, not by inspection. - With the flag OFF or absent, each composed pass input is byte-identical to today's (assert the key is ABSENT, not
false). - Do NOT read motir-core config directly — the flag rides the envelope.
- PR title carries
MOTIR-<id>.
Context refs
src/jobs/handlers/augment.ts,src/jobs/handlers/expandItem.ts— the two handlers edited.src/jobs/handlers/replan.ts— the reference fix (MOTIR-2111), andgenerateTree.tsbefore it.tests/replanHandler.test.ts— the test shape to mirror: flag ON / OFF / non-boolean, plus the sink carry-through intoaddProposals.- motir-core
lib/services/aiPlanEditsService.ts:43,134— the producer proving all three kinds carry the flag.