[ZCode 主仓 bugfix] CronCreate 无条件改写会话标题——修复分支已就绪,主仓 PR 渠道受限,请求拉取
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
调研方向
Start by reading automation-port.ts and core/runtime/methods/session-title.ts, then run apps/zcode-cli/packages/core/test/session-title.test.ts. Done means the existing session-title tests pass, the bootstrap build and architecture check remain clean, and CronCreate no longer changes custom or generated session titles.
由索引模型根据 Issue 内容生成。
描述
说明:本 issue 面向 ZCode 主仓(zai-org/ZCode) 的一个 bug 修复。主仓当前 issues 关闭、外部账号创建 PR 也被权限拦截(GraphQL 报
does not have the correct permissions to execute CreatePullRequest),修复分支已推到 fork,只能借本仓库反馈,请维护者拉取或告知正确的提交渠道。
[Bug] CronCreate 会无条件把当前任务(会话)标题改写为 automation 标题
修复分支:https://github.com/neoblackxt/ZCode/tree/fix/croncreate-session-title-freeze
基于 main(29628c9),7 个文件 +169/-2,含 spec 与单元测试(5/5 通过)。
问题
会话内 CronCreate 成功后,automation-port.ts 会无条件调用 setCustomSessionTitle 把当前会话(任务)标题覆盖为该 automation 的 title(代码注释称 "freeze session title")。该调用不检查标题现有来源,titleSource === "custom"(用户手动命名)与 generated(自动命名已完成)的任务都会被覆盖。
实际影响:在长周期任务中多次创建定时巡检(watchdog)类 automation 时,任务名随每次 CronCreate 反复变化——每个新 automation 就改一次名,用户手动命名也会被覆盖,严重干扰任务列表管理。
实测记录(桌面版 3.11.2,同一任务一天内被改名 4 次,session_title_updated 事件与 CronCreate 调用毫秒级对齐):
| 时间 | 调用 | 任务被改为的名字(= automation title) |
|---|---|---|
| 17:00:54 | CronCreate | vol_volume_coupling 全量计算 watchdog |
| 17:03:39 | CronCreate | vol_volume_coupling IC 快筛 watchdog |
| 18:07:19 | CronCreate | illiquidity 分钟 stage1 watchdog |
| 18:54:30 | CronCreate | illiquidity IC main 轮 watchdog |
原因
冻结的设计意图(原注释)是抢占首轮迟到的标题生成 sidecar,避免标题被生成成"我无法..."之类的内容。问题在于:
setCustomSessionTitle无条件覆盖,缺少与其它路径一致的保护——自动命名路径(persistGeneratedSessionTitle)在titleSource === "custom"时会跳过,且写回带expectedTitleSources乐观锁;冻结路径两者皆无。结果是自动命名尊重用户手动命名,冻结反而不尊重。- 冻结对已命名的既有会话没有可保护的对象:标题生成只在
turnNumber === 0触发(resume.ts从历史消息重建turnNumber,不会归零),任务中途不存在迟到 sidecar 的竞争窗口,此时覆盖的唯一效果就是改写既有任务名。
修复方案
新增 freezeSessionTitleForAutomation(core/runtime/methods/session-title.ts),把"是否需要冻结"的判定收敛到拥有标题语义的 runtime 层:
- 仅当当前
titleSource ∈ {default, first_input}(sidecar 可能尚未写回)时冻结为 automation 标题——完整保留抢占首轮迟到 sidecar 的原设计意图; custom(用户手动命名)与generated(sidecar 已完成)跳过,记automation.session_title_freeze.skipped(debug);- 用户手动重命名路径(
setCustomSessionTitle)行为不变。
影响面:首轮创建 automation 行为不变;任务中途 / 手动命名后创建 automation 不再被改名;同一任务多个 automation 不再互相覆盖任务名。
验证
- 单元测试(新增,node:test):
apps/zcode-cli/packages/core/test/session-title.test.ts,5/5 通过,覆盖上述全部场景; pnpm -r --filter "@zcode/bootstrap..." run build通过(含 core/bootstrap 全量 tsc 类型检查);pnpm architecture:check --changed:violations 0 / baseline 0 / new 0;- lint / fmt:改动文件 0 警告 0 错误(bootstrap 包存量的 20 个 lint 错误经 stash 对照确认与本次无关)。
请求
- 维护者直接从上述 fork 分支拉取 / cherry-pick(提交信息已按仓库规范写好,含中文修复说明);或
- 告知外部贡献的正确提交渠道(若 PR 权限是临时限制,恢复后我可立即在主仓补提正式 PR)。
- 主要语言
- Python
- 星标
- 86
- 派生
- 51
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
zai-org/zcode-plugins 的其他 Issue
-
video-agent-kit (0.4.3): hooks invoke python3, which doesn't exist on Windows — SessionStart/UserPromptSubmit/Stop hooks fail on every trigger可能已有人在做 @dvd233 于 14 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
zai-org/zcode-plugins#14 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 49/100
zai-org/zcode-plugins#67 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
zai-org/zcode-plugins#64 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
zai-org/zcode-plugins#63 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
zai-org/zcode-plugins#59 ·
维护者通常 1 天内回复
查看 zai-org/zcode-plugins 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
fabriziosalmi/certmate#1207 ·
维护者通常 1 天内回复
-
[work-item] adam-adae-onset-emergence: document the minute-precision datetime coercion (ASTTMF not derivable)可能已有人在做 @muse-yamaa-bot 今天认领。 未关闭work-item
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
CommunityToolkit/Aspire#2231 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
volcengine/OpenViking#5711 ·
维护者通常 1 天内回复