The re-plan pass advertises log_planning_mistake / log_planning_bug but replan.ts wires NEITHER — every call fails 'unavailable in this run'
Found while running story MOTIR-3322 (verified on origin/main @ e372f17).
replan.ts's GenerationSink implements neither logPlanningMistake nor logPlanningBug — while runGenerationPass advertises both tools on the re-plan pass.
SKELETON_PHASE_TOOLSandDEEPEN_PHASE_TOOLS(src/llm/treeGeneration.ts) both listlog_planning_mistakeandlog_planning_bug, and every handler goes throughrunGenerationPass, so the re-plan pass offers them.src/jobs/handlers/replan.ts—grep -an "logPlanningMistake\|logPlanningBug"returns nothing. Same foraugment.tsandexpandItem.ts. OnlygenerateTree.tswires either.- So the executor's
if (!sink.logPlanningMistake)arm fires and the model getslesson capture is unavailable in this run/planning-bug filing is unavailable in this run.
Why this matters more than a dead tool call. The log_planning_bug footer literally reads "Filed by the Motir planner during a re-plan", and MOTIR-3322's premise is that the re-plan path is where the commonest recurrence signal arrives. It arrives nowhere: the re-plan pass — the one operation named after this loop — cannot file a bug or capture a lesson at all. MOTIR-3326's search-before-file and MOTIR-3323's global revival are therefore live only on the onboarding / generate_tree path.
Not masked by MOTIR-3324, and not caused by it. That card withholds both tools when the envelope does not attribute the re-plan to an agent finding a card wrong. An agent-fired re-plan still advertises them — and still hits the absent sink. The two are independent: 3324 decides may this run capture, this bug is can it, at all.
Acceptance criteria
replan.ts's sink implementslogPlanningMistakeandlogPlanningBug, wired tolessonService.captureMistake/lessonService.filePlanningBugexactly asgenerateTree.ts's sink does — including thescope: 'tenant'pin (MOTIR-3327) and theaiProjectId+mistakeTypesearch context (MOTIR-3326), so the library is searched rather than the check recorded as unattempted.- The
mistakeTypethe re-plan sink supplies is the phaseassemblePlannerInputsresolved for thereplanoperation, not a literal. - An agent-fired re-plan that calls either tool reaches the store, asserted against a real database.
augmentandexpand_itemare decided EXPLICITLY in the same change — wired the same way, or stated on the record why a plan-edit turn may not capture. Silence is what produced this defect.- A tool advertised on a pass whose sink cannot serve it is the general shape; state whether the surface should be derived from the sink rather than listed independently, or why listing them separately is right.
Context refs
motir-aisrc/jobs/handlers/replan.ts— the sink, today implementing neither.motir-aisrc/jobs/handlers/generateTree.ts— the only sink that wires both; the shape to mirror.motir-aisrc/llm/treeGeneration.ts—SKELETON_PHASE_TOOLS/DEEPEN_PHASE_TOOLS,logMistakeExecutor,logBugExecutor.