aboutsummaryrefslogtreecommitdiff
path: root/claude-templates/.ai/workflows
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-08-05 17:49:17 -0500
committerCraig Jennings <c@cjennings.net>2026-08-05 17:49:17 -0500
commit7637a97ad50d24144f91aae7287194736e73ca5a (patch)
tree7152c3f8e5c800fdf6db38a2ab1bdc8a39ee7ab4 /claude-templates/.ai/workflows
parentfc1a519e6891769733f593b4fd4286bfa00e5cb7 (diff)
downloadrulesets-7637a97ad50d24144f91aae7287194736e73ca5a.tar.gz
rulesets-7637a97ad50d24144f91aae7287194736e73ca5a.zip
fix(triage): pass a callback to telega--loadChats so scans stop printing 404s
telega--loadChats sends fire-and-forget when its callback is nil. The reply then matches no :@extra and falls through to telega--on-error, a catch-all whose whole body prints the message. TDLib returns 404 here to mean every chat is already loaded, so the line was noise we generated ourselves. It printed twice a scan with nothing actually wrong. Passing #'ignore consumes the reply. The call stays asynchronous, since the block-and-wait path is reachable only with a nil callback.
Diffstat (limited to 'claude-templates/.ai/workflows')
-rw-r--r--claude-templates/.ai/workflows/triage-intake.telegram.org26
1 files changed, 23 insertions, 3 deletions
diff --git a/claude-templates/.ai/workflows/triage-intake.telegram.org b/claude-templates/.ai/workflows/triage-intake.telegram.org
index 1319da5..6ec9d66 100644
--- a/claude-templates/.ai/workflows/triage-intake.telegram.org
+++ b/claude-templates/.ai/workflows/triage-intake.telegram.org
@@ -50,8 +50,10 @@ server never disables the source.
The setq is mandatory defense: tdlib crashed in native mode when this was
set up (2026-06-09) — a separate matter from the SEGFAULT gotcha, which is
about the loadChats argument — and Craig's daemon defaults to nil.
- Wait ~2s for Ready, then (telega--loadChats '(:@type "chatListMain")) until telega--chats
- is populated.
+ Wait ~2s for Ready, then (telega--loadChats '(:@type "chatListMain") #'ignore)
+ until telega--chats is populated. The #'ignore callback is mandatory, not
+ decoration: without it every call prints a spurious "Telega error 404" (see
+ Step 1's comment).
3. Check messages: the maphash unread scan in ** Scan Step 2 (filters the
messageContactRegistered join-notice noise).
4. Send (needs the server live; /voice personal first — Telegram
@@ -135,7 +137,25 @@ emacsclient -e "(progn
# The `fboundp' guard matches Step 0: if the launch failed outright telega is not
# loaded, and that should read as 'server-died like any other failure rather than
# signalling void-function.
-emacsclient -e "(progn (ignore-errors (telega--loadChats '(:@type \"chatListMain\"))) (ignore-errors (telega--loadChats '(:@type \"chatListMain\"))) (if (and (fboundp 'telega-server-live-p) (telega-server-live-p)) 'loaded 'server-died))"
+#
+# The `#'ignore' callback is what keeps this quiet, and it is a THIRD separate
+# concern from the two above — it touches the callback, not the argument and not
+# docker mode. Without it each call printed `Telega error 404: Not Found' into the
+# echo area and *Messages* of Craig's daemon, two lines per scan from whichever
+# project ran it. The 404 is TDLib's end-of-list marker ("Return error if all chats are
+# loaded"), not a fault: `telega--loadChats' hands the callback to
+# `telega-server--send-or-call', which sends fire-and-forget when it is nil, so the
+# reply matches no `:@extra', falls through to `telega--on-error' — a bare catch-all
+# whose whole body is that message — and gets printed. telega's own startup call
+# (telega.el:290) passes a callback and is silent for exactly this reason.
+# Passing a callback keeps the call asynchronous: the block-and-wait path in
+# `telega-server--call' is reachable only when the callback is nil.
+#
+# The macro's docstring reads "Use this macro instead of `(or callback 'ignore)'
+# pattern." That is guidance for whoever writes a tdlib wrapper — don't hardcode a
+# callback inside the wrapper — not a bar on the caller choosing one. We are the
+# caller.
+emacsclient -e "(progn (ignore-errors (telega--loadChats '(:@type \"chatListMain\") #'ignore)) (ignore-errors (telega--loadChats '(:@type \"chatListMain\") #'ignore)) (if (and (fboundp 'telega-server-live-p) (telega-server-live-p)) 'loaded 'server-died))"
#+end_src
On a persisted session telega reaches status "Ready" within ~2s; the chat list