fix(telegram): nudge timing gate + quieter turn output#93
Merged
Conversation
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'.
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
questionatoms 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 thannudge_open_question_min_age_hours(default 24h; envODEK_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
ReplyToMessageIDwhile 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+0ct→cache: 0 write / 0 read / 0 total.Verification
go test ./...— all green;golangci-lint0 issues.docs/EXTENDED_MEMORY.md+docs/CONFIG.mdrows for the new key and the gate behavior in the P6 section.