Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
id: RPT-011
title: Multi-tool output neutralizes the inactive tool's heat command, so it prints cold while the warning says only the active tool changes
type: bug
severity: low
status: triaged
created: 2026-11-20
triaged: 2026-11-20
task-id: TSK-018
---

## Summary

The `multi-tool` warning (ADR-0004) tells the user that "only the active tool's temperature is changed". The transform does more than that. It neutralizes every `M104`/`M109` after the tier 0 command, whatever its `T` word. That includes the heat command of a tool that is not active yet. The tier commands carry no `T` word, so they only reach the tool that is active at each tier start. A tool selected mid-print can therefore extrude before anything heats it, and the download is still offered because `multi-tool` is only a warning.

## Where

- `packages/core/src/transform.ts:140-143` — the neutralize loop ignores `temperatureLine.tool`; any non-turn-off line after the tier 0 line is neutralized.
- `packages/core/src/transform.ts:94` — tier commands are `M109 R<t>` / `M104 S<t>` with no `T`, so they target the active tool only.
- `packages/core/src/validation.ts:173` — warning text: `only the active tool's temperature is changed`.
- `docs/adr/0004-validation-gate-and-change-report.md:11` — "multi-tool G-code (only the active tool is changed)".
- `fixtures/prusaslicer/multi-tool.golden.gcode:7-8,290-301` — committed golden output showing the effect.

## Observed output

`fixtures/prusaslicer/multi-tool.golden.gcode` (written by `pnpm fixture`, passes `pnpm test`):

```
7: M104 S215 ; set extruder temp <- start G-code heats the active tool (T0) only
8: M109 S215 ; wait for extruder temp
16: T0
18: M109 R230 ; [temptower] tier 0
...
290: T1
291: ; [temptower] neutralized: M104 S230 T1 <- T1's only heat command is removed
292: G1 X100 Y100 F9000
293: G1 X120 Y100 E1 F1200 <- T1 extrudes the whole Z7 layer unheated
...
301: M104 S225 ; [temptower] tier 1 <- first temperature T1 receives, one layer later
```

The report for this fixture (`multi-tool.report.json`) has only the `multi-tool` warning, and `canDownload` is true. On Marlin and Prusa firmware, cold-extrusion protection blocks or skips the T1 moves. The user was told that only the active tool would be changed.

## Impact

Low. Multi-tool towers are uncommon in Phase 1, and the fixture is synthetic. Real Prusa XL start G-code usually heats every used tool before tier 0, and those lines are kept. But any tool heated after tier 0 (a later tool change, or a standby/preheat `M104 T<n>` before a tool change) loses that command. The warning text does not tell the user this happens.

## Suggested fix

Pick one of these:
- Keep `M104`/`M109` lines whose `T` word names a tool other than the active one. This needs a new ADR, because ADR-0002 lists tool-indexed variants as neutralized.
- Reword the `multi-tool` warning, and ADR-0004's description of it, to say that every tool's temperature commands after tier 0 are neutralized and that tiers reach only the active tool.
3 changes: 2 additions & 1 deletion .backlog/tasks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Status | Count |
|--------|-------|
| Pending | 2 |
| Pending | 3 |
| Active | 2 |
| Blocked | 0 |
| Complete | 13 |
Expand All @@ -20,6 +20,7 @@
|----|-------|----------|------|---------|
| TSK-007 | Public launch with counter and physical print gate | P3 | release, community | 2026-10-18 |
| TSK-017 | Fix: Tower config accepts heights the STL name cannot encode, breaking the lossless round trip | P4 | | 2026-11-17 |
| TSK-018 | Fix: Multi-tool output neutralizes the inactive tool's heat command, so it prints cold while the warning says only the active tool changes | P4 | | 2026-11-20 |

## Recently Completed

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: TSK-018
title: Fix: Multi-tool output neutralizes the inactive tool's heat command, so it prints cold while the warning says only the active tool changes
status: pending
priority: P4
tags: []
created: 2026-11-20
source: report/RPT-011
depends-on: []
---

# Fix: Multi-tool output neutralizes the inactive tool's heat command, so it prints cold while the warning says only the active tool changes

## Description

### Context

From RPT-011. The transform neutralizes every `M104`/`M109` after tier 0, including the heat command of a tool that is not active yet (`packages/core/src/transform.ts:140-143`). Tier commands carry no `T` word. In `fixtures/prusaslicer/multi-tool.golden.gcode:290-301`, T1 extrudes a full layer after its only heat command was neutralized. Meanwhile the warning (`packages/core/src/validation.ts:173`) says only the active tool's temperature is changed.

### Approach

1. Decide whether to keep tool-indexed lines for non-active tools. That needs a new ADR, because ADR-0002 neutralizes tool-indexed variants. The alternative is to reword the warning and ADR-0004.
2. Change the transform or the warning to match the decision.
3. Run `pnpm fixture` and review the multi-tool golden and report diff by hand.

## Acceptance Criteria

- [ ] A decision is recorded: either inactive-tool M104/M109 T<n> lines after tier 0 are kept (new ADR amending ADR-0002) or the multi-tool warning and ADR-0004 text describe that all tools are neutralized
- [ ] The multi-tool warning text in packages/core/src/validation.ts matches what the transform does
- [ ] The multi-tool fixture golden no longer shows a tool extruding before any heat command reaches it, or its report states that this can happen
- [ ] pnpm test and pnpm typecheck pass

## Notes

## Learnings

## Progress Log

- [2026-11-20] Created
Loading