@christang/keel 5.92.0 → 5.92.1

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/README.md CHANGED
@@ -660,8 +660,9 @@ keel agents brief codex --mode helper --dir . --out /tmp/brief.md --change <c> -
660
660
  ```
661
661
 
662
662
  `keel agents brief` compiles the same brief `keel project --event subagent-start` publishes, writes
663
- it to a file, and prints the command to run. **Keel launches nothing**; the session runs it, and
664
- re-runs every check before anything counts as evidence. It refuses:
663
+ it to a file, and prints the command to run, which writes the agent's exit status to a `.exit` file
664
+ beside its result. **Keel launches nothing**; the session runs it, and re-runs every check before
665
+ anything counts as evidence. It refuses:
665
666
 
666
667
  - an agent the project has not allowed — with no declaration, none is;
667
668
  - a Read or Touch path the project said must not leave;
package/README.zh-CN.md CHANGED
@@ -198,7 +198,7 @@ keel agents brief codex --mode helper --dir . --out /tmp/brief.md --change <c> -
198
198
  ```
199
199
 
200
200
  `keel agents brief` 编译的就是 `keel project --event subagent-start` 给出的那份任务说明,写成文件,
201
- 再打印要跑的命令。**Keel 不启动任何进程**:命令由会话自己跑,对方交回的结果要由会话复跑每个检查后才算证据。
201
+ 再打印要跑的命令;这条命令会把 agent 的退出码写进结果旁边的 `.exit` 文件。**Keel 不启动任何进程**:命令由会话自己跑,对方交回的结果要由会话复跑每个检查后才算证据。
202
202
  以下情况会被拒绝:
203
203
 
204
204
  - 项目没允许的 agent(没写声明就一个都不允许);
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.92.0 -->
1
+ <!-- keel:start version=5.92.1 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.92.0",
3
+ "version": "5.92.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.92.0",
9
+ "version": "5.92.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.92.0",
5
+ "version": "5.92.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.92.0",
3
+ "version": "5.92.1",
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.92.0",
3
+ "version": "5.92.1",
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",
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.92.0"
51
- PROTOCOL_VERSION = "5.92.0"
50
+ PACKAGE_VERSION = "5.92.1"
51
+ PROTOCOL_VERSION = "5.92.1"
52
52
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
53
53
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
54
54
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -35620,6 +35620,82 @@ def validate_external_agents_are_documented_scenario() -> int:
35620
35620
  return 0
35621
35621
 
35622
35622
 
35623
+ def validate_external_agent_exit_status_scenario() -> int:
35624
+ """The printed command records the agent's exit status (#221).
35625
+
35626
+ Of nine codex runs read in rtl_ppa_prj, one recorded its exit status; a run
35627
+ that finished with `exit=0` read as a failure because it left no result
35628
+ file. The status is the one signal that is not the agent's own report.
35629
+ """
35630
+ label = "external-agent-exit-status:"
35631
+ with tempfile.TemporaryDirectory(prefix="keel-agent-exit-") as raw:
35632
+ base = Path(raw).resolve()
35633
+ env, _calls = _external_agents_env(base)
35634
+ for name in ("codex", "dsh"):
35635
+ stub = base / "bin" / name
35636
+ stub.write_text("#!/bin/sh\ncat > /dev/null\nexit 3\n", encoding="utf-8")
35637
+ stub.chmod(0o755)
35638
+ (base / "home" / "agents.json").write_text(
35639
+ json.dumps({"agents": {"dsh": {"executable": str(base / "bin" / "dsh")}}}),
35640
+ encoding="utf-8")
35641
+ repo = base / "repo"
35642
+ repo.mkdir()
35643
+ write_gate_fixture(repo, external_agent_brief_task())
35644
+ write_text(repo / "src/feature.js", "// feature\n")
35645
+ write_authorize_config(repo, "external_agents:\n allow: [codex, dsh]\n")
35646
+ for command in (["init", "-q"], ["add", "-A"],
35647
+ ["-c", "user.email=k@example.com", "-c", "user.name=k",
35648
+ "commit", "-q", "-m", "fixture"]):
35649
+ subprocess.run(["git", *command], cwd=repo, check=True, capture_output=True)
35650
+ worktree = base / "agent-wt"
35651
+ subprocess.run(["git", "worktree", "add", "-q", "--detach", str(worktree)],
35652
+ cwd=repo, check=True, capture_output=True)
35653
+
35654
+ for name, directory in (("codex", repo), ("dsh", worktree)):
35655
+ prompt = base / f"{name}-brief.md"
35656
+ result = run_keel(repo, "agents", "brief", name, "--mode", "helper",
35657
+ "--dir", str(directory), "--out", str(prompt),
35658
+ "--change", "demo", "--task", "1.1", "--json", env=env)
35659
+ try:
35660
+ payload = json.loads(result.stdout)
35661
+ except json.JSONDecodeError:
35662
+ report(f"{label} {name} brief printed no JSON: {(result.stdout + result.stderr)[:400]}")
35663
+ return 1
35664
+ if payload.get("status") != "ready":
35665
+ report(f"{label} {name} brief was refused: {payload.get('reasons')}")
35666
+ return 1
35667
+ exit_file = payload.get("exit")
35668
+ if not exit_file:
35669
+ report(f"{label} the {name} brief names no exit file.")
35670
+ return 1
35671
+ text = run_keel(repo, "agents", "brief", name, "--mode", "helper",
35672
+ "--dir", str(directory), "--out", str(prompt),
35673
+ "--change", "demo", "--task", "1.1", env=env).stdout
35674
+ if exit_file not in text:
35675
+ report(f"{label} the {name} text output does not name the exit file {exit_file}.")
35676
+ return 1
35677
+ ran = subprocess.run(["sh", "-c", f"{payload['run']}\npwd"], cwd=base, env=env,
35678
+ capture_output=True, text=True)
35679
+ if not Path(exit_file).exists():
35680
+ report(f"{label} running the {name} command wrote no exit file: {ran.stderr[:300]}")
35681
+ return 1
35682
+ status = Path(exit_file).read_text(encoding="utf-8").strip()
35683
+ if status != "3":
35684
+ report(f"{label} the {name} exit file holds {status!r}, not the stub's 3.")
35685
+ return 1
35686
+ if ran.stdout.strip().splitlines()[-1:] != [str(base)]:
35687
+ report(f"{label} running the {name} command moved the shell to {ran.stdout.strip()!r}.")
35688
+ return 1
35689
+
35690
+ shown = run_keel(repo, "agents", "codex", env=env).stdout
35691
+ if not re.search(r"parallel[^\n]*quota", shown, re.I):
35692
+ report(f"{label} `keel agents codex` has no pitfall about parallel runs sharing one quota.")
35693
+ return 1
35694
+
35695
+ report("external-agent-exit-status scenario passed.")
35696
+ return 0
35697
+
35698
+
35623
35699
  SCENARIOS: tuple = (
35624
35700
  ("stateless-continuity", validate_stateless_continuity_scenario),
35625
35701
  ("core-gates", validate_core_gates_scenario),
@@ -36067,6 +36143,7 @@ SCENARIOS: tuple = (
36067
36143
  ("external-agent-catalog", validate_external_agent_catalog_scenario),
36068
36144
  ("external-agent-brief", validate_external_agent_brief_scenario),
36069
36145
  ("external-agents-are-documented", validate_external_agents_are_documented_scenario),
36146
+ ("external-agent-exit-status", validate_external_agent_exit_status_scenario),
36070
36147
  ("validation-runner", validate_validation_runner_scenario),
36071
36148
  ("section-boundary", validate_section_boundary_scenario),
36072
36149
  ("review-entry-extent", validate_review_entry_extent_scenario),
@@ -47,6 +47,11 @@ const BUNDLED = {
47
47
  source: RTL_TOOLCHAIN,
48
48
  text: "It has a usage quota. When the quota is hit it names the time it can retry.",
49
49
  },
50
+ {
51
+ date: "2026-10-04",
52
+ source: "https://github.com/TanglmChris/keel/issues/221",
53
+ text: "Parallel runs under one account share one quota. Four runs started together and three stopped on the usage limit within five minutes, leaving half-done work in their worktrees.",
54
+ },
50
55
  {
51
56
  date: "2026-10-02",
52
57
  source: "https://github.com/TanglmChris/keel/issues/194",
@@ -70,6 +75,11 @@ const BUNDLED = {
70
75
  source: "dsh --version, 0.2.0-rc.2",
71
76
  text: "The CLI lives inside the app bundle and is not on PATH.",
72
77
  },
78
+ {
79
+ date: "2026-10-05",
80
+ source: "dsh --profile headless, 0.2.0-rc.2",
81
+ text: "The headless profile fails with MISSING_CREDENTIAL until a DeepSeek API key is stored through the app's Models page or DEEPSEEK_API_KEY is exported where it is launched.",
82
+ },
73
83
  {
74
84
  date: "2026-10-04",
75
85
  source: "dsh headless --help, 0.2.0-rc.2",
@@ -478,13 +488,18 @@ function compileBrief(repo, options) {
478
488
  fs.writeFileSync(out, renderBrief({
479
489
  agent: entry, mode: options.mode, dir, projection, source: projected.source, result,
480
490
  }));
481
- const run = fillCommand(entry.command, {
491
+ // A subshell, so a `cd` in a template does not move the caller, and the exit
492
+ // status beside the result, because it is the one account of how the run
493
+ // ended that is not the agent's own report (#221).
494
+ const exit = `${result.replace(/\.md$/, "")}.exit`;
495
+ const filled = fillCommand(entry.command, {
482
496
  executable: resolveExecutable(entry.executable) || entry.executable,
483
497
  sandbox: entry.sandbox[options.mode] || "",
484
498
  dir,
485
499
  prompt: out,
486
500
  out: result,
487
501
  });
502
+ const run = `( ${filled} ); echo $? > ${shellQuote(exit)}`;
488
503
  return {
489
504
  schemaVersion: 1,
490
505
  command: "agents brief",
@@ -493,6 +508,7 @@ function compileBrief(repo, options) {
493
508
  mode: options.mode,
494
509
  prompt: out,
495
510
  result,
511
+ exit,
496
512
  run,
497
513
  source: projected.source,
498
514
  reasons: [],
@@ -528,7 +544,7 @@ function runBrief(argv) {
528
544
  if (json) process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
529
545
  else if (payload.status === "ready") {
530
546
  process.stdout.write(
531
- `Brief: ${payload.prompt}\nRun: ${payload.run}\n`
547
+ `Brief: ${payload.prompt}\nRun: ${payload.run}\nExit status: written to ${payload.exit}\n`
532
548
  + payload.warnings.map((item) => `Warning: ${item}\n`).join("")
533
549
  );
534
550
  } else {