@christang/keel 5.143.0 → 5.144.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.143.0",
3
+ "version": "5.144.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,4 +1,4 @@
1
- <!-- keel:start version=5.143.0 -->
1
+ <!-- keel:start version=5.144.0 -->
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.
package/bin/keel.js CHANGED
@@ -1097,12 +1097,19 @@ function hostFails(executable, args) {
1097
1097
  return Boolean(result.error) || result.status !== 0;
1098
1098
  }
1099
1099
 
1100
+ // Why a host step failed: its spawn error, or its exit status with the last
1101
+ // line it wrote to stderr, so the cause is visible the first time (#359).
1102
+ function hostFailure(result) {
1103
+ if (result.error) return result.error.message;
1104
+ const last = String(result.stderr || "").trim().split(/\r?\n/).pop().trim();
1105
+ return `exited ${result.status}${last ? `: ${last}` : ""}`;
1106
+ }
1107
+
1100
1108
  function runHostSteps(component, name, executable, steps) {
1101
1109
  for (const args of steps) {
1102
1110
  const result = hostRun(executable, args);
1103
1111
  if (result.error || result.status !== 0) {
1104
- const why = result.error ? result.error.message : `exited ${result.status}`;
1105
- updateLine(component, "failed", `\`${name} ${args.join(" ")}\` ${why}`);
1112
+ updateLine(component, "failed", `\`${name} ${args.join(" ")}\` ${hostFailure(result)}`);
1106
1113
  return false;
1107
1114
  }
1108
1115
  }
@@ -1133,7 +1140,15 @@ function updateClaudePlugin(options) {
1133
1140
  updateLine(component, "absent", "Claude Code is not installed here or has no Keel plugin");
1134
1141
  return true;
1135
1142
  }
1136
- if (!runHostSteps(component, "claude", executable, steps)) return false;
1143
+ // The refresh fetches over the network, and on a proxied link it has failed
1144
+ // once and passed on a direct retry; one retry absorbs that, as for Codex (#359).
1145
+ let refreshed = hostRun(executable, steps[0]);
1146
+ if (refreshed.error || refreshed.status !== 0) refreshed = hostRun(executable, steps[0]);
1147
+ if (refreshed.error || refreshed.status !== 0) {
1148
+ updateLine(component, "failed", `\`claude ${steps[0].join(" ")}\` failed twice; ${hostFailure(refreshed)}`);
1149
+ return false;
1150
+ }
1151
+ if (!runHostSteps(component, "claude", executable, [steps[1]])) return false;
1137
1152
  const after = claudeKeel(executable);
1138
1153
  if (after && after.failed) {
1139
1154
  updateLine(component, "failed", `${after.failed} after the update, so its result is unverified`);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.143.0",
3
+ "version": "5.144.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.143.0",
9
+ "version": "5.144.0",
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.143.0",
5
+ "version": "5.144.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.143.0",
3
+ "version": "5.144.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.143.0",
3
+ "version": "5.144.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",
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
49
49
  "scripts/validate_plugin.py",
50
50
  ]
51
51
 
52
- PACKAGE_VERSION = "5.143.0"
53
- PROTOCOL_VERSION = "5.143.0"
52
+ PACKAGE_VERSION = "5.144.0"
53
+ PROTOCOL_VERSION = "5.144.0"
54
54
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
55
55
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
56
56
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -23771,6 +23771,7 @@ if (failOn && args.join(" ").includes(failOn)) {
23771
23771
  if (failed < failTimes) {
23772
23772
  state.failed = { ...(state.failed || {}), [host]: failed + 1 };
23773
23773
  save();
23774
+ process.stderr.write(`fake ${host}: warming up\nfake ${host}: refused ${args.join(" ")}\n`);
23774
23775
  process.exit(1);
23775
23776
  }
23776
23777
  }
@@ -24047,6 +24048,97 @@ def validate_update_host_query_timeout_scenario() -> int:
24047
24048
  return 0
24048
24049
 
24049
24050
 
24051
+ def validate_update_claude_refresh_retry_scenario() -> int:
24052
+ """Issue #359: the Claude marketplace refresh failed once and passed on a direct retry.
24053
+
24054
+ `keel --update` retries `claude plugin marketplace update` once, as it does
24055
+ Codex's refresh, and a step that still fails names the host's last stderr
24056
+ line instead of only its exit status.
24057
+ """
24058
+ label = "update-claude-refresh-retry:"
24059
+ refresh = ["claude", "plugin", "marketplace", "update", "keel-marketplace"]
24060
+ plugin_update = ["claude", "plugin", "update", "keel@keel-marketplace"]
24061
+ with tempfile.TemporaryDirectory(prefix="keel-update-359-", ignore_cleanup_errors=True) as raw:
24062
+ tmp = Path(raw)
24063
+ fake = tmp / "fake.js"
24064
+ write_text(fake, UPDATE_FAKE)
24065
+ launchers = {}
24066
+ for host in ("npm", "claude", "codex"):
24067
+ launcher = tmp / f"fake-{host}"
24068
+ write_text(launcher, f'#!/bin/sh\nFAKE_HOST={host} exec node "{fake}" "$@"\n')
24069
+ launcher.chmod(0o755)
24070
+ launchers[host] = launcher
24071
+
24072
+ def update(fail_on: str, times: str):
24073
+ log, state = tmp / "log.jsonl", tmp / "state.json"
24074
+ for stale in (log, state):
24075
+ if stale.exists():
24076
+ stale.unlink()
24077
+ log.write_text("")
24078
+ env = dict(os.environ)
24079
+ env.update({
24080
+ "KEEL_UPDATE_NPM": str(launchers["npm"]), "KEEL_UPDATE_CLAUDE": str(launchers["claude"]),
24081
+ "KEEL_UPDATE_CODEX": str(launchers["codex"]), "CODEX_HOME": str(tmp / "codex-home"),
24082
+ "FAKE_LOG": str(log), "FAKE_STATE": str(state), "FAKE_CODEX_SOURCE": str(tmp / "codex-source"),
24083
+ "FAKE_FAIL_CLAUDE": fail_on, "FAKE_FAIL_TIMES_CLAUDE": times,
24084
+ })
24085
+ env.pop("KEEL_UPDATE_SOURCE", None)
24086
+ result = subprocess.run(["node", str(ROOT / "bin/keel.js"), "--update"], cwd=tmp, env=env,
24087
+ text=True, capture_output=True, check=False, timeout=60)
24088
+ calls = [json.loads(line) for line in log.read_text().splitlines() if line.strip()]
24089
+ line = [l for l in result.stdout.splitlines() if l.startswith("keel update: claude plugin:")]
24090
+ return result, calls, (line[0] if len(line) == 1 else "")
24091
+
24092
+ result, calls, line = update("marketplace update", "1")
24093
+ runs = sum(1 for c in calls if c[:5] == refresh)
24094
+ if runs != 2:
24095
+ report(f"{label} the Claude marketplace update ran {runs} time(s) after one failure, not 2: {calls!r}")
24096
+ return 1
24097
+ if sum(1 for c in calls if c[:4] == plugin_update) != 1:
24098
+ report(f"{label} a refresh that succeeded on retry did not run plugin update once: {calls!r}")
24099
+ return 1
24100
+ if "5.0.0 -> 5.1.0" not in line:
24101
+ report(f"{label} a refresh that succeeded on retry did not report the new version: {line!r}")
24102
+ return 1
24103
+ if result.returncode != 0:
24104
+ report(f"{label} a refresh that succeeded on retry exited {result.returncode}: {result.stdout!r}")
24105
+ return 1
24106
+
24107
+ result, calls, line = update("marketplace update", "9")
24108
+ runs = sum(1 for c in calls if c[:5] == refresh)
24109
+ if runs != 2:
24110
+ report(f"{label} a lasting failure ran the marketplace update {runs} time(s), not 2: {calls!r}")
24111
+ return 1
24112
+ if any(c[:4] == plugin_update for c in calls):
24113
+ report(f"{label} a lasting refresh failure still ran plugin update: {calls!r}")
24114
+ return 1
24115
+ if result.returncode == 0:
24116
+ report(f"{label} a lasting refresh failure left the exit status 0: {result.stdout!r}")
24117
+ return 1
24118
+ for needle in ("failed", "failed twice", "fake claude: refused plugin marketplace update"):
24119
+ if needle not in line:
24120
+ report(f"{label} the failed Claude line does not name {needle!r}: {line!r}")
24121
+ return 1
24122
+ if "warming up" in line:
24123
+ report(f"{label} the failed Claude line carries more than the last stderr line: {line!r}")
24124
+ return 1
24125
+
24126
+ # A step with no retry still names the host's own error, not only its status.
24127
+ result, calls, line = update("plugin update keel", "9")
24128
+ if sum(1 for c in calls if c[:4] == plugin_update) != 1:
24129
+ report(f"{label} a failing plugin update was retried or skipped: {calls!r}")
24130
+ return 1
24131
+ for needle in ("failed", "exited 1", "fake claude: refused plugin update"):
24132
+ if needle not in line:
24133
+ report(f"{label} the failed plugin-update line does not name {needle!r}: {line!r}")
24134
+ return 1
24135
+ if "update-claude-refresh-retry" not in {name for name, _ in SCENARIOS}:
24136
+ report(f"{label} scenario is not registered.")
24137
+ return 1
24138
+ report("update-claude-refresh-retry scenario passed.")
24139
+ return 0
24140
+
24141
+
24050
24142
  def validate_update_codex_refresh_retry_scenario() -> int:
24051
24143
  """Issue #329: a slow link can cut Codex's whole-repository marketplace clone.
24052
24144
 
@@ -41335,6 +41427,7 @@ SCENARIOS: tuple = (
41335
41427
  ("adopted-update-is-silent-unless-reload", validate_adopted_update_is_silent_unless_reload_scenario),
41336
41428
  ("update-covers-installed-hosts", validate_update_covers_installed_hosts_scenario),
41337
41429
  ("update-codex-refresh-retry", validate_update_codex_refresh_retry_scenario),
41430
+ ("update-claude-refresh-retry", validate_update_claude_refresh_retry_scenario),
41338
41431
  ("update-host-query-timeout", validate_update_host_query_timeout_scenario),
41339
41432
  ("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
41340
41433
  ("directory-branch-advances", validate_directory_branch_advances_scenario),