Skip to content

fix(telegram): nudge timing gate + quieter turn output#93

Merged
jkyberneees merged 1 commit into
mainfrom
fix/telegram-polish
Jul 22, 2026
Merged

fix(telegram): nudge timing gate + quieter turn output#93
jkyberneees merged 1 commit into
mainfrom
fix/telegram-polish

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Fixes three polish issues spotted in real bot usage (screenshot: the bot nudged "You asked about my purpose earlier — want me to answer that now?" immediately after answering that exact question, and every turn produced three identical quoted-user-message blocks).

1. Bad nudges for answered questions (the real bug)

Per-turn extraction creates question atoms from the user message before the assistant answers — so every freshly asked question looks "unanswered" at extraction time and was eligible for an immediate 💡 nudge. Question atoms are now age-gated: only questions older than nudge_open_question_min_age_hours (default 24h; env ODEK_MEMORY_EXTENDED_NUDGE_OPEN_QUESTION_MIN_AGE_HOURS) become nudge candidates. Goals/intents are unaffected (they have their own staleness window). A fresh back-and-forth can no longer produce nudges about itself.

Tests: TestNudgeOpenQuestionAgeGate (fresh excluded, old included, young goals unaffected), TestNudgeOpenQuestionAgeGateConfigurable (custom threshold), fixture aged to stay above the default gate.

2. Duplicate quoted user message

The per-turn stats block and the nudge message were both sent with ReplyToMessageID while the answer message already quotes the user — three identical quotes per turn. Stats and nudges are now standalone messages (a nudge refers to older memory, not to the triggering message).

3. Cryptic cache stats

cache: 0cr+0rd+0ctcache: 0 write / 0 read / 0 total.

Verification

  • go test ./... — all green; golangci-lint 0 issues.
  • Docs: docs/EXTENDED_MEMORY.md + docs/CONFIG.md rows for the new key and the gate behavior in the P6 section.

Three polish issues from real bot usage:

1. Bad nudges for answered questions. Per-turn extraction creates
   'question' atoms from the user message BEFORE the assistant answers,
   so every freshly asked question looked 'unanswered' and could be
   nudged immediately ('You asked about my purpose earlier - want me to
   answer that now?' right after it was answered). Question atoms are
   now age-gated: only questions older than
   memory.extended.nudge_open_question_min_age_hours (default 24, env
   ODEK_MEMORY_EXTENDED_NUDGE_OPEN_QUESTION_MIN_AGE_HOURS) are nudge
   candidates. Goals/intents are unaffected (own staleness window).

2. Duplicate quoted user message. The per-turn stats block and the
   nudge message were both sent with ReplyToMessageID while the answer
   message already quotes the user - three identical quotes per turn.
   Stats and nudges are now standalone messages.

3. Cryptic cache stats: 'cache: 0cr+0rd+0ct' is now
   'cache: 0 write / 0 read / 0 total'.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 702f0ec Commit Preview URL

Branch Preview URL
Jul 22 2026, 06:31 PM

@jkyberneees
jkyberneees merged commit db639eb into main Jul 22, 2026
8 checks passed
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