Alma Cron Bug Report

Environment

  • Alma Version: (需要运行 alma version 获取)

  • OS: macOS

  • Date: 2026-03-11

Issue Summary

alma cron run 手动触发任务时存在以下问题:

  1. 任务声称已触发(显示 "✅ Job triggered"),但实际未执行(runCount 保持为 0)

  2. Alma 重启后才能正常执行,但执行结果异常(返回值被截断为 "let")

  3. isolated 模式下 deliverTo 配置的消息未实际发送

Reproduction Steps

1. 创建定时任务

alma cron add "锻炼提醒" at "12:00" \
  --mode isolated \
  --prompt "该开始锻炼了!" \
  --deliver-to "ou_4f11cf9d9c11f0e787xxxxxxxx" \
  --model "mizbtaieqd3hmn4d9u8:mimo-v2-flash"

输出:

✅ Job created: 7d0fc2bf-8473-481a-a9a2-536312f24b60 "锻炼提醒" [at:12:00]

2. 查看任务配置

cat ~/.config/alma/cron/jobs.json | jq '.[] | select(.name == "锻炼提醒")'

配置内容:

{
  "id": "7d0fc2bf-8473-481a-a9a2-536312f24b60",
  "name": "锻炼提醒",
  "scheduleType": "at",
  "schedule": "12:00",
  "executionMode": "isolated",
  "payload": {
    "agentTurn": "该开始锻炼了!",
    "deliverTo": "ou_4f11cf9d9c11f0e787xxxxxxxx",
    "model": "mizbtaieqd3hmn4d9u8:mimo-v2-flash"
  },
  "enabled": true,
  "createdAt": "2026-03-11T11:40:16.673Z",
  "updatedAt": "2026-03-11T11:40:16.673Z",
  "lastRunAt": null,
  "lastRunResult": null,
  "runCount": 0
}

3. 手动触发任务(Alma 重启前)

alma cron run 7d0fc2bf

输出:

 Job triggered: 锻炼提醒

检查执行结果:

alma cron history 7d0fc2bf

输出:

No run history.

检查 jobs.json:

{
  "runCount": 0,
  "lastRunAt": null,
  "lastRunResult": null
}

❌ Bug #1: 任务声称触发但未实际执行

4. 重启 Alma 后再次触发

osascript -e 'tell application "Alma" to quit'
sleep 2
open -a Alma
sleep 3
alma cron run 7d0fc2bf

输出:

 Job triggered: 锻炼提醒

检查执行结果:

alma cron history 7d0fc2bf

输出:

 3/11/2026, 7:46:35 PM  let

jobs.json 内容:

{
  "runCount": 1,
  "lastRunAt": "2026-03-11T11:46:35.492Z",
  "lastRunResult": "let"
}

❌ Bug #2: 执行结果被截断为 "let",应该是完整的消息内容

❌ Bug #3: 用户在 Feishu 端(ou_4f11cf9d9c11f0e787xxxxxxxx)未收到任何消息,deliverTo 未生效

Expected Behavior

  1. alma cron run 应立即执行任务,无需重启

  2. lastRunResult 应包含完整的 agent 响应内容

  3. isolated 模式下,消息应通过 deliverTo 指定的渠道发送给用户

Additional Context

成功案例对比

之前创建的另一个任务在自动定时触发时能够成功执行:

{
  "id": "dd1b0f35-4f24-48aa-bde9-a2864e18ebf4",
  "name": "锻炼提醒",
  "scheduleType": "at",
  "schedule": "12:00",
  "executionMode": "isolated",
  "payload": {
    "agentTurn": "该开始锻炼了!",
    "deliverTo": "oc_439027c6ebf28xxxxxxxx",
    "model": "mizbtaieqd3hmn4d9u8:mimo-v2-flash"
  },
  "lastRunAt": "2026-03-11T11:33:30.454Z",
  "lastRunResult": "🏃‍♂️ 2026-03-11 周三 | 记得锻炼身体哦,Meta42~ 别忘了每天活动一下,保持健康!",
  "runCount": 1
}

注意:这次使用的是 Feishu user_id (oc_ 开头),结果显示正常,但用户仍未收到消息。

测试过的 deliverTo 值

  • oc_439027c6ebf28xxxxxxxx (Feishu user_id) - 执行成功但未收到消息

  • ou_4f11cf9d9c11f0e787xxxxxxxx (Feishu open_id) - 返回值截断为 "let"

Workaround 尝试

尝试使用 --mode main --thread-id 将消息注入到当前对话:

alma cron update dd1b0f35 --mode main --thread-id mmlspcxvlliorvs18u
alma cron run dd1b0f35

执行结果:

 3/11/2026, 7:37:25 PM  No threadId specified for main session execution and no hea…

Bug #4: --thread-id 参数未正确保存到 payload 中

Questions

  1. deliverTo 应该使用什么格式的 ID?是 Feishu user_id (oc_)、open_id (ou_),还是其他?

  2. alma cron run 为什么需要重启 Alma 才能生效?

  3. isolated 模式的消息发送机制是如何工作的?是否需要额外的配置?

  4. main 模式下如何正确指定 threadId?

System Info

alma status
# ✅ Alma is running at http://localhost:23001

ls ~/.config/alma/cron/
# jobs.json  runs.json

cat ~/.config/alma/cron/runs.json
# []

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
🐛

Bug Reports

Date

3 days ago

Author

Meta42

Subscribe to post

Get notified by email when there are changes.