Skip to content

fix(cron): reject oversized prompts - #297

Merged
tt-a1i merged 2 commits into
openpi-dev:mainfrom
SSK988I:codex/issue-296-cron-prompt-limit
Aug 30, 2026
Merged

tt-a1i merged 2 commits into
openpi-dev:mainfrom
SSK988I:codex/issue-296-cron-prompt-limit

Conversation

@SSK988I

@SSK988I SSK988I commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Problem

/cron in 和 /cron every 对超过 2000 字符的 Prompt 使用 .slice(0, 2000) 静默截断,但仍提示调度成功。用户看到的任务与实际保存、执行的内容不一致。

Fixes #296

Value

超长 Prompt 现在会立即得到明确错误,不会创建内容已被悄悄修改的定时任务。这使调度结果可预测,也避免长 Prompt 的尾部约束在用户不知情时丢失。

Approach

  • 移除解析阶段的静默截断。
  • Prompt 经 trim() 后若超过 CRON_PROMPT_MAX_CHARS,返回明确的帮助错误并拒绝创建任务。
  • 为 in、every 两种模式补充 2000/2001 字符边界测试。
  • 补充命令层回归测试,确认超限时不会创建任务或触发消息。

Validation

  • Cron 专项测试:15/15 通过。
  • tsc --noEmit:通过。
  • biome lint . --error-on-warnings:通过。
  • 修改文件的 Biome format/check:通过。
  • 配置契约检查:通过(14 个持久化字段)。
  • 纪律账本检查:通过(12 行)。
  • 全量测试已运行;Cron 相关测试全部通过,但 Windows 环境中既有的 background-terminal / activity rendering 用例失败,随后测试进程未正常退出,已终止。
  • 仓库级 biome format . 在当前 Windows checkout 中因既有 CRLF 文件报错;本 PR 的三个修改文件均已单独通过格式检查。
  • 当前环境未安装 Bun,因此使用各脚本的 Node/Biome/TypeScript 等价命令完成验证。

Impact

  • 用户可见行为:超过 2000 字符的 Cron Prompt 从“截断后成功”改为“明确拒绝”。
  • 模型可见上下文/工具:无变化。
  • 运行时/生命周期:超限输入不会创建 Cron job。
  • 持久化配置/数据:无变化。
  • 兼容性与风险:依赖旧有静默截断行为的调用现在会收到错误;这是预期的安全行为变更。

@SSK988I
SSK988I force-pushed the codex/issue-296-cron-prompt-limit branch from c2d269e to edaa4ee Compare August 30, 2026 04:31
@SSK988I
SSK988I force-pushed the codex/issue-296-cron-prompt-limit branch from edaa4ee to 0898e0a Compare August 30, 2026 04:34

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head e046451 after updating onto main 63a05c8. The change replaces silent truncation of cron prompts with an explicit fail-closed 2000-character limit for one-shot and recurring schedules. Boundary and no-job-created tests cover 2000/2001 characters. Local full validation passed: bun run check, 1052 Node tests passed with 1 platform skip, and 30/30 Vitest tests. Fresh required CI passed on Node 22.19.0, Node 24, and Windows. No blocking findings.

@tt-a1i
tt-a1i merged commit e7ac3d2 into openpi-dev:main Aug 30, 2026
4 checks passed
agnitum2009 pushed a commit to agnitum2009/openpi that referenced this pull request Sep 3, 2026
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.

fix(cron): 超长 Prompt 被静默截断后仍提示调度成功

2 participants