Skip to content

print-preflight: tolerant slot colour check (ΔE), --fix/--fix-colour rewrite, 3d printer slot set, send-failed retry on start --force approval #728

Closed

Description

@alex-mextner

What

Four changes from the 2026-11-04 SIMBOL print session (10 h lost): (1) 3d print-preflight slot Tn colour check compares sliced vs loaded colour by CIELAB ΔE (configurable threshold, default accepts same-family beige #E8D8B0 vs #FEE5A5) and prints the distance; material mismatch stays FAIL. (2) 3d print-preflight --fix and 3d printer start --fix-colour rewrite filament_colour/extruder_colour for the used tool in the G-code header and the 3mf config to the colour the printer reports, keep sidecars/hashes consistent and print old/new sha256. (3) New 3d printer slot set NAME T --material --color [--brand] writing the slot filament info on Moonraker printers (U1 write path researched; dry-run, fake Moonraker, idle-only, refuse offline printers). (4) RIG_HATCH_REQUEST_3D_PRINTER_START_FORCE approvals intermittently fail with 'tg-ctl ask-forward not-posted ... reason=send-failed' while plain tg works: find the path, add retry with backoff and a clear message on how to start from the printer screen.

Why (motivation)

The 2026-11-04 SIMBOL session lost hours: a preflight FAIL on a same-family beige (#E8D8B0 vs #FEE5A5) was only resolvable with --force, whose Telegram approval failed intermittently with send-failed.

User impact

The operator can start a long print immediately after a one-command colour fix instead of waiting on a flaky approval; the preflight stops blocking on harmless colour variants.

Cost of inaction

The next long print again stalls for hours on a colour false-FAIL and a failing --force approval.

Acceptance criteria

  • print-preflight reports ΔE for slot colour; #E8D8B0 vs #FEE5A5 passes by default, a different hue FAILs, material mismatch FAILs — forced: tests/test_colour_fix.py, tests/test_printer_colour_commands.py, tests/e2e/test_print_preflight_colour_workflows.py: ΔE 6.4 passes by default (#E8D8B0 vs #FEE5A5), blue FAILs, PLA vs PETG FAILs; PR feat(printer): slot colour by ΔE, --fix/--fix-colour, printer slot set, retry for a start --force approval Telegram could not post (Refs #728) #730 CI test green (run 42064573784)
  • print-preflight --fix and printer start --fix-colour rewrite G-code header and 3mf config colours for the used tool and print old/new sha256; sidecars stay consistent — forced: tests/e2e/test_print_preflight_colour_workflows.py::test_preflight_fix_aligns_gcode_3mf_and_sidecars_and_prints_the_hashes and tests/e2e/test_printer_colour_workflows.py: G-code + 3MF + manifest + slice-warnings rewritten, old/new sha256 printed; one --fix also adds missing thumbnails; CI green
  • 3d printer slot set --dry-run works; real write only on an idle writable Moonraker printer, tested against a fake Moonraker — forced: tests/e2e/test_printer_colour_workflows.py + tests/test_printer_colour_commands.py: slot set --dry-run, write only on idle writable fake Moonraker, refusals; CI green
  • force-approval send-failed is retried with backoff and ends with an operator hint to start from the printer screen — forced: tests/e2e/test_printer_force_retry_workflows.py: send-failed retried 3 times then the printer-screen hint; CI green

Screenshots

(none)

Deploy

Deployed: no

Links

Skipped gates

  • links: bare field names filament_colour/extruder_colour are G-code keys, not repo paths

Activity

  1. alex-mextner commented on Nov 5, 2026

    @alex-mextner
    OwnerAuthor

    Root cause of the intermittent ask-forward not-posted … reason=send-failed (research, 2026-11-05)

    Code path. 3d printer start --force → printer_ops/force_hatch.py:require_force_approval → agent-tools agenttools_hatch_escalation.request_hatch_approval → tg-ctl ask → the tg-ctl daemon (tg-cli/features/tg-ctl/daemon-runtime/question-cards.ts: forwardAndPostQuestion). The daemon does ONE sendMessage (botPostResult, 15 s timeout, no retry). When it fails it logs ask-forward dropped: reason=send-failed, drops the ask and the client prints ask-forward not-posted: … daemon declined: reason=send-failed. Plain tg is a different process that sends later, so it can work a moment after.

    Evidence (the tg-cli daemon log, tg-ctl.<chat>.log, the two failed requests of 2026-11-04):

    22:02:45 ask-forward arrived: … req=hatch-3d-printer-start-force-d6543f0fc5b0 …
    22:02:55 sendMessage failed: TypeError: getaddrinfo EAI_AGAIN api.telegram.org
    22:02:55 ask-forward dropped: reason=send-failed …
    22:03:42 ask-forward arrived: … req=hatch-3d-printer-start-force-239457edfeda …
    22:03:44 sendMessage failed: TypeError: getaddrinfo EAI_AGAIN api.telegram.org
    22:03:44 ask-forward dropped: reason=send-failed …
    

    and the daemon's poll loop failed the same way (getaddrinfo EAI_AGAIN) every 15 s from 22:03 to 22:05+. So: a transient resolver/network failure of the daemon's own process (EAI_AGAIN = temporary DNS failure), not a Telegram or card-format problem. The same send-failed line appears for other hooks on 2026-10-25/28 and 2026-11-01 (hatch-rig-worktree-discard, hatch-block-raw-pr-merge, …): it is not specific to the printer hook.

    Safe to retry. not-posted means no card exists, so asking again cannot double-approve.

    Fix in 3d-cli (this PR). force_hatch.py asks again after 3, 10 and 30 s (four requests in all, each reported on stderr) while the verdict is reason=send-failed; every other outcome (approved, denied, expired, not-registered, no justification) is final at once. When it still fails the refusal names the way around Telegram: the file is already stored on the printer, so start it from the printer screen (Files, then Print), says the screen does NOT run these checks, and points at the daemon log lines to read.

    Outside 3d-cli (not changed here). The retry belongs in the daemon too: forwardAndPostQuestion should retry sendButtonCard on network errors (EAI_AGAIN, timeouts) with backoff before dropAsk(socket, "send-failed"), and agent-tools could map send-failed to a retryable verdict. Suggested tickets: tg-cli (daemon send retry), agent-tools (request_hatch_approval retry on not-posted … send-failed).

  2. alex-mextner commented on Nov 5, 2026

    @alex-mextner
    OwnerAuthor

    Shipped: merged via #730.
    Merge commit: 1bdda60
    This does NOT close the ticket — acceptance still needs proof. Run task read #728 for the outstanding criteria, then task check/task done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions