Skip to content

[bug] session_target=latest 的 cron 任务把定时报告注入用户正在进行的活跃会话 #3200

Backlog

Description

@youluo1230

环境

  • Octop v1.0.3b8,dashboard 通道,Linux

复现步骤

  1. 创建 agent 类型 cron 任务:session_target=latest、fresh_thread=false、session_key=TNBYQZ:dashboard:1:dm(dashboard 私聊),每日 10:00 运行,prompt 为「跑监控脚本,无变化时回复 [SKIP]」
  2. 10:00 之前,用户正在该 dashboard 私聊的当前活跃会话里就另一个主题多轮对话(本例:DGX 集群升级讨论,09:37 起持续多轮)
  3. 10:00 cron 触发,任务 prompt 被注入这个正在进行的会话;agent 在用户对话中间回复了 [SKIP]

期望行为

  • latest 语义不应选中「正在进行中」的会话:至少应排除最近有活跃 turn 的会话
  • 或者:创建 cron 任务时默认 fresh_thread=true(报告类任务新开会话),并在 UI/API 中提示

实际影响

  • 用户正在进行的对话被无关定时报告打断,上下文被污染
  • 报告类任务(无变化时回复极短标记,如 [SKIP])在用户视角是莫名其妙插进来的消息

时间线(2026-11-28)

  • 09:37 用户在 dashboard dm 会话中讨论 DGX 集群升级(多轮往返)
  • 10:00 cron 任务「Octop 升级与 issue 监控」触发,prompt 注入该会话,agent 在对话中间回复 [SKIP]

Activity

  1. balabommablock-cpu commented on Nov 28, 2026

    @balabommablock-cpu

    A product take, checked on main @ 3935f84. Two separate problems show up in this one run.

    1. latest is the default for every job type, including agent jobs.

    • Both the cron tool (session_target defaults to "latest" in cron/tools.py) and the dashboard form (fresh_thread: false, session_target: "latest" in constants.ts) start there.
    • run_in_session waits for the running turn to finish, then the job lands right after it in the same conversation. So it doesn't collide mid-turn, but it still sits in the middle of the user's topic.
    • latest is right for a text reminder ("time to drink water"): it's just a message, and joining the current chat feels natural. An agent job is different. Its prompt and answer become part of that conversation's history, so the next DGX question carries a monitoring script turn in its context.

    Suggestion: pick the default by task type. Text stays latest. Agent and script default to fresh_thread=true. The run already names its new conversation after the job (_remember_thread_title), so each report shows up as its own "Octop 升级与 issue 监控" chat. Anyone who wants reports in one place can still pin history. Excluding "recently active" threads from latest would also work, but it's harder to explain ("why did it go to a new chat today and not yesterday?").

    2. There's no way for a job to say "nothing to report".
    The prompt asks for [SKIP] on no change, but delivery has no quiet marker. Any non-empty reply is pushed as-is, so the user sees a bare [SKIP]. Hermes Agent handles the same pattern with a reserved [SILENT] reply: if the whole answer is that marker, nothing gets delivered. A single reserved marker, documented in the cron tool help, would make "only tell me when something changed" jobs work in any conversation. For a fresh-thread run, it could also drop the empty conversation.

    (2) is small and useful even if the default stays as it is. (1) is the one that stops the interruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions