Skip to content

Add escalate: push a new needs_human blocker to Telegram - #3

Merged
lorenzoliuzzo merged 1 commit into
mainfrom
feat/needs-human-escalation
Jul 12, 2026
Merged

Add escalate: push a new needs_human blocker to Telegram#3
lorenzoliuzzo merged 1 commit into
mainfrom
feat/needs-human-escalation

Conversation

@lorenzoliuzzo

Copy link
Copy Markdown
Contributor

Summary

fleet-dispatch#44, part of fleet-dispatch#46 Phase 2 (Decide).

  • `mydirector escalate --dispatch-ledger --bot-ledger` reads fleet_dispatch's own dispatch ledger straight off disk for `needs_human` entries — the same read-only seam `sources.py` already uses to surface MyPlanner's latest sequence — and shells out to `mytelegrambot escalate-blocker` (companion PR Push needs_human blockers to Telegram with Retry/Skip/take buttons my-telegram-bot#36) for each new one.
  • Each candidate is escalated at most once (dedup via a `kind=escalated` ledger entry); a failed push is deliberately not recorded, so it's retried next run instead of silently lost — same posture as `notify()`/`send_spend_alert()`.
  • `_bot_binary()` resolution mirrors `fleet_ask.py`'s: prefer the console script beside the running interpreter, fall back to `PATH`.

Test plan

  • `python -m pytest -q` — 37/37 pass
  • `--cov=mydirector` — `escalate.py` at 96% (the two uncovered lines are a defensive OSError/ValueError catch identical in shape to `sources.py`'s own, never actually raised by `Ledger`), 93% overall, clears the repo's `fail_under=85` gate
  • `ruff check .` clean

Refs MyThingsLab/fleet-dispatch#44, MyThingsLab/fleet-dispatch#46

fleet-dispatch#44: fleet_dispatch marks a candidate needs_human after
MAX_ATTEMPTS unresolved tries and moves on -- a state nobody was
watching until the operator happened to look.

mydirector escalate reads fleet_dispatch's dispatch ledger directly
(the same read-only seam sources.py already uses for MyPlanner's
sequence, no package dependency) and shells out to `mytelegrambot
escalate-blocker` for each new one -- the fleet's normal cross-tool
relationship, mirroring fleet_ask.py's ask-channel hand-off. Each
candidate is escalated at most once; a failed push is not recorded,
so it's retried next run rather than silently lost.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/mydirector/escalate.py 96.29% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@lorenzoliuzzo
lorenzoliuzzo merged commit fb22e01 into main Jul 12, 2026
2 checks passed
@lorenzoliuzzo
lorenzoliuzzo deleted the feat/needs-human-escalation branch July 12, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant