Skip to content

Telegram direct sessions can lose prior user turns from model context #16

@ihnotic

Description

@ihnotic

Problem

Live Zeus Telegram direct sessions can preserve prior inbound user messages in the JSONL transcript while omitting those user turns from the model request context. This makes replies behave as if the bot has no memory of the previous Telegram messages.

Observed live example: session agent:main:telegram:direct:8599953238 kept the user turn UniFi code 498563 in the transcript file, but later context.compiled / prompt.submitted trajectory events did not include that string.

Fix direction

  • Treat SessionManager transcript context as authoritative when restored active session state is missing persisted user turns.
  • Support account-scoped direct-message session keys when resolving per-DM history limits.
  • Keep stale final-answer replay and no-reply fallback regressions covered on the same deployment branch so Zeus does not regress overnight.

Acceptance

  • Regression test proves a Telegram prior user turn present in SessionManager but absent in active restored state is included before context-engine assembly and prompt submission.
  • History-limit tests cover agent:<agent>:telegram:<account>:direct:<user>.
  • OpenClaw build and focused Telegram/session tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions