fix(rewrite): make image upload non-fatal and add rewrite tracing logs

- wordpress.py: catch image download/upload failures and skip image
  instead of aborting the entire WP draft update
- pipeline.py: add INFO logs at each step of _do_rewrite_and_draft
  to trace OpenAI call, tag generation, and WP API call
- telegram_bot.py: add INFO logs around rewrite execution + exc_info
  on error for full traceback in logs
- repositories.py: include scheduled_publish_at in get_article_by_id

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OliverGiertz 2026-03-26 07:45:55 +00:00
parent 12932bca90
commit 1963e32ab4
5 changed files with 42 additions and 9 deletions

View file

@ -435,14 +435,16 @@ def _handle_callback(callback_query: dict[str, Any]) -> None:
if action == "rewrite":
try:
logger.info("Rewrite #%d: starte rewrite_and_update_draft", article_id)
_pipeline.rewrite_and_update_draft(article_id)
logger.info("Rewrite #%d: abgeschlossen, sende Benachrichtigung", article_id)
updated = get_article_by_id(article_id)
if updated:
from .scheduler import suggest_publish_slot
slot = suggest_publish_slot()
notify_new_draft(updated, score=_get_relevance_score(updated), suggested_publish_at=slot)
except Exception as exc:
logger.error("Rewrite #%d fehlgeschlagen: %s", article_id, exc)
logger.error("Rewrite #%d fehlgeschlagen: %s", article_id, exc, exc_info=True)
notify_error(f"Rewrite #{article_id} fehlgeschlagen: {exc}")
elif action == "discard":