@christang/keel 5.145.0 → 5.147.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.145.0",
3
+ "version": "5.147.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.145.0 -->
1
+ <!-- keel:start version=5.147.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
@@ -1015,17 +1015,22 @@ function hostRun(executable, args) {
1015
1015
 
1016
1016
  // A read-only `plugin list --json` normally answers in 1–3 s, and once hung
1017
1017
  // for minutes through a proxy (#354). It gets its own short limit, and a query
1018
- // that fails is reported as one, never as a host with no Keel.
1018
+ // that fails is reported as one, never as a host with no Keel. A query that
1019
+ // times out is retried once: on the owner's link the same query took 58 s
1020
+ // once and about 1 s on the next runs (#365).
1019
1021
  function hostQuery(executable, args) {
1020
1022
  const limit = Number(process.env.KEEL_UPDATE_QUERY_TIMEOUT_MS) || 30 * 1000;
1021
- const result = spawnSync(executable, args, {
1023
+ const run = () => spawnSync(executable, args, {
1022
1024
  encoding: "utf8",
1023
1025
  shell: process.platform === "win32",
1024
1026
  timeout: limit,
1025
1027
  });
1028
+ const timedOut = (attempt) => attempt.error && attempt.error.code === "ETIMEDOUT";
1029
+ let result = run();
1030
+ if (timedOut(result)) result = run();
1026
1031
  if (result.error && result.error.code === "ENOENT") return { absent: true };
1027
- if (result.error && result.error.code === "ETIMEDOUT") {
1028
- return { failed: `timed out after ${limit / 1000} s` };
1032
+ if (timedOut(result)) {
1033
+ return { failed: `timed out twice, after ${limit / 1000} s each` };
1029
1034
  }
1030
1035
  if (result.error) return { failed: result.error.message };
1031
1036
  // On Windows the call goes through cmd.exe, which reports a missing command
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.145.0",
3
+ "version": "5.147.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.145.0",
9
+ "version": "5.147.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.145.0",
5
+ "version": "5.147.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.145.0",
3
+ "version": "5.147.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.145.0",
3
+ "version": "5.147.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.145.0"
53
- PROTOCOL_VERSION = "5.145.0"
52
+ PACKAGE_VERSION = "5.147.0"
53
+ PROTOCOL_VERSION = "5.147.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
@@ -23838,8 +23838,15 @@ const args = process.argv.slice(2);
23838
23838
  fs.appendFileSync(process.env.FAKE_LOG, JSON.stringify([host, ...args]) + "\n");
23839
23839
  // FAKE_LIST_SLEEP_<HOST> holds `plugin list --json` for N seconds, and
23840
23840
  // FAKE_LIST_EXIT_<HOST> makes it exit with that status (#354).
23841
+ // FAKE_LIST_SLEEP_TIMES_<HOST> holds only the first N such calls (#365); the
23842
+ // count is written before the hold, since a held call is killed.
23841
23843
  if (args.join(" ") === "plugin list --json") {
23842
- const hold = Number(process.env[`FAKE_LIST_SLEEP_${host.toUpperCase()}`] || "0");
23844
+ let hold = Number(process.env[`FAKE_LIST_SLEEP_${host.toUpperCase()}`] || "0");
23845
+ const times = Number(process.env[`FAKE_LIST_SLEEP_TIMES_${host.toUpperCase()}`] || "Infinity");
23846
+ const counter = `${process.env.FAKE_STATE}.held-${host}`;
23847
+ const held = fs.existsSync(counter) ? Number(fs.readFileSync(counter, "utf8")) : 0;
23848
+ if (held >= times) hold = 0;
23849
+ else if (hold > 0) fs.writeFileSync(counter, String(held + 1));
23843
23850
  if (hold > 0) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, hold * 1000);
23844
23851
  const code = process.env[`FAKE_LIST_EXIT_${host.toUpperCase()}`];
23845
23852
  if (code) process.exit(Number(code));
@@ -24103,7 +24110,7 @@ def validate_update_host_query_timeout_scenario() -> int:
24103
24110
  if "absent" in codex:
24104
24111
  report(f"{label} a hung codex plugin list --json was reported absent: {codex!r}")
24105
24112
  return 1
24106
- for needle in ("failed", "codex plugin list --json", "timed out after 1.5 s"):
24113
+ for needle in ("failed", "codex plugin list --json", "1.5 s"):
24107
24114
  if needle not in codex:
24108
24115
  report(f"{label} the hung-query line does not name {needle!r}: {codex!r}")
24109
24116
  return 1
@@ -24224,6 +24231,77 @@ def validate_update_claude_refresh_retry_scenario() -> int:
24224
24231
  return 0
24225
24232
 
24226
24233
 
24234
+ def validate_update_host_query_retry_scenario() -> int:
24235
+ """Issue #365: `codex plugin list --json` usually answers in about 1 s and
24236
+ sometimes took 58 s through the owner's proxy.
24237
+
24238
+ A query that times out is retried once before the component reads
24239
+ `failed`, so one slow spell no longer leaves the plugin a release behind.
24240
+ """
24241
+ label = "update-host-query-retry:"
24242
+ listing = ["codex", "plugin", "list", "--json"]
24243
+ with tempfile.TemporaryDirectory(prefix="keel-update-365-", ignore_cleanup_errors=True) as raw:
24244
+ tmp = Path(raw)
24245
+ fake = tmp / "fake.js"
24246
+ write_text(fake, UPDATE_FAKE)
24247
+ launchers = {}
24248
+ for host in ("npm", "claude", "codex"):
24249
+ launcher = tmp / f"fake-{host}"
24250
+ write_text(launcher, f'#!/bin/sh\nFAKE_HOST={host} exec node "{fake}" "$@"\n')
24251
+ launcher.chmod(0o755)
24252
+ launchers[host] = launcher
24253
+ source = tmp / "codex-source"
24254
+ write_text(source / "hooks/codex.json", "{}\n")
24255
+
24256
+ def update(times: str):
24257
+ log, state = tmp / "log.jsonl", tmp / "state.json"
24258
+ for stale in (log, state, tmp / "state.json.held-codex"):
24259
+ if stale.exists():
24260
+ stale.unlink()
24261
+ log.write_text("")
24262
+ env = dict(os.environ)
24263
+ env.update({
24264
+ "KEEL_UPDATE_NPM": str(launchers["npm"]), "KEEL_UPDATE_CLAUDE": str(launchers["claude"]),
24265
+ "KEEL_UPDATE_CODEX": str(launchers["codex"]), "KEEL_UPDATE_QUERY_TIMEOUT_MS": "4000",
24266
+ "CODEX_HOME": str(tmp / "codex-home"), "FAKE_LOG": str(log), "FAKE_STATE": str(state),
24267
+ "FAKE_CODEX_SOURCE": str(source),
24268
+ "FAKE_LIST_SLEEP_CODEX": "15", "FAKE_LIST_SLEEP_TIMES_CODEX": times,
24269
+ })
24270
+ env.pop("KEEL_UPDATE_SOURCE", None)
24271
+ started = time.monotonic()
24272
+ result = subprocess.run(["node", str(ROOT / "bin/keel.js"), "--update"], cwd=tmp, env=env,
24273
+ text=True, capture_output=True, check=False, timeout=120)
24274
+ calls = [json.loads(line) for line in log.read_text().splitlines() if line.strip()]
24275
+ line = next((l for l in result.stdout.splitlines() if l.startswith("keel update: codex plugin:")), "")
24276
+ return result, calls, line, time.monotonic() - started
24277
+
24278
+ result, calls, line, _ = update("1")
24279
+ if "5.0.0 -> 5.1.0" not in line:
24280
+ report(f"{label} a query that timed out once did not go on to update the Codex plugin: {line!r}")
24281
+ return 1
24282
+ if result.returncode != 0:
24283
+ report(f"{label} a query that answered on retry left keel --update exiting {result.returncode}: {result.stdout!r}")
24284
+ return 1
24285
+
24286
+ result, calls, line, took = update("9")
24287
+ for needle in ("failed", "codex plugin list --json", "timed out twice", "4 s"):
24288
+ if needle not in line:
24289
+ report(f"{label} a lasting hang's line does not name {needle!r}: {line!r}")
24290
+ return 1
24291
+ runs = sum(1 for c in calls if c[:4] == listing)
24292
+ if runs != 2:
24293
+ report(f"{label} a lasting hang ran the query {runs} time(s), not 2: {calls!r}")
24294
+ return 1
24295
+ if took > 25:
24296
+ report(f"{label} two 4 s attempts held keel --update for {took:.1f} s.")
24297
+ return 1
24298
+ if "update-host-query-retry" not in {name for name, _ in SCENARIOS}:
24299
+ report(f"{label} scenario is not registered.")
24300
+ return 1
24301
+ report("update-host-query-retry scenario passed.")
24302
+ return 0
24303
+
24304
+
24227
24305
  def validate_update_codex_refresh_retry_scenario() -> int:
24228
24306
  """Issue #329: a slow link can cut Codex's whole-repository marketplace clone.
24229
24307
 
@@ -39152,6 +39230,96 @@ def validate_a_claim_names_what_would_falsify_it_scenario() -> int:
39152
39230
  return 0
39153
39231
 
39154
39232
 
39233
+ def validate_a_listed_marker_opens_its_clause_scenario() -> int:
39234
+ """Issue #362: a disposition written as a sub-list item was read as prose.
39235
+
39236
+ A `Findings` value whose marker sits on its own `- ` line under the label
39237
+ reached the marker scan as a line break, indentation and `- `; the opening
39238
+ rule allowed only indentation after a break, so `Resolved here: M1` read as
39239
+ a mid-sentence mention and the entry was refused `finding-owner`, while the
39240
+ same text on the label's own line passed.
39241
+ """
39242
+ label = "a-listed-marker-opens-its-clause"
39243
+
39244
+ def findings_task(findings: list[str]) -> str:
39245
+ return "\n".join(
39246
+ [
39247
+ "- [x] 1.1 Findings probe",
39248
+ " - Owner: claude",
39249
+ " - Mode: implementation",
39250
+ " - Covers:",
39251
+ " - E1: the task proves its own behavior",
39252
+ " - Read:",
39253
+ " - README.md",
39254
+ " - Touch:",
39255
+ " - src/example.js",
39256
+ " - Verify:",
39257
+ " - Strategy: vertical-tdd",
39258
+ " - M1: node test.js asserts the public behavior",
39259
+ " - Evidence:",
39260
+ " - Contract: pending",
39261
+ " - M1: pass. node test.js reported the behavior.",
39262
+ " - M1.red: fail. the behavior did not exist.",
39263
+ " - M1.green: pass.",
39264
+ " - Review:",
39265
+ " - Status: pass",
39266
+ " - Acceptance check: the behavior is proven.",
39267
+ " - Scope check: only Touch changed.",
39268
+ " - Findings:",
39269
+ *[f" - {item}" for item in findings],
39270
+ " - Blocker: none",
39271
+ " - Reauthorizations: none",
39272
+ ]
39273
+ )
39274
+
39275
+ with tempfile.TemporaryDirectory(prefix="keel-listed-marker-") as raw:
39276
+ root = Path(raw)
39277
+
39278
+ def complete(name: str, *findings: str) -> dict:
39279
+ repo = root / name
39280
+ write_gate_fixture(repo, tasks=findings_task(list(findings)))
39281
+ write_text(repo / "flow/Makefile", "all:\n")
39282
+ run_keel(repo, "gate", "task-start", "--change", "demo", "--task", "1.1", "--record", "--json")
39283
+ done = run_keel(repo, "gate", "task-complete", "--change", "demo", "--task", "1.1", "--json")
39284
+ try:
39285
+ return json.loads(done.stdout)
39286
+ except json.JSONDecodeError:
39287
+ return {"status": "unparsed", "problems": [{"message": done.stdout[:400]}]}
39288
+
39289
+ # The forms #362 reported refused, each as a sub-list item.
39290
+ for name, items in (
39291
+ ("check", ["Resolved here: M1"]),
39292
+ ("path", ["Resolved here: flow/Makefile"]),
39293
+ ("path-then-cjk-sentence", ["Resolved here: flow/Makefile。规则已改为按点名运行。"]),
39294
+ ("two-items", ["Resolved here: M1", "Discard reason: out of scope."]),
39295
+ ):
39296
+ payload = complete(name, *items)
39297
+ if payload.get("status") != "pass":
39298
+ report(f"{label}: a sub-list {items!r} is not read as a disposition ({name}); "
39299
+ f"{problem_codes(payload)!r} {problem_text(payload)!r}.")
39300
+ return 1
39301
+
39302
+ # The control: a listed claim is held to the evidence rule, not waved through.
39303
+ payload = complete("unknown-check", "Resolved here: M9")
39304
+ if "M9" not in problem_text(payload):
39305
+ report(f"{label}: a sub-list `Resolved here: M9` naming an undeclared check was not refused "
39306
+ f"for that check; {problem_codes(payload)!r} {problem_text(payload)!r}.")
39307
+ return 1
39308
+
39309
+ # A negation on a listed line is still a negation (#144).
39310
+ payload = complete("negated", "Not resolved here: a different module. Durable owner: https://example.com/issues/1")
39311
+ if payload.get("status") != "pass":
39312
+ report(f"{label}: a listed negation was refused; "
39313
+ f"{problem_codes(payload)!r} {problem_text(payload)!r}.")
39314
+ return 1
39315
+
39316
+ if "a-listed-marker-opens-its-clause" not in {name for name, _ in SCENARIOS}:
39317
+ report(f"{label}: scenario is not registered.")
39318
+ return 1
39319
+ report(f"{label} scenario passed.")
39320
+ return 0
39321
+
39322
+
39155
39323
  def validate_a_negation_is_not_a_marker_scenario() -> int:
39156
39324
  """Issue #144: `Not resolved here:` was read as `Resolved here:`.
39157
39325
 
@@ -41512,6 +41680,7 @@ SCENARIOS: tuple = (
41512
41680
  ("adopted-update-is-silent-unless-reload", validate_adopted_update_is_silent_unless_reload_scenario),
41513
41681
  ("update-covers-installed-hosts", validate_update_covers_installed_hosts_scenario),
41514
41682
  ("update-codex-refresh-retry", validate_update_codex_refresh_retry_scenario),
41683
+ ("update-host-query-retry", validate_update_host_query_retry_scenario),
41515
41684
  ("update-claude-refresh-retry", validate_update_claude_refresh_retry_scenario),
41516
41685
  ("update-host-query-timeout", validate_update_host_query_timeout_scenario),
41517
41686
  ("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
@@ -41696,6 +41865,10 @@ SCENARIOS: tuple = (
41696
41865
  "a-negation-is-not-a-marker",
41697
41866
  validate_a_negation_is_not_a_marker_scenario,
41698
41867
  ),
41868
+ (
41869
+ "a-listed-marker-opens-its-clause",
41870
+ validate_a_listed_marker_opens_its_clause_scenario,
41871
+ ),
41699
41872
  (
41700
41873
  "an-equivalence-claim-names-its-base",
41701
41874
  validate_an_equivalence_claim_names_its_base_scenario,
package/src/core/gates.js CHANGED
@@ -1039,8 +1039,8 @@ function transientOwnerMessage(candidate) {
1039
1039
  // global because each resolved claim owes its own evidence; checking only the
1040
1040
  // first would let a second one assert itself for free.
1041
1041
  // A marker is a disposition only where it OPENS its clause: the start of the
1042
- // value, a line break, or sentence-ending punctuation may precede it, and a word
1043
- // may not. `Not resolved here:` contains the marker and means its opposite, and a
1042
+ // value, a line break, or sentence-ending punctuation may precede it, each
1043
+ // optionally followed by a list item's bullet, and a word may not. `Not resolved here:` contains the marker and means its opposite, and a
1044
1044
  // `\b` boundary sat happily at the space inside it — the negation was read as a
1045
1045
  // resolution claim and the next word, `it`, as its evidence, so a dismissal was
1046
1046
  // read as a repair and then refused for lacking repair evidence (issue #144).
@@ -1050,7 +1050,12 @@ function transientOwnerMessage(candidate) {
1050
1050
  // Written as a lookbehind so the captures keep reading from the same offsets —
1051
1051
  // every rule here is positional, and a rule that shortened the text would move
1052
1052
  // what they read.
1053
- const CLAUSE_OPENING = "(?<=^|[\\n.;:!?\u2014\u2013])[ \\t]*";
1053
+ //
1054
+ // A Findings written as a sub-list reaches this scan as a line break, the
1055
+ // item's indentation and its bullet, so the bullet is an opening too: without
1056
+ // it `- Resolved here: M1` read as a mid-sentence mention and was refused for
1057
+ // carrying no disposition, while the same text on the label's line passed (#362).
1058
+ const CLAUSE_OPENING = "(?<=^|[\\n.;:!?\u2014\u2013])[ \\t]*(?:[-*+][ \\t]+)?";
1054
1059
 
1055
1060
  const RESOLVED_HERE = new RegExp(
1056
1061
  `${CLAUSE_OPENING}resolved here\\s*:[ \\t]*(\\S*)`,
@@ -1684,7 +1689,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
1684
1689
  + (mentionsUnopenedMarker(scannable)
1685
1690
  ? " A marker counts only where it opens its clause — after the "
1686
1691
  + "start of the value, a line break, or sentence-ending "
1687
- + "punctuation. This text mentions one mid-sentence, so it was "
1692
+ + "punctuation, or the bullet of a list item. This text mentions one mid-sentence, so it was "
1688
1693
  + "read as prose; move it to the start of its own clause, or "
1689
1694
  + "keep it as prose and add the disposition separately."
1690
1695
  : "")