@christang/keel 5.205.0 → 5.206.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 +4 -2
- package/README.zh-CN.md +3 -2
- 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 +83 -0
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/registry.py +2 -0
- package/src/core/chat/cli.js +15 -3
- package/src/core/chat/notice.js +2 -1
- package/src/core/patrol.js +17 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.206.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); `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); 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
|
|
|
@@ -893,7 +893,9 @@ writes that snapshot on every run, and exits 3 when something changed and 2 only
|
|
|
893
893
|
coordinator gets one direct message from `keel-patrol`, which wakes its session, carrying only risks
|
|
894
894
|
(#307): the shared checkout gaining uncommitted paths after a clean run, free disk the host reports with
|
|
895
895
|
`--disk-free-gb` dropping below `--disk-min-gb` (default 20), and a role that left two nudges in a row
|
|
896
|
-
unanswered.
|
|
896
|
+
unanswered. A failed or stuck CLI hand-off and an ended session whose directory is gone are sent
|
|
897
|
+
once, on the run they appear or change, and are then printed as `risk (sent before)` while they last
|
|
898
|
+
(#476). Shift-status changes and new commits are printed, not sent. Every run appends one line to
|
|
897
899
|
`patrol/log/<role>.log` in the chat store, so a silent run can still be audited.
|
|
898
900
|
The host can also pass the weekly quota's percent used with `--quota <percent>`: each threshold in
|
|
899
901
|
`--quota-alerts` (default `90,95,99`) becomes a risk once per quota period, a drop in the figure starts
|
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
|
|
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` 命令在私聊群上继续可用。
|
|
721
721
|
|
|
722
722
|
## 协调者巡查
|
|
723
723
|
|
|
@@ -742,7 +742,8 @@ keel patrol --issues /tmp/issues.json # 以协调者的角色运行
|
|
|
742
742
|
内容打印 `changed:` 行;第一次运行记录基线。它每次运行都写入快照,有变化时以 3 退出,只有风险变化时才以 2 退出。
|
|
743
743
|
加上 `--notify`,协调者会收到一条来自 `keel-patrol` 的私信,唤醒它的会话,内容只包含风险(#307):共享 checkout
|
|
744
744
|
在一次干净的运行之后出现了未提交路径、宿主用 `--disk-free-gb` 报告的剩余磁盘降到 `--disk-min-gb`(默认 20)
|
|
745
|
-
|
|
745
|
+
以下,以及一个角色连续两次催促都没有回应。失败或卡住的 CLI 交接、所在目录已不存在的已结束会话,只在出现或
|
|
746
|
+
变化的那次运行发送一次,之后只要还在,就打印为 `risk (sent before)`(#476)。换班状态变化和新 commit 只打印,不发送。每次运行都会往 chat 存储里的
|
|
746
747
|
`patrol/log/<role>.log` 追加一行,所以一次静默的运行也能审计。
|
|
747
748
|
宿主还可以用 `--quota <percent>` 传入每周配额的已用百分比:`--quota-alerts`(默认 `90,95,99`)里的每个阈值
|
|
748
749
|
在每个配额周期内成为一次风险,数字下降即开始新周期;达到 `--quota-quiet-at`(默认 90)或以上时,`--nudge`
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.206.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.206.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.206.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.206.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",
|
|
@@ -587,6 +587,89 @@ def validate_chat_wake_moved_worktree_scenario() -> int:
|
|
|
587
587
|
return 0
|
|
588
588
|
|
|
589
589
|
|
|
590
|
+
def moved_session_scratch(base: Path) -> tuple[Path, Path, dict]:
|
|
591
|
+
"""verify's ended CLI session, recorded in a directory that no longer exists (#465, #476)."""
|
|
592
|
+
rtl, verify, env, _ = shift_scratch(base)
|
|
593
|
+
gone = str(base / "renamed-away" / "verify")
|
|
594
|
+
fake = base / "fake-claude"
|
|
595
|
+
write_text(fake, "#!/usr/bin/env python3\nimport json, sys\n"
|
|
596
|
+
"if sys.argv[1:3] == ['agents', '--json']:\n"
|
|
597
|
+
f" print(json.dumps([{{'kind': 'background', 'sessionId': 'sess-verify-1', 'id': 'sess-ver', 'cwd': {gone!r}}}]))\n")
|
|
598
|
+
fake.chmod(0o755)
|
|
599
|
+
env = {**env, "KEEL_CLAUDE": str(fake)}
|
|
600
|
+
dead = subprocess.Popen(["true"])
|
|
601
|
+
dead.wait()
|
|
602
|
+
chat_session_start(verify, env, "sess-verify-1", dead.pid)
|
|
603
|
+
presence_file = mailbox_common_dir(rtl) / "keel-chat" / "presence" / "verify.json"
|
|
604
|
+
presence = json.loads(presence_file.read_text(encoding="utf-8"))
|
|
605
|
+
presence["cli_worktree"] = gone
|
|
606
|
+
presence_file.write_text(json.dumps(presence), encoding="utf-8")
|
|
607
|
+
return rtl, verify, env
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def validate_patrol_standing_risk_once_scenario() -> int:
|
|
611
|
+
"""Issue #476 D1, D2: an unchanged moved-session risk reaches the coordinator once.
|
|
612
|
+
|
|
613
|
+
Under `--since-last --notify` the risk is sent on the run it first
|
|
614
|
+
appears and printed as sent before afterwards; a plain patrol still
|
|
615
|
+
reports it.
|
|
616
|
+
"""
|
|
617
|
+
label = "patrol-standing-risk-once:"
|
|
618
|
+
with tempfile.TemporaryDirectory(prefix="keel-patrol-476-") as raw:
|
|
619
|
+
rtl, _verify, env = moved_session_scratch(Path(raw))
|
|
620
|
+
runs = [run_keel(rtl, "patrol", "--since-last", "--notify", env=env) for _ in range(3)]
|
|
621
|
+
sent = chat_records_with(rtl, "dm-keel-patrol--rtl", "no longer exists")
|
|
622
|
+
if len(sent) != 1:
|
|
623
|
+
report(f"{label} three --since-last --notify runs sent the moved-session risk {len(sent)} times, not once: {[r.stdout for r in runs]!r}")
|
|
624
|
+
return 1
|
|
625
|
+
for index, run in enumerate(runs[1:], start=2):
|
|
626
|
+
if run.returncode == 2:
|
|
627
|
+
report(f"{label} run {index} exited 2, a risk to act on, for a risk already sent: {run.stdout!r}")
|
|
628
|
+
return 1
|
|
629
|
+
if not any("sent before" in line and "verify" in line for line in run.stdout.splitlines()):
|
|
630
|
+
report(f"{label} run {index} does not print the persisting risk as sent before: {run.stdout!r}")
|
|
631
|
+
return 1
|
|
632
|
+
plain = run_keel(rtl, "patrol", env=env)
|
|
633
|
+
if not any(line.startswith("risk:") and "verify" in line for line in plain.stdout.splitlines()):
|
|
634
|
+
report(f"{label} a plain patrol no longer reports the risk: {plain.stdout!r}")
|
|
635
|
+
return 1
|
|
636
|
+
report("patrol-standing-risk-once scenario passed.")
|
|
637
|
+
return 0
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def validate_chat_role_park_and_unset_scenario() -> int:
|
|
641
|
+
"""Issue #476 D3, D4: a parked role's gone session is not reported, and a binding can be removed.
|
|
642
|
+
|
|
643
|
+
Parking verify quiets the moved-session risk in `keel patrol`;
|
|
644
|
+
`keel chat role --unset` in verify's worktree unbinds it there.
|
|
645
|
+
"""
|
|
646
|
+
label = "chat-role-park-and-unset:"
|
|
647
|
+
with tempfile.TemporaryDirectory(prefix="keel-park-476-") as raw:
|
|
648
|
+
rtl, verify, env = moved_session_scratch(Path(raw))
|
|
649
|
+
before = run_keel(rtl, "patrol", env=env)
|
|
650
|
+
if not any("verify" in line and "no longer exists" in line for line in before.stdout.splitlines()):
|
|
651
|
+
report(f"{label} the fixture raises no moved-session risk for verify before the park: {before.stdout!r}")
|
|
652
|
+
return 1
|
|
653
|
+
run_keel(rtl, "chat", "role", "--park", "verify", "--reason", "retired", env=env)
|
|
654
|
+
parked = run_keel(rtl, "patrol", env=env)
|
|
655
|
+
if any("verify" in line and "no longer exists" in line for line in parked.stdout.splitlines()):
|
|
656
|
+
report(f"{label} the patrol still reports parked verify's gone session: {parked.stdout!r}")
|
|
657
|
+
return 1
|
|
658
|
+
unset = run_keel(verify, "chat", "role", "--unset", env=env)
|
|
659
|
+
if unset.returncode != 0:
|
|
660
|
+
report(f"{label} keel chat role --unset exited {unset.returncode}: {unset.stderr!r}")
|
|
661
|
+
return 1
|
|
662
|
+
if "Unbound verify" not in unset.stdout:
|
|
663
|
+
report(f"{label} keel chat role --unset does not say it unbound verify: {unset.stdout!r}")
|
|
664
|
+
return 1
|
|
665
|
+
after = run_keel(verify, "chat", "role", env=env)
|
|
666
|
+
if "has no chat role" not in after.stdout:
|
|
667
|
+
report(f"{label} verify's worktree still has a chat role after --unset: {after.stdout!r}")
|
|
668
|
+
return 1
|
|
669
|
+
report("chat-role-park-and-unset scenario passed.")
|
|
670
|
+
return 0
|
|
671
|
+
|
|
672
|
+
|
|
590
673
|
def validate_chat_wake_now_cli_scenario() -> int:
|
|
591
674
|
"""Issue #348 on the CLI (owner's CLI waker, 2026-10-19): one step wakes a role.
|
|
592
675
|
|
|
@@ -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.206.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.206.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -464,6 +464,8 @@ SCENARIOS: tuple = (
|
|
|
464
464
|
("chat-role-set-records-session", chat.validate_chat_role_set_records_session_scenario),
|
|
465
465
|
("chat-wake-skips-removed-session", chat.validate_chat_wake_skips_removed_session_scenario),
|
|
466
466
|
("chat-wake-moved-worktree", chat.validate_chat_wake_moved_worktree_scenario),
|
|
467
|
+
("patrol-standing-risk-once", chat.validate_patrol_standing_risk_once_scenario),
|
|
468
|
+
("chat-role-park-and-unset", chat.validate_chat_role_park_and_unset_scenario),
|
|
467
469
|
("chat-ack", chat.validate_chat_ack_scenario),
|
|
468
470
|
("chat-reply-addresses-author", chat.validate_chat_reply_addresses_author_scenario),
|
|
469
471
|
("coordinator-patrol", shift.validate_coordinator_patrol_scenario),
|
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] [--json] (--prune: drop bindings to removed worktrees)",
|
|
18
|
+
"keel chat role [--set <name>] [--alias <alias>] [--prune] [--unset] [--json] (--prune: drop bindings to removed worktrees; --unset: drop this worktree's)",
|
|
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>]...",
|
|
@@ -81,10 +81,10 @@ const VALUED = {
|
|
|
81
81
|
"--compact-at": "compactAt",
|
|
82
82
|
};
|
|
83
83
|
const REPEATED = { "--member": "members" };
|
|
84
|
-
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" };
|
|
84
|
+
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
85
|
|
|
86
86
|
function parseChatArgs(argv) {
|
|
87
|
-
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 };
|
|
87
|
+
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
88
|
for (const key of Object.values(VALUED)) options[key] = null;
|
|
89
89
|
for (let index = 0; index < argv.length; index += 1) {
|
|
90
90
|
const arg = argv[index];
|
|
@@ -368,6 +368,18 @@ function dispatch(where, options) {
|
|
|
368
368
|
else out(pruned.length ? pruned.map((entry) => `Pruned ${entry.role} from ${entry.worktree}.`).join("\n") : "No binding points at a removed worktree.");
|
|
369
369
|
return 0;
|
|
370
370
|
}
|
|
371
|
+
if (options.unset) {
|
|
372
|
+
// The calling worktree's binding, which `--prune` keeps while it exists (#476 D4).
|
|
373
|
+
const roles = store.readJsonFile(path.join(where.root, "roles.json"));
|
|
374
|
+
const unbound = roles[where.worktree] || null;
|
|
375
|
+
if (unbound) {
|
|
376
|
+
delete roles[where.worktree];
|
|
377
|
+
store.writeRoles(where, roles);
|
|
378
|
+
}
|
|
379
|
+
if (options.json) out(JSON.stringify({ unbound: unbound || null, worktree: where.worktree }));
|
|
380
|
+
else out(unbound ? `Unbound ${unbound} from ${where.worktree}.` : "This worktree has no chat role.");
|
|
381
|
+
return 0;
|
|
382
|
+
}
|
|
371
383
|
if (options.rename !== null && options.rename !== undefined) {
|
|
372
384
|
// `--rename <old> <new>` (#376 D7).
|
|
373
385
|
if (!rest[0]) throw new ChatError("keel chat role --rename needs the old and the new name: --rename <old> <new>.");
|
package/src/core/chat/notice.js
CHANGED
|
@@ -278,7 +278,8 @@ function resumeCli(entry, where = null) {
|
|
|
278
278
|
// exists (#465 D4). Presence only: the patrol asks the host nothing.
|
|
279
279
|
function movedSessionRisks(where, covers = () => true) {
|
|
280
280
|
const roles = [...new Set(Object.values(store.readJsonFile(path.join(where.root, "roles.json"))).filter(Boolean))].sort();
|
|
281
|
-
|
|
281
|
+
// A parked role is left alone on purpose (#476 D3).
|
|
282
|
+
return roles.filter(covers).filter((role) => !parkOf(where, role)).map((role) => asleep(where, role))
|
|
282
283
|
.filter((entry) => entry && entry.cli && entry.worktree && !fs.existsSync(entry.worktree))
|
|
283
284
|
.map((entry) => `${entry.role}'s CLI session ${entry.session} ran in ${entry.worktree}, which no longer exists, so it cannot be resumed; `
|
|
284
285
|
+ `\`keel chat wake now ${entry.role}\` prints the command that continues it in the role's worktree`);
|
package/src/core/patrol.js
CHANGED
|
@@ -214,8 +214,13 @@ function sinceLast(where, role, result, options) {
|
|
|
214
214
|
const file = snapshotFile(where, role);
|
|
215
215
|
const previous = fs.existsSync(file) ? store.readJsonFile(file) : null;
|
|
216
216
|
const now = currentSnapshot(where, role, result, options);
|
|
217
|
+
now.standing = result.standing || [];
|
|
217
218
|
store.writeJsonAtomic(where, file, now);
|
|
218
|
-
|
|
219
|
+
// A standing risk is a risk on the run its text first appears (#476 D1).
|
|
220
|
+
const sent = new Set((previous && previous.standing) || []);
|
|
221
|
+
const fresh = now.standing.filter((text) => !sent.has(text));
|
|
222
|
+
result.sentBefore = now.standing.filter((text) => sent.has(text));
|
|
223
|
+
if (!previous || !previous.entries) return { baseline: true, changes: [], risks: fresh };
|
|
219
224
|
const changes = [];
|
|
220
225
|
const keys = [...new Set([...Object.keys(previous.entries), ...Object.keys(now.entries)])].sort();
|
|
221
226
|
for (const key of keys) {
|
|
@@ -239,6 +244,7 @@ function sinceLast(where, role, result, options) {
|
|
|
239
244
|
if (now.entries.disk === "low" && previous.entries.disk !== "low") {
|
|
240
245
|
risks.push(`free disk is ${options.diskFreeGb} GB, below ${options.diskMinGb} GB`);
|
|
241
246
|
}
|
|
247
|
+
risks.push(...fresh);
|
|
242
248
|
return { baseline: false, changes, risks };
|
|
243
249
|
}
|
|
244
250
|
|
|
@@ -396,6 +402,7 @@ function render(result) {
|
|
|
396
402
|
for (const change of changes) lines.push(`changed: ${change}`);
|
|
397
403
|
for (const sent of result.nudges || []) lines.push(`nudged ${sent.role}: ${sent.kind}`);
|
|
398
404
|
for (const risk of result.risks || []) lines.push(`risk: ${risk}`);
|
|
405
|
+
for (const risk of result.sentBefore || []) lines.push(`risk (sent before): ${risk}`);
|
|
399
406
|
if (result.paused) lines.push(result.paused);
|
|
400
407
|
for (const held of result.held) lines.push(`met: ${held.from} waited for ${held.condition} (${held.id})`);
|
|
401
408
|
for (const sent of result.notices) lines.push(`notified ${sent.to}: ${sent.text}`);
|
|
@@ -557,10 +564,15 @@ function runPatrol(argv) {
|
|
|
557
564
|
result.risks = [];
|
|
558
565
|
const quota = options.coverage.repositoryWide ? quotaRisk(where, options) : null;
|
|
559
566
|
if (quota) result.risks.push(quota);
|
|
560
|
-
// A CLI hand-off that failed or hangs (#357 D4),
|
|
561
|
-
|
|
562
|
-
//
|
|
563
|
-
|
|
567
|
+
// A CLI hand-off that failed or hangs (#357 D4), and an ended CLI session
|
|
568
|
+
// whose worktree is gone (#465 D4), of the roles this patrol covers. They
|
|
569
|
+
// stand until resolved, so `--since-last` sends each once (#476 D1, D2).
|
|
570
|
+
const covered = (name) => name === role || options.coverage.covers(name);
|
|
571
|
+
result.standing = [
|
|
572
|
+
...require("./shift").handOffRisks(where, Date.now(), covered),
|
|
573
|
+
...require("./chat/notice").movedSessionRisks(where, covered),
|
|
574
|
+
];
|
|
575
|
+
if (!options.sinceLast) result.risks.push(...result.standing);
|
|
564
576
|
// Near the limit nudges stop, since each wakes a large session (D3).
|
|
565
577
|
const quiet = options.quota !== null && options.quota >= options.quotaQuietAt;
|
|
566
578
|
if (options.nudge && quiet) result.paused = `nudges paused: quota at ${options.quota}%`;
|