* fix(telegram): Rich Message 失败时保留原始错误并降级纯文本
Telegram Rich Message 发送失败时存在三个叠加问题:
1. `__send_rich_message` 用固定文本 `RetryException("发送 Telegram Rich
Message 失败")` 包装异常,`str(e)` 里没有 Telegram 返回的 description,
日志只剩“发送失败”四个字,无法判断是内容非法、方法不存在还是格式问题。
2. 内容非法这类确定性失败(400)同样走满3 次退避重试(3s、6s),
期间同一条坏消息反复阻塞,且最终报错仍无有效信息。
3. 失败即丢失通知:Rich Message 发不出去时没有任何降级路径,
整条通知直接消失。
改动:
- 异常文本改为 f"...失败:{err}",保留 Telegram 原始 description 与错误码。
- 新增 `NonRetryableTelegramError`(继承 `ImmediateException`)与
`_is_non_retryable_api_error`,400 立即抛出以跳过 retry 退避;
5xx 与网络异常保持原有重试策略。
- `send_msg` / `edit_msg` 增加纯文本降级出口,Rich Message 失败时
用不带格式解析的纯文本重发,保证通知内容不丢失。
- 降级路径显式传 `parse_mode=""`:`TelegramBotApi._parse_mode` 在参数为
`None` 时会回落到客户端默认的 MarkdownV2,那正是 Rich Message 已经
失败过的解析路径,漏传会让降级重演同一个错误。
新增 tests/test_telegram_rich_message_fallback.py(14 项)覆盖错误信息保留、
400 免重试、5xx 仍重试、发送与编辑两条降级路径,以及 parse_mode 回落陷阱的
回归防护。
* fix(telegram): 修正 Rich Message 降级路径的 mypy 与架构基线
上一提交引入的两处门禁失败:
1. `__send_plain_fallback` 用 `**self._topic_kwargs(chat_id)` 展开参数,mypy
把 `**` 匹配到 `send_message` 第 5 个形参 `disable_web_page_preview`
(Optional[bool]),判定 `dict[str, int]` 不兼容,arg-type 由 1 增至 2。
改为显式传 `message_thread_id`,`_topic_kwargs` 只可能产出该键。
2. 新增 `app.schemas.exception` 导入带来 2 条依赖边,宿主基线由 9542 变为
9544。已用 `baseline.py --write-host` 固化,其余 3 个基线文件字节不变。
连带影响:docs/architecture-overview.md 与 docs/refactor/
optimization-checklist.md 硬编码了边数,`test_architecture_documents_
match_generated_quality_metrics` 断言两处必须与基线一致,同步为 9,544。
门禁与测试验证:
- scripts/architecture/mypy_ratchet.py exit 0(9163 个类型错误)
- scripts/architecture/baseline.py --check-host exit 0
- pytest(fallback + contract + telegram) 75 passed
---------
Co-authored-by: jxxghp <jxxghp@gmail.com>
MoviePilot
简体中文 | English
Redesigned from parts of NAStool, with a stronger focus on core automation scenarios while reducing issues and making the project easier to extend and maintain.
For learning and personal communication only. Please do not promote this project on platforms in mainland China.
Release channel: https://t.me/moviepilot_channel
Key Features
- Focuses on the core media automation flow: subscriptions, search, downloads, file organization, scraping, media server refresh, and notifications.
- Uses a separated backend/frontend architecture: FastAPI for the backend and Vue 3 for the frontend.
- Connects download clients, media servers, metadata providers, message channels, plugins, workflows, and AI Agent capabilities.
- For feature details, screenshots, and product entry points, see https://movie-pilot.org
Installation and Usage
Docker is the recommended deployment model. V3 uses the dedicated jxxghp/moviepilot-v3 image; V2 and legacy images keep their existing names. Compose examples, environment variables, volume mappings, and upgrade notes are maintained in the official wiki:
- Official wiki: https://wiki.movie-pilot.org
- PostgreSQL setup: docs/postgresql-setup.md
MoviePilot can also be installed and managed from source with the local CLI:
curl -fsSL https://raw.githubusercontent.com/jxxghp/MoviePilot/v3/scripts/bootstrap-local.sh | bash
After installation, use the moviepilot command for initialization, service management, updates, and configuration. See docs/cli.md for the full command reference.
Agent
-
MoviePilot includes a built-in AI Agent. After model configuration, it can call system tools through natural language to help with search, subscriptions, downloads, organization, diagnostics, and other management tasks.
-
Other agents can import the repository
skills/directory to gain MoviePilot operation capabilities. Environments that support theskillsCLI can use:npx skills add https://github.com/jxxghp/MoviePilotBuilt-in skills live in skills/. For custom skill authoring, see skills/create-moviepilot-skill/SKILL.md.
-
Other MCP clients can call MoviePilot tools through
/api/v1/mcp. Authentication, client configuration, and tool APIs are documented in docs/mcp-api.md.
Development
Before contributing, read the repository rules and local environment guide, keep changes focused, and validate them before opening a PR. Useful entry points:
- Rule index: docs/rules/README.md
- Development setup and local source run: docs/development-setup.md
- Testing guide: docs/testing.md
- New site adapter capture and Feature Request submission: MoviePilot-Site-Collector
- Site collector downloads: independent repository Release, published only when collector inputs change.
- REST API documentation: https://api.movie-pilot.org
- Plugin development guide: https://wiki.movie-pilot.org/zh/plugindev
Related Projects
- MoviePilot-Frontend
- MoviePilot-Resources
- MoviePilot-Plugins
- MoviePilot-Server
- MoviePilot-Rust
- MoviePilot-Wiki
Disclaimer
- This software is for learning and personal communication only. It must not be used for commercial purposes or illegal activities. The software does not know how users choose to use it, and all responsibility rests with the user.
- The source code is open source and derived from other open-source code. If someone removes the relevant restrictions and redistributes or publishes modified versions that lead to liability events, the publisher of those modifications bears full responsibility. Public releases that bypass or alter the user authentication mechanism are not recommended.
- This project does not accept donations and has not published any donation page anywhere. The software itself is free of charge and does not provide paid services. Please verify information carefully to avoid being misled.