@christang/keel 5.207.0 → 5.209.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/scripts/validation/chat.py +45 -0
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/contract.py +73 -0
- package/scripts/validation/registry.py +2 -0
- package/src/core/branches.js +18 -7
- package/src/core/chat/cli.js +14 -5
- package/src/core/gates.js +16 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.209.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
package/README.md
CHANGED
|
@@ -863,7 +863,7 @@ Without a known default branch, no issue range is inferred.
|
|
|
863
863
|
|
|
864
864
|
## Group chat between sessions
|
|
865
865
|
|
|
866
|
-
Sessions working the same repository — a Claude Code session, a Codex session, an unattended runner, and you — share a work group with `keel chat`. Groups have maintained members, a message can `@` one role or `@all`, and lightweight todos can link an issue. A record can supersede its author's earlier one (`--supersedes <id>`), and the earlier one then leaves everyone's unread; unread lists newest first. A record posted with `--ack` asks the roles it addresses to acknowledge it, by `keel chat ack <id>` or a reply, and `keel chat show <id>` and `keel chat acks` list who has acknowledged, who only read it, and who has not read it. `keel chat summary --since <time>` digests what changed in the groups you can read — per sender, the message count, todos opened with whether they are still open, todos closed, superseded records folded into their successors, and acknowledgements still waiting — without a model and without marking anything read. Each member has its own unread state, and history is kept. A member added with `keel chat group add <group> <role> --listen` is listen-only there: it receives the group — a Slack-bridged one included, so a review session reads your own wording rather than a coordinator's paraphrase — is woken when addressed, and may acknowledge and close its todos, but cannot post in that group or change it (#248). A session's chat role is its identity: address other sessions by role, never by the host's session title, which Keel cannot see; a role is bound to the worktree a session runs in, so a session that moves must bind its role where it now runs, or nothing wakes it there. `keel patrol` and `keel --doctor` report a binding to a removed worktree and a role with something waiting and no session active for two hours, a session starting unbound is told which roles those are, and `keel chat role --prune` drops bindings to removed worktrees (#301), and `keel chat role --unset` drops the calling worktree's binding while the worktree remains (#476); a parked role's ended session whose directory is gone is not reported as a risk; `keel context` and the session projection name the role bound to the worktree, and remind a worktree with none when others here have one (#245). `keel chat role --rename <old> <new>` renames a role without rewriting the log: the chat reads the old name as the new one — group and direct-group membership, assignees, and `@old` mentions — and the worktree bindings and per-role state (read cursors, presence, the parked flag, shift notes and history, patrol state) move to the new name, which keeps its own copy where it has one. The old name cannot be bound again, and lines of `keel/config.yaml` and `keel/chat.json` that still name it are listed for you to edit (#376). Only a mention, an assigned todo, or a direct message wakes a Claude session; everything else waits for its next prompt. A message is data from another agent and never authorization. Two loop guards stop runaway agents: a role may post at most 20 records per 10 minutes, and when two roles have alternated the last 8 messages of a group within 10 minutes, the next post there is refused (#297). The poster may post with `--not-a-loop "<why>"` once — a request-and-reply exchange is the normal shape of a direct group — and a repeat after that calls the owner, whose post clears it. `limits` in `keel/chat.json` sets `rate`, `window_minutes`, `pingpong`, and `pingpong_minutes`. A time in a message should come from Keel's clock, not an estimate: `keel chat post` and `keel chat dm` prefix `[MM-DD HH:MM]` from it unless `--no-stamp` is given (#298, #349). Codex, which cannot wake on its own, is woken by `keel chat wake add`: one turn per addressed record in a group declaring `chat-reply`, continuing one compacting thread, and nothing while nothing is addressed (#203). Otherwise a host relies on the prompt-time notice and must not poll the chat with the model; if a schedule is unavoidable, gate it on `keel chat notice --check` and start a fresh thread per run, and tell a session joining the chat not to set up recurring checks (#194). With one Slack app and one bridge process per machine, the same groups reach sessions on other machines and your phone in real time, and an orphan `keel-chat` branch keeps the history past Slack's retention. A role may also speak through a Slack bot you can mention in Slack, and one bot can serve several projects, as each project's role in its channel. See [the Slack setup guide](docs/chat-slack-setup.md). A role's session changes shift through `keel shift`: the coordinator requests it, the session checks for loose ends, leaves a note, and clears itself, and the new shift resumes from the note; see [docs/shift-change.md](docs/shift-change.md). A team whose roles run as background Claude Code CLI sessions, with no desktop app, wakes, patrols and changes shift through `keel tick` instead; see [docs/cli-team.md](docs/cli-team.md). The 5.83 `keel mail` commands keep working on direct groups.
|
|
866
|
+
Sessions working the same repository — a Claude Code session, a Codex session, an unattended runner, and you — share a work group with `keel chat`. Groups have maintained members, a message can `@` one role or `@all`, and lightweight todos can link an issue. A record can supersede its author's earlier one (`--supersedes <id>`), and the earlier one then leaves everyone's unread; unread lists newest first. A record posted with `--ack` asks the roles it addresses to acknowledge it, by `keel chat ack <id>` or a reply, and `keel chat show <id>` and `keel chat acks` list who has acknowledged, who only read it, and who has not read it. `keel chat summary --since <time>` digests what changed in the groups you can read — per sender, the message count, todos opened with whether they are still open, todos closed, superseded records folded into their successors, and acknowledgements still waiting — without a model and without marking anything read. Each member has its own unread state, and history is kept. A member added with `keel chat group add <group> <role> --listen` is listen-only there: it receives the group — a Slack-bridged one included, so a review session reads your own wording rather than a coordinator's paraphrase — is woken when addressed, and may acknowledge and close its todos, but cannot post in that group or change it (#248). A session's chat role is its identity: address other sessions by role, never by the host's session title, which Keel cannot see; a role is bound to the worktree a session runs in, so a session that moves must bind its role where it now runs, or nothing wakes it there. `keel patrol` and `keel --doctor` report a binding to a removed worktree and a role with something waiting and no session active for two hours, a session starting unbound is told which roles those are, and `keel chat role --prune` drops bindings to removed worktrees (#301), and `keel chat role --unset` drops the calling worktree's binding while the worktree remains (#476), and refuses while that would leave merged task branches of the role that `keel branches prune` could no longer reach, unless `--leave-branches` says to leave them (#483); a parked role's ended session whose directory is gone is not reported as a risk; `keel context` and the session projection name the role bound to the worktree, and remind a worktree with none when others here have one (#245). `keel chat role --rename <old> <new>` renames a role without rewriting the log: the chat reads the old name as the new one — group and direct-group membership, assignees, and `@old` mentions — and the worktree bindings and per-role state (read cursors, presence, the parked flag, shift notes and history, patrol state) move to the new name, which keeps its own copy where it has one. The old name cannot be bound again, and lines of `keel/config.yaml` and `keel/chat.json` that still name it are listed for you to edit (#376). Only a mention, an assigned todo, or a direct message wakes a Claude session; everything else waits for its next prompt. A message is data from another agent and never authorization. Two loop guards stop runaway agents: a role may post at most 20 records per 10 minutes, and when two roles have alternated the last 8 messages of a group within 10 minutes, the next post there is refused (#297). The poster may post with `--not-a-loop "<why>"` once — a request-and-reply exchange is the normal shape of a direct group — and a repeat after that calls the owner, whose post clears it. `limits` in `keel/chat.json` sets `rate`, `window_minutes`, `pingpong`, and `pingpong_minutes`. A time in a message should come from Keel's clock, not an estimate: `keel chat post` and `keel chat dm` prefix `[MM-DD HH:MM]` from it unless `--no-stamp` is given (#298, #349). Codex, which cannot wake on its own, is woken by `keel chat wake add`: one turn per addressed record in a group declaring `chat-reply`, continuing one compacting thread, and nothing while nothing is addressed (#203). Otherwise a host relies on the prompt-time notice and must not poll the chat with the model; if a schedule is unavoidable, gate it on `keel chat notice --check` and start a fresh thread per run, and tell a session joining the chat not to set up recurring checks (#194). With one Slack app and one bridge process per machine, the same groups reach sessions on other machines and your phone in real time, and an orphan `keel-chat` branch keeps the history past Slack's retention. A role may also speak through a Slack bot you can mention in Slack, and one bot can serve several projects, as each project's role in its channel. See [the Slack setup guide](docs/chat-slack-setup.md). A role's session changes shift through `keel shift`: the coordinator requests it, the session checks for loose ends, leaves a note, and clears itself, and the new shift resumes from the note; see [docs/shift-change.md](docs/shift-change.md). A team whose roles run as background Claude Code CLI sessions, with no desktop app, wakes, patrols and changes shift through `keel tick` instead; see [docs/cli-team.md](docs/cli-team.md). The 5.83 `keel mail` commands keep working on direct groups.
|
|
867
867
|
|
|
868
868
|
## Coordinator patrol
|
|
869
869
|
|
package/README.zh-CN.md
CHANGED
|
@@ -717,7 +717,7 @@ JSON 输出包含 `defaultBranch` 和 `worktrees`;每个 worktree 的 `issues`
|
|
|
717
717
|
|
|
718
718
|
## 会话之间的群聊
|
|
719
719
|
|
|
720
|
-
在同一个仓库里干活的各个会话——Claude Code 会话、Codex 会话、无人值守的执行器,还有你——用 `keel chat` 共享一个工作群。群有维护中的成员名单,一条消息可以 `@` 某个角色或 `@all`,轻量待办可以关联 issue。一条记录可以取代同一作者之前的记录(`--supersedes <id>`),被取代的那条随即从所有人的未读里消失;未读按新到旧排列。用 `--ack` 发出的记录会请它所指向的角色确认,方式是 `keel chat ack <id>` 或回复;`keel chat show <id>` 和 `keel chat acks` 会列出谁已确认、谁只读过、谁还没读。`keel chat summary --since <time>` 汇总你能读的群里发生了什么变化——按发送者列出消息数、开出的待办及其是否仍未关闭、已关闭的待办、并入后继记录的被取代记录,以及仍在等待的确认——不用模型,也不把任何东西标为已读。每个成员有各自的未读状态,历史全部保留。用 `keel chat group add <group> <role> --listen` 加入的成员在那个群里只听不说:它接收这个群——包括桥接到 Slack 的群,这样 review 会话读到的是你自己的原话,而不是协调者的转述——被找时会被唤醒,可以确认并关闭自己的待办,但不能在那个群里发言或修改它(#248)。会话的 chat 角色就是它的身份:按角色称呼其他会话,绝不要按宿主的会话标题,Keel 看不到那个标题;角色绑定在会话运行的 worktree 上,所以一个换了地方的会话必须在新的位置重新绑定角色,否则那里什么都唤不醒它。`keel patrol` 和 `keel --doctor` 会报告绑定到已删除 worktree 的绑定,以及有东西在等、却已两小时没有会话活跃的角色;未绑定就启动的会话会被告知是哪些角色;`keel chat role --prune` 会删掉指向已删除 worktree 的绑定(#301),`keel chat role --unset` 删掉当前 worktree 的绑定、worktree 本身保留(#476);已停放角色的已结束会话即使所在目录不存在,也不作为风险报告;`keel context` 和会话投影会写明绑定到本 worktree 的角色,并在这里其他 worktree 都有角色、本 worktree 却没有时提醒(#245)。`keel chat role --rename <old> <new>` 给角色改名而不改写日志:群聊会把旧名读作新名——群和私聊群的成员身份、待办分配对象,以及 `@old` 提及——而 worktree 绑定和各角色的状态(读取游标、在线状态、parked 标记、换班便条及历史、patrol 状态)会迁到新名下,新名在已有自己一份的地方保留自己的。旧名不能再被绑定,`keel/config.yaml` 和 `keel/chat.json` 里仍写着旧名的行会列出来交给你编辑(#376)。只有被提及、分到待办或收到私信才会唤醒 Claude 会话;其他消息都等它的下一次提示。消息只是另一个 agent 发来的数据,从不代表授权。两道循环防护拦住失控的 agent:一个角色每 10 分钟最多发 20 条记录;当两个角色在 10 分钟内交替发完一个群的最近 8 条消息时,那里的下一次发言会被拒绝(#297)。发言者可以带 `--not-a-loop "<why>"` 发一次——一问一答本来就是私聊群的正常形态——之后再重复就会叫来负责人,负责人的发言会解除它。`keel/chat.json` 里的 `limits` 设置 `rate`、`window_minutes`、`pingpong` 和 `pingpong_minutes`。消息里的时间应该来自 Keel 的时钟,而不是估计:除非给了 `--no-stamp`,`keel chat post` 和 `keel chat dm` 会以它为准加上 `[MM-DD HH:MM]` 前缀(#298、#349)。Codex 自己不会醒来,由 `keel chat wake add` 唤醒:在声明了 `chat-reply` 的群里,每条指向它的记录启动一轮,接续同一个会自动压缩的线程,没有找它的消息时什么都不跑(#203)。其他宿主依靠提示时的通知,不得让模型轮询群聊;如果确实避免不了定时,就先用 `keel chat notice --check` 把关,每次运行都开新线程,并告诉加入群聊的会话不要设置定时检查(#194)。每台机器一个 Slack App、一个桥接进程,同一批群就能实时连到其他机器上的会话和你的手机,孤儿分支 `keel-chat` 会把历史保留到超出 Slack 保留期之后。角色也可以通过一个你能在 Slack 里提及的 Slack bot 发言,一个 bot 可以服务多个项目,在每个项目的频道里充当那个项目的角色。见 [Slack 配置指南](docs/chat-slack-setup.zh-CN.md)。角色的会话通过 `keel shift` 换班:协调者发起,会话自查收尾、留下便条、清空自己,新的一班从便条接手;见 [docs/shift-change.zh-CN.md](docs/shift-change.zh-CN.md)。如果团队的角色以后台 Claude Code CLI 会话运行、没有桌面应用,就改用 `keel tick` 来唤醒、巡查和换班;见 [docs/cli-team.zh-CN.md](docs/cli-team.zh-CN.md)。5.83 的 `keel mail` 命令在私聊群上继续可用。
|
|
720
|
+
在同一个仓库里干活的各个会话——Claude Code 会话、Codex 会话、无人值守的执行器,还有你——用 `keel chat` 共享一个工作群。群有维护中的成员名单,一条消息可以 `@` 某个角色或 `@all`,轻量待办可以关联 issue。一条记录可以取代同一作者之前的记录(`--supersedes <id>`),被取代的那条随即从所有人的未读里消失;未读按新到旧排列。用 `--ack` 发出的记录会请它所指向的角色确认,方式是 `keel chat ack <id>` 或回复;`keel chat show <id>` 和 `keel chat acks` 会列出谁已确认、谁只读过、谁还没读。`keel chat summary --since <time>` 汇总你能读的群里发生了什么变化——按发送者列出消息数、开出的待办及其是否仍未关闭、已关闭的待办、并入后继记录的被取代记录,以及仍在等待的确认——不用模型,也不把任何东西标为已读。每个成员有各自的未读状态,历史全部保留。用 `keel chat group add <group> <role> --listen` 加入的成员在那个群里只听不说:它接收这个群——包括桥接到 Slack 的群,这样 review 会话读到的是你自己的原话,而不是协调者的转述——被找时会被唤醒,可以确认并关闭自己的待办,但不能在那个群里发言或修改它(#248)。会话的 chat 角色就是它的身份:按角色称呼其他会话,绝不要按宿主的会话标题,Keel 看不到那个标题;角色绑定在会话运行的 worktree 上,所以一个换了地方的会话必须在新的位置重新绑定角色,否则那里什么都唤不醒它。`keel patrol` 和 `keel --doctor` 会报告绑定到已删除 worktree 的绑定,以及有东西在等、却已两小时没有会话活跃的角色;未绑定就启动的会话会被告知是哪些角色;`keel chat role --prune` 会删掉指向已删除 worktree 的绑定(#301),`keel chat role --unset` 删掉当前 worktree 的绑定、worktree 本身保留(#476),但如果解绑会让这个角色的已合并任务分支再也没法被 `keel branches prune` 删掉,它会拒绝,除非用 `--leave-branches` 表明就留着它们(#483);已停放角色的已结束会话即使所在目录不存在,也不作为风险报告;`keel context` 和会话投影会写明绑定到本 worktree 的角色,并在这里其他 worktree 都有角色、本 worktree 却没有时提醒(#245)。`keel chat role --rename <old> <new>` 给角色改名而不改写日志:群聊会把旧名读作新名——群和私聊群的成员身份、待办分配对象,以及 `@old` 提及——而 worktree 绑定和各角色的状态(读取游标、在线状态、parked 标记、换班便条及历史、patrol 状态)会迁到新名下,新名在已有自己一份的地方保留自己的。旧名不能再被绑定,`keel/config.yaml` 和 `keel/chat.json` 里仍写着旧名的行会列出来交给你编辑(#376)。只有被提及、分到待办或收到私信才会唤醒 Claude 会话;其他消息都等它的下一次提示。消息只是另一个 agent 发来的数据,从不代表授权。两道循环防护拦住失控的 agent:一个角色每 10 分钟最多发 20 条记录;当两个角色在 10 分钟内交替发完一个群的最近 8 条消息时,那里的下一次发言会被拒绝(#297)。发言者可以带 `--not-a-loop "<why>"` 发一次——一问一答本来就是私聊群的正常形态——之后再重复就会叫来负责人,负责人的发言会解除它。`keel/chat.json` 里的 `limits` 设置 `rate`、`window_minutes`、`pingpong` 和 `pingpong_minutes`。消息里的时间应该来自 Keel 的时钟,而不是估计:除非给了 `--no-stamp`,`keel chat post` 和 `keel chat dm` 会以它为准加上 `[MM-DD HH:MM]` 前缀(#298、#349)。Codex 自己不会醒来,由 `keel chat wake add` 唤醒:在声明了 `chat-reply` 的群里,每条指向它的记录启动一轮,接续同一个会自动压缩的线程,没有找它的消息时什么都不跑(#203)。其他宿主依靠提示时的通知,不得让模型轮询群聊;如果确实避免不了定时,就先用 `keel chat notice --check` 把关,每次运行都开新线程,并告诉加入群聊的会话不要设置定时检查(#194)。每台机器一个 Slack App、一个桥接进程,同一批群就能实时连到其他机器上的会话和你的手机,孤儿分支 `keel-chat` 会把历史保留到超出 Slack 保留期之后。角色也可以通过一个你能在 Slack 里提及的 Slack bot 发言,一个 bot 可以服务多个项目,在每个项目的频道里充当那个项目的角色。见 [Slack 配置指南](docs/chat-slack-setup.zh-CN.md)。角色的会话通过 `keel shift` 换班:协调者发起,会话自查收尾、留下便条、清空自己,新的一班从便条接手;见 [docs/shift-change.zh-CN.md](docs/shift-change.zh-CN.md)。如果团队的角色以后台 Claude Code CLI 会话运行、没有桌面应用,就改用 `keel tick` 来唤醒、巡查和换班;见 [docs/cli-team.zh-CN.md](docs/cli-team.zh-CN.md)。5.83 的 `keel mail` 命令在私聊群上继续可用。
|
|
721
721
|
|
|
722
722
|
## 协调者巡查
|
|
723
723
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.209.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.209.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.209.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.209.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -670,6 +670,51 @@ def validate_chat_role_park_and_unset_scenario() -> int:
|
|
|
670
670
|
return 0
|
|
671
671
|
|
|
672
672
|
|
|
673
|
+
def validate_chat_role_unset_keeps_branches_reachable_scenario() -> int:
|
|
674
|
+
"""Issue #483: an unset that would strand merged branches is refused unless told to leave them.
|
|
675
|
+
|
|
676
|
+
`keel branches` finds a role's branches through the reflog of a worktree
|
|
677
|
+
bound to it, so unbinding the only such worktree leaves its merged branches
|
|
678
|
+
where no prune can reach them. verify's worktree alone checked out `done-a`.
|
|
679
|
+
"""
|
|
680
|
+
from validation.shift import branches_scratch
|
|
681
|
+
|
|
682
|
+
label = "chat-role-unset-keeps-branches-reachable:"
|
|
683
|
+
with tempfile.TemporaryDirectory(prefix="keel-unset-483-") as raw:
|
|
684
|
+
_rtl, verify, env, _remote = branches_scratch(Path(raw))
|
|
685
|
+
refused = run_keel(verify, "chat", "role", "--unset", env=env)
|
|
686
|
+
if refused.returncode != 2:
|
|
687
|
+
report(f"{label} keel chat role --unset exited {refused.returncode}, not 2, with merged branches only verify's worktree reaches: {refused.stdout!r} {refused.stderr!r}")
|
|
688
|
+
return 1
|
|
689
|
+
for needle in ("done-a", "keel branches prune", "--leave-branches"):
|
|
690
|
+
if needle not in refused.stderr:
|
|
691
|
+
report(f"{label} the refusal does not name {needle}: {refused.stderr!r}")
|
|
692
|
+
return 1
|
|
693
|
+
still = run_keel(verify, "chat", "role", env=env)
|
|
694
|
+
if "has no chat role" in still.stdout:
|
|
695
|
+
report(f"{label} the refused --unset removed verify's binding: {still.stdout!r}")
|
|
696
|
+
return 1
|
|
697
|
+
if "verify" not in still.stdout:
|
|
698
|
+
report(f"{label} keel chat role after the refusal does not name verify: {still.stdout!r}")
|
|
699
|
+
return 1
|
|
700
|
+
left = run_keel(verify, "chat", "role", "--unset", "--leave-branches", env=env)
|
|
701
|
+
if left.returncode != 0:
|
|
702
|
+
report(f"{label} keel chat role --unset --leave-branches exited {left.returncode}: {left.stderr!r}")
|
|
703
|
+
return 1
|
|
704
|
+
if "Unbound verify" not in left.stdout:
|
|
705
|
+
report(f"{label} --leave-branches does not say it unbound verify: {left.stdout!r}")
|
|
706
|
+
return 1
|
|
707
|
+
if "done-a" not in left.stdout:
|
|
708
|
+
report(f"{label} --leave-branches does not name the branch it left, done-a: {left.stdout!r}")
|
|
709
|
+
return 1
|
|
710
|
+
after = run_keel(verify, "chat", "role", env=env)
|
|
711
|
+
if "has no chat role" not in after.stdout:
|
|
712
|
+
report(f"{label} verify's worktree still has a chat role after --leave-branches: {after.stdout!r}")
|
|
713
|
+
return 1
|
|
714
|
+
report("chat-role-unset-keeps-branches-reachable scenario passed.")
|
|
715
|
+
return 0
|
|
716
|
+
|
|
717
|
+
|
|
673
718
|
def validate_chat_wake_now_cli_scenario() -> int:
|
|
674
719
|
"""Issue #348 on the CLI (owner's CLI waker, 2026-10-19): one step wakes a role.
|
|
675
720
|
|
|
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
|
|
|
35
35
|
os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
PACKAGE_VERSION = "5.
|
|
38
|
+
PACKAGE_VERSION = "5.209.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.209.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -10537,6 +10537,79 @@ def problem_codes(payload: dict) -> list[str]:
|
|
|
10537
10537
|
# passed, one where the fixture contained no wording the checker would refuse.
|
|
10538
10538
|
# The declaration is what a gate can hold: written into the check, so it is in
|
|
10539
10539
|
# the fingerprint, and therefore written before the run rather than after it.
|
|
10540
|
+
def validate_declared_literal_whitespace_scenario() -> int:
|
|
10541
|
+
"""Issue #479 D1, D2: declared literals match recorded Evidence with whitespace runs as one space.
|
|
10542
|
+
|
|
10543
|
+
Tool output aligns with runs of spaces; a literal copied from it must
|
|
10544
|
+
match the raw output it was copied from, while different characters are
|
|
10545
|
+
still refused and the refusal rules spacing out.
|
|
10546
|
+
"""
|
|
10547
|
+
label = "declared-literal-whitespace"
|
|
10548
|
+
with tempfile.TemporaryDirectory(prefix="keel-literal-479-") as raw:
|
|
10549
|
+
repo = Path(raw) / "repo"
|
|
10550
|
+
|
|
10551
|
+
def complete(check: str, evidence: list[str]) -> dict:
|
|
10552
|
+
task = "\n".join([
|
|
10553
|
+
"- [x] 1.1 Literal probe",
|
|
10554
|
+
" - Owner: claude",
|
|
10555
|
+
" - Mode: implementation",
|
|
10556
|
+
" - Covers:",
|
|
10557
|
+
" - E1: the task proves its own behavior",
|
|
10558
|
+
" - Read:",
|
|
10559
|
+
" - README.md",
|
|
10560
|
+
" - Touch:",
|
|
10561
|
+
" - src/example.js",
|
|
10562
|
+
" - Verify:",
|
|
10563
|
+
" - Strategy: vertical-tdd",
|
|
10564
|
+
f" - M1: node test.js asserts the public behavior. {check}",
|
|
10565
|
+
" - Evidence:",
|
|
10566
|
+
*evidence,
|
|
10567
|
+
" - Review:",
|
|
10568
|
+
" - Status: pass",
|
|
10569
|
+
" - Acceptance check: the behavior is proven.",
|
|
10570
|
+
" - Scope check: only Touch changed.",
|
|
10571
|
+
" - Findings: none.",
|
|
10572
|
+
" - Blocker: none",
|
|
10573
|
+
" - Reauthorizations: none",
|
|
10574
|
+
])
|
|
10575
|
+
write_gate_fixture(repo, tasks=task)
|
|
10576
|
+
started = run_keel(repo, "gate", "task-start", "--change", "demo", "--task", "1.1", "--record", "--json")
|
|
10577
|
+
try:
|
|
10578
|
+
json.loads(started.stdout)
|
|
10579
|
+
except json.JSONDecodeError:
|
|
10580
|
+
return {"status": "unstarted", "problems": [{"message": started.stdout[:300]}]}
|
|
10581
|
+
done = run_keel(repo, "gate", "task-complete", "--change", "demo", "--task", "1.1", "--json")
|
|
10582
|
+
try:
|
|
10583
|
+
return json.loads(done.stdout)
|
|
10584
|
+
except json.JSONDecodeError:
|
|
10585
|
+
return {"status": "unparsed", "problems": [{"message": done.stdout[:400]}]}
|
|
10586
|
+
|
|
10587
|
+
cases = (
|
|
10588
|
+
("an aligned failure signature", "Fails with: `FAIL record reachable`",
|
|
10589
|
+
[" - M1: pass.", " - M1.red: fail. `FAIL record reachable` (exit 1).", " - M1.green: pass."]),
|
|
10590
|
+
("an aligned injection failure", "Fails with: `boom` Detects: `drop the guard` -> `FAIL guard missing`",
|
|
10591
|
+
[" - M1: pass.", " - M1.red: fail. `boom`.", " - M1.green: pass.",
|
|
10592
|
+
" - M1.detects: fail. `FAIL guard missing`."]),
|
|
10593
|
+
("a spaced measurement", "Fails with: `boom` Measured: `took 12 s`",
|
|
10594
|
+
[" - M1: pass. the run took 12 s.", " - M1.red: fail. `boom`.", " - M1.green: pass."]),
|
|
10595
|
+
)
|
|
10596
|
+
for name, check, evidence in cases:
|
|
10597
|
+
result = complete(check, evidence)
|
|
10598
|
+
if result.get("status") != "pass":
|
|
10599
|
+
report(f"{label}: {name} copied from the raw output was refused; {problem_codes(result)!r} {problem_text(result)!r}.")
|
|
10600
|
+
return 1
|
|
10601
|
+
wrong = complete("Fails with: `FAIL record reachable`",
|
|
10602
|
+
[" - M1: pass.", " - M1.red: fail. `FAIL record unreachable` (exit 1).", " - M1.green: pass."])
|
|
10603
|
+
if "red-missing-declared-failure" not in problem_codes(wrong):
|
|
10604
|
+
report(f"{label}: a red with different characters was not refused as red-missing-declared-failure; {problem_codes(wrong)!r}.")
|
|
10605
|
+
return 1
|
|
10606
|
+
if "as one space" not in problem_text(wrong):
|
|
10607
|
+
report(f"{label}: the refusal does not say runs of whitespace are compared as one space; {problem_text(wrong)!r}.")
|
|
10608
|
+
return 1
|
|
10609
|
+
report(f"{label} scenario passed.")
|
|
10610
|
+
return 0
|
|
10611
|
+
|
|
10612
|
+
|
|
10540
10613
|
def validate_red_declares_what_it_proves_scenario() -> int:
|
|
10541
10614
|
label = "a-red-declares-what-it-proves"
|
|
10542
10615
|
signature = "openspec: not found"
|
|
@@ -199,6 +199,7 @@ SCENARIOS: tuple = (
|
|
|
199
199
|
("output-survives-the-pipe", selfcheck.validate_output_survives_the_pipe_scenario),
|
|
200
200
|
("a-strategy-is-declared", contract.validate_strategy_is_declared_scenario),
|
|
201
201
|
("a-red-declares-what-it-proves", contract.validate_red_declares_what_it_proves_scenario),
|
|
202
|
+
("declared-literal-whitespace", contract.validate_declared_literal_whitespace_scenario),
|
|
202
203
|
("the-weakest-strategy-states-its-reason", contract.validate_weakest_strategy_states_its_reason_scenario),
|
|
203
204
|
("a-quoted-marker-is-not-a-disposition", contract.validate_quoted_marker_is_not_a_disposition_scenario),
|
|
204
205
|
("drift-names-where-to-look", contract.validate_drift_names_where_to_look_scenario),
|
|
@@ -466,6 +467,7 @@ SCENARIOS: tuple = (
|
|
|
466
467
|
("chat-wake-moved-worktree", chat.validate_chat_wake_moved_worktree_scenario),
|
|
467
468
|
("patrol-standing-risk-once", chat.validate_patrol_standing_risk_once_scenario),
|
|
468
469
|
("chat-role-park-and-unset", chat.validate_chat_role_park_and_unset_scenario),
|
|
470
|
+
("chat-role-unset-keeps-branches-reachable", chat.validate_chat_role_unset_keeps_branches_reachable_scenario),
|
|
469
471
|
("chat-ack", chat.validate_chat_ack_scenario),
|
|
470
472
|
("chat-reply-addresses-author", chat.validate_chat_reply_addresses_author_scenario),
|
|
471
473
|
("coordinator-patrol", shift.validate_coordinator_patrol_scenario),
|
package/src/core/branches.js
CHANGED
|
@@ -86,12 +86,12 @@ function checkedOut(cwd) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Branches a worktree bound to the role has checked out, from its own HEAD
|
|
89
|
-
// reflog (D2 d, F1).
|
|
90
|
-
function owned(where, role) {
|
|
89
|
+
// reflog (D2 d, F1). `without` leaves one binding out, as an unset would (#483).
|
|
90
|
+
function owned(where, role, without = null) {
|
|
91
91
|
const roles = JSON.parse(fs.readFileSync(path.join(where.root, "roles.json"), "utf8"));
|
|
92
92
|
const names = new Set();
|
|
93
93
|
for (const [worktree, name] of Object.entries(roles)) {
|
|
94
|
-
if (name !== role || !fs.existsSync(worktree)) continue;
|
|
94
|
+
if (name !== role || worktree === without || !fs.existsSync(worktree)) continue;
|
|
95
95
|
const reflog = git(worktree, ["reflog", "show", "--format=%gs", "HEAD"]);
|
|
96
96
|
for (const line of reflog.out.split("\n")) {
|
|
97
97
|
const moved = line.match(/^checkout: moving from (\S+) to (\S+)$/);
|
|
@@ -115,13 +115,13 @@ function lastFetch(cwd) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// The role's qualifying branches on each side (D2).
|
|
118
|
-
function merged(where, role) {
|
|
118
|
+
function merged(where, role, { without = null } = {}) {
|
|
119
119
|
const cwd = where.worktree;
|
|
120
120
|
const declared = readBranchesDeclaration(cwd);
|
|
121
121
|
const { found, missing } = trunks(cwd, declared);
|
|
122
122
|
const trunkNames = new Set([...found.map((t) => t.name), ...missing]);
|
|
123
123
|
const busy = checkedOut(cwd);
|
|
124
|
-
const mine = owned(where, role);
|
|
124
|
+
const mine = owned(where, role, without);
|
|
125
125
|
const kept = declared.keep.map(globRegExp);
|
|
126
126
|
const containing = (sha) => found.find((trunk) => git(cwd, ["merge-base", "--is-ancestor", sha, trunk.ref]).ok);
|
|
127
127
|
const branches = [];
|
|
@@ -149,6 +149,17 @@ function merged(where, role) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// What unbinding `worktree` would leave unreachable: listed now, not without it (#483 D1).
|
|
153
|
+
function stranded(where, role, worktree) {
|
|
154
|
+
const key = (b) => `${b.side} ${b.branch}`;
|
|
155
|
+
const kept = new Set(merged(where, role, { without: worktree }).branches.map(key));
|
|
156
|
+
return merged(where, role).branches.filter((b) => !kept.has(key(b)));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function label(b) {
|
|
160
|
+
return `${b.side === "remote" ? `${REMOTE}/` : ""}${b.branch} ${b.sha.slice(0, 12)}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
function describe(result) {
|
|
153
164
|
const lines = [];
|
|
154
165
|
if (result.message) lines.push(result.message);
|
|
@@ -158,7 +169,7 @@ function describe(result) {
|
|
|
158
169
|
return lines.join("\n");
|
|
159
170
|
}
|
|
160
171
|
lines.push(`Merged task branches of ${result.role} (trunks: ${result.trunks.join(", ")}; refs as last fetched ${result.fetched || "never"}):`);
|
|
161
|
-
for (const b of result.branches) lines.push(`- ${b
|
|
172
|
+
for (const b of result.branches) lines.push(`- ${label(b)} (in ${b.trunk})`);
|
|
162
173
|
return lines.join("\n");
|
|
163
174
|
}
|
|
164
175
|
|
|
@@ -255,4 +266,4 @@ function runBranches(argv) {
|
|
|
255
266
|
}
|
|
256
267
|
}
|
|
257
268
|
|
|
258
|
-
module.exports = { BranchesError, readBranchesDeclaration, remoteDefault, merged, describe, prune, runBranches, globRegExp, REMOTE, USAGE };
|
|
269
|
+
module.exports = { BranchesError, readBranchesDeclaration, remoteDefault, merged, stranded, label, describe, prune, runBranches, globRegExp, REMOTE, USAGE };
|
package/src/core/chat/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ const { relativeAge } = require("./view");
|
|
|
15
15
|
const { ChatError } = store;
|
|
16
16
|
|
|
17
17
|
const USAGE = [
|
|
18
|
-
"keel chat role [--set <name>] [--alias <alias>] [--prune] [--unset] [--json] (--prune: drop bindings to removed worktrees; --unset: drop this worktree's)",
|
|
18
|
+
"keel chat role [--set <name>] [--alias <alias>] [--prune] [--unset [--leave-branches]] [--json] (--prune: drop bindings to removed worktrees; --unset: drop this worktree's, refused while it would strand merged branches unless --leave-branches)",
|
|
19
19
|
"keel chat role --park <role> [--reason <text>] | --unpark <role> (a role parked on purpose is not nudged or reported by the patrol)",
|
|
20
20
|
"keel chat role --rename <old> <new> [--json] (the chat reads <old> as <new>; bindings and per-role state move to <new>)",
|
|
21
21
|
"keel chat group create <group> [--member <role>]...",
|
|
@@ -82,10 +82,10 @@ const VALUED = {
|
|
|
82
82
|
"--compact-at": "compactAt",
|
|
83
83
|
};
|
|
84
84
|
const REPEATED = { "--member": "members" };
|
|
85
|
-
const SWITCHES = { "--json": "json", "--peek": "peek", "--all": "all", "--mine": "mine", "--follow": "follow", "--once": "once", "--mail": "mail", "--check": "check", "--ack": "ack", "--listen": "listen", "--closed": "closed", "--stamp": "stamp", "--no-stamp": "noStamp", "--help": "help", "-h": "help", "--prune": "prune", "--unset": "unset" };
|
|
85
|
+
const SWITCHES = { "--json": "json", "--peek": "peek", "--all": "all", "--mine": "mine", "--follow": "follow", "--once": "once", "--mail": "mail", "--check": "check", "--ack": "ack", "--listen": "listen", "--closed": "closed", "--stamp": "stamp", "--no-stamp": "noStamp", "--help": "help", "-h": "help", "--prune": "prune", "--unset": "unset", "--leave-branches": "leaveBranches" };
|
|
86
86
|
|
|
87
87
|
function parseChatArgs(argv) {
|
|
88
|
-
const options = { positionals: [], members: [], json: false, peek: false, all: false, mine: false, follow: false, once: false, mail: false, check: false, ack: false, listen: false, closed: false, stamp: false, noStamp: false, help: false, prune: false, unset: false };
|
|
88
|
+
const options = { positionals: [], members: [], json: false, peek: false, all: false, mine: false, follow: false, once: false, mail: false, check: false, ack: false, listen: false, closed: false, stamp: false, noStamp: false, help: false, prune: false, unset: false, leaveBranches: false };
|
|
89
89
|
for (const key of Object.values(VALUED)) options[key] = null;
|
|
90
90
|
for (let index = 0; index < argv.length; index += 1) {
|
|
91
91
|
const arg = argv[index];
|
|
@@ -369,16 +369,25 @@ function dispatch(where, options) {
|
|
|
369
369
|
else out(pruned.length ? pruned.map((entry) => `Pruned ${entry.role} from ${entry.worktree}.`).join("\n") : "No binding points at a removed worktree.");
|
|
370
370
|
return 0;
|
|
371
371
|
}
|
|
372
|
+
if (options.leaveBranches && !options.unset) throw new ChatError("--leave-branches goes with --unset.");
|
|
372
373
|
if (options.unset) {
|
|
373
374
|
// The calling worktree's binding, which `--prune` keeps while it exists (#476 D4).
|
|
374
375
|
const roles = store.readJsonFile(path.join(where.root, "roles.json"));
|
|
375
376
|
const unbound = roles[where.worktree] || null;
|
|
377
|
+
// Merged branches only this binding reaches, which no prune could delete after it (#483).
|
|
378
|
+
const branches = require("../branches");
|
|
379
|
+
const left = unbound ? branches.stranded(where, unbound, where.worktree) : [];
|
|
380
|
+
if (left.length && !options.leaveBranches) {
|
|
381
|
+
throw new ChatError(`Not unbound: ${unbound}'s merged task branches below are reachable only through this worktree, and once it is unbound \`keel branches prune\` can no longer delete them:\n${left.map((b) => `- ${branches.label(b)}`).join("\n")}\nRun \`keel branches prune\` here first, or pass --leave-branches to unbind and leave them.`);
|
|
382
|
+
}
|
|
376
383
|
if (unbound) {
|
|
377
384
|
delete roles[where.worktree];
|
|
378
385
|
store.writeRoles(where, roles);
|
|
379
386
|
}
|
|
380
|
-
|
|
381
|
-
|
|
387
|
+
const leftLines = left.map((b) => `\n- ${branches.label(b)}`).join("");
|
|
388
|
+
if (options.json) out(JSON.stringify({ unbound: unbound || null, worktree: where.worktree, left: left.map(({ side, branch, sha }) => ({ side, branch, sha })) }));
|
|
389
|
+
else if (!unbound) out("This worktree has no chat role.");
|
|
390
|
+
else out(`Unbound ${unbound} from ${where.worktree}.${left.length ? ` \`keel branches\` no longer lists these merged branches of ${unbound}:${leftLines}` : ""}`);
|
|
382
391
|
return 0;
|
|
383
392
|
}
|
|
384
393
|
if (options.rename !== null && options.rename !== undefined) {
|
package/src/core/gates.js
CHANGED
|
@@ -1444,7 +1444,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1444
1444
|
if (!entry.measured || !entry.label) continue;
|
|
1445
1445
|
const recorded = evidenceValue(task, entry.label);
|
|
1446
1446
|
if (!isConcrete(recorded)) continue;
|
|
1447
|
-
if (!
|
|
1447
|
+
if (!containsDeclared(recorded, entry.measured)) {
|
|
1448
1448
|
problems.push(
|
|
1449
1449
|
problem(
|
|
1450
1450
|
"measurement-missing-from-evidence",
|
|
@@ -1453,7 +1453,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1453
1453
|
+ "string. Paste the output the number came from, or correct the "
|
|
1454
1454
|
+ "declaration — which moves the contract fingerprint, because a "
|
|
1455
1455
|
+ "number reconciled to the output after the run is a transcription "
|
|
1456
|
-
+
|
|
1456
|
+
+ `of it.${WHITESPACE_NOTE}`,
|
|
1457
1457
|
)
|
|
1458
1458
|
);
|
|
1459
1459
|
}
|
|
@@ -1484,7 +1484,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1484
1484
|
);
|
|
1485
1485
|
continue;
|
|
1486
1486
|
}
|
|
1487
|
-
if (!
|
|
1487
|
+
if (!containsDeclared(recorded, entry.detects.failure)) {
|
|
1488
1488
|
problems.push(
|
|
1489
1489
|
problem(
|
|
1490
1490
|
"injection-missing-declared-failure",
|
|
@@ -1493,7 +1493,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1493
1493
|
+ `${entry.label}.detects Evidence does not contain that string. `
|
|
1494
1494
|
+ "Record what the mutation actually printed, or correct the "
|
|
1495
1495
|
+ "declaration — which moves the contract fingerprint, because an "
|
|
1496
|
-
+
|
|
1496
|
+
+ `injection edited after the run is a transcription of it.${WHITESPACE_NOTE}`,
|
|
1497
1497
|
)
|
|
1498
1498
|
);
|
|
1499
1499
|
}
|
|
@@ -1525,7 +1525,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1525
1525
|
if (exempt.has(label)) continue;
|
|
1526
1526
|
const expected = declaredFailure.get(label);
|
|
1527
1527
|
const recorded = evidenceValue(task, `${label}.red`);
|
|
1528
|
-
if (expected && isConcrete(recorded) && !
|
|
1528
|
+
if (expected && isConcrete(recorded) && !containsDeclared(recorded, expected)) {
|
|
1529
1529
|
problems.push(
|
|
1530
1530
|
problem(
|
|
1531
1531
|
"red-missing-declared-failure",
|
|
@@ -1534,7 +1534,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1534
1534
|
+ "string. Record the failure output the red actually printed, "
|
|
1535
1535
|
+ "or correct the declaration — which moves the contract "
|
|
1536
1536
|
+ "fingerprint, because a signature edited after the red was "
|
|
1537
|
-
+
|
|
1537
|
+
+ `observed is a transcription of it.${WHITESPACE_NOTE}`,
|
|
1538
1538
|
)
|
|
1539
1539
|
);
|
|
1540
1540
|
}
|
|
@@ -1860,6 +1860,16 @@ function changeEvidenceValue(content, tasks, label) {
|
|
|
1860
1860
|
return match ? match[1].trim() : "";
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
|
+
// A declared literal is compiled from whitespace-collapsed check text, so the
|
|
1864
|
+
// recorded Evidence is collapsed the same way before it is searched; nothing
|
|
1865
|
+
// else is folded (#479 D1).
|
|
1866
|
+
function containsDeclared(recorded, literal) {
|
|
1867
|
+
const collapse = (value) => String(value).replace(/\s+/g, " ");
|
|
1868
|
+
return collapse(recorded).includes(collapse(literal));
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
const WHITESPACE_NOTE = " Runs of whitespace are compared as one space, so spacing is not the cause.";
|
|
1872
|
+
|
|
1863
1873
|
// `change-close`-only: `## Change Verify`'s own shape, and completeness of
|
|
1864
1874
|
// `## Change Evidence` for every check it declares — whether or not any task
|
|
1865
1875
|
// actually defers to it, because a declared check still owes its own result.
|