diff --git a/heart/checks/ci_timing.py b/heart/checks/ci_timing.py index bb927f41..79a5869c 100644 --- a/heart/checks/ci_timing.py +++ b/heart/checks/ci_timing.py @@ -74,7 +74,7 @@ }, "events": [{"kind": "timed_out", "workflow": ..., "run_url": ..., "duration_s": ..., "head_branch": ..., "at": ..., - "prompt": "/bug kill timer: ..."}] + "prompt": "Use the bug skill. kill timer: ..."}] } Global rollup schema (``ci_timing.json``):: @@ -261,9 +261,9 @@ def classify_cancelled(run: dict[str, Any], siblings: list[dict[str, Any]]) -> s def event_prompt(repo: str, event: dict[str, Any]) -> str: - """The self-contained /bug prompt a hang/kill row copies.""" + """The self-contained Use the bug skill. prompt a hang/kill row copies.""" return ( - f"/bug kill timer: {repo} {event.get('workflow')} {event.get('kind')} after " + f"Use the bug skill. kill timer: {repo} {event.get('workflow')} {event.get('kind')} after " f"{int(round(float(event.get('duration_s') or 0)))}s on " f"{event.get('head_branch') or '?'} — {event.get('run_url') or '?'}" ) @@ -271,9 +271,9 @@ def event_prompt(repo: str, event: dict[str, Any]) -> str: def gate_prompt(repo: str, workflow: str, old_s: float, new_s: float, actions_url: str) -> str: - """The self-contained /bug prompt a slowed gate copies.""" + """The self-contained Use the bug skill. prompt a slowed gate copies.""" return ( - f"/bug smoke gate {repo}: {workflow} median wall-clock rose " + f"Use the bug skill. smoke gate {repo}: {workflow} median wall-clock rose " f"{int(round(old_s))}s → {int(round(new_s))}s vs its recent history — " f"{actions_url}" ) diff --git a/heart/checks/no_run_census.py b/heart/checks/no_run_census.py index e3e26b05..ab1f86ae 100644 --- a/heart/checks/no_run_census.py +++ b/heart/checks/no_run_census.py @@ -105,15 +105,15 @@ def _truncate(text: str, limit: int = REASON_LIMIT) -> str: def row_prompt(repo: str, entry: str, marker: str, date: str, reason: str, measured: bool) -> str | None: - """The ready-to-paste /bug prompt for one row (None for permanent skips).""" + """The ready-to-paste Use the bug skill. prompt for one row (None for permanent skips).""" when = date or "unknown date" if marker == SLOW and not measured: - return (f"/bug no_run: {repo} {entry} SLOW since {when} with no measurement — " + return (f"Use the bug skill. no_run: {repo} {entry} SLOW since {when} with no measurement — " f"retime against the real cap, then fix it or delete the marker") if marker == SLOW: - return f"/bug no_run: {repo} {entry} SLOW since {when} — {_truncate(reason)}" + return f"Use the bug skill. no_run: {repo} {entry} SLOW since {when} — {_truncate(reason)}" if marker == NEEDS_FIX: - return (f"/bug no_run: {repo} {entry} NEEDS_FIX since {when} — " + return (f"Use the bug skill. no_run: {repo} {entry} NEEDS_FIX since {when} — " f"{_truncate(reason)}. Reproduce before fixing: stale markers have " f"evaporated before") return None diff --git a/heart/checks/smoke_timings.py b/heart/checks/smoke_timings.py index 3cbbd9a7..26d96d5d 100644 --- a/heart/checks/smoke_timings.py +++ b/heart/checks/smoke_timings.py @@ -542,22 +542,22 @@ def leg_counts(entries: list[dict[str, Any]]) -> dict[str, Any]: # --- prompts (written by the producer; never re-derived by a renderer) ------- def timeout_prompt(repo: str, entry: str, cap_s: Any, run_url: str) -> str: - """The self-contained /bug prompt a TIMEOUT row copies.""" + """The self-contained Use the bug skill. prompt a TIMEOUT row copies.""" cap = _as_float(cap_s) cap_text = str(int(round(cap))) if cap is not None else "?" return ( - f"/bug kill timer: {repo} {entry} TIMEOUT ({cap_text}s) on {run_url} " + f"Use the bug skill. kill timer: {repo} {entry} TIMEOUT ({cap_text}s) on {run_url} " f"— stack tail in the run log" ) def slow_prompt(repo: str, entry: str, prev_s: Any, now_s: Any, prev_run_url: str, run_url: str) -> str: - """The self-contained /bug prompt a slowed script copies.""" + """The self-contained Use the bug skill. prompt a slowed script copies.""" prev = _as_float(prev_s) or 0.0 now = _as_float(now_s) or 0.0 return ( - f"/bug slow script: {repo} {entry} {int(round(prev))}s → {int(round(now))}s " + f"Use the bug skill. slow script: {repo} {entry} {int(round(prev))}s → {int(round(now))}s " f"between runs {prev_run_url} → {run_url}" ) diff --git a/heart/dashboard.py b/heart/dashboard.py index 23880dbe..0c5335fe 100644 --- a/heart/dashboard.py +++ b/heart/dashboard.py @@ -33,7 +33,7 @@ **Actionable, not just readable.** Every blocker/warning is also structured (``Board.blockers``: text, repo, run url, and a copyable ``/bug`` prompt), and -sections that need a hand carry an ``action`` — the exact command or Claude +sections that need a hand carry an ``action`` — the exact command or AI prompt to copy. An evidence gap carries more: the ``command`` that re-runs the check behind it (looked up from ``STALE_REMEDIES`` by the readiness gate key, never guessed from the sentence), and the whole stale tier carries one @@ -252,7 +252,7 @@ class Section: # {label, url} — e.g. the failing CI runs behind a red repo group. links: list[dict] = field(default_factory=list) # {label, payload} — what a 📋 button copies for this row (a command or a - # Claude prompt), or None when the row needs no hand. + # AI prompt), or None when the row needs no hand. action: dict | None = None # "observed 6h ago on the dev box" when this row came from a published # dev-box observation rather than this render's own snapshot. @@ -516,7 +516,7 @@ def _repo_remedy(name: str, key: str) -> dict | None: """Typed checkout remedies; canonical paths are resolved by the receiving chat.""" if key == "lib_behind": return {"label": "update the canonical checkout", "kind": "prompt", - "payload": (f"/health {name} is behind origin. Resolve its canonical main " + "payload": (f"Use the health skill. {name} is behind origin. Resolve its canonical main " "checkout from the workspace repository manifest (not a task worktree). " "Inspect branch, status and active claims. Only if clean on main, run " "git -C pull --ff-only, then " @@ -527,10 +527,10 @@ def _repo_remedy(name: str, key: str) -> dict | None: "payload": f"pyauto-heart fix dirty {shlex.quote(name)}"} if key == "open_pr": return {"label": "review the open PR", "kind": "prompt", - "payload": f"/health Review the aging open PRs for {name}; report CI and next steps. Do not merge or close without approval."} + "payload": f"Use the health skill. Review the aging open PRs for {name}; report CI and next steps. Do not merge or close without approval."} if key == "ahead": return {"label": "inspect unpublished commits", "kind": "prompt", - "payload": f"/health Inspect {name}'s ahead-of-origin commits and active task claims. Preserve commits; propose the next step before pushing or resetting anything."} + "payload": f"Use the health skill. Inspect {name}'s ahead-of-origin commits and active task claims. Preserve commits; propose the next step before pushing or resetting anything."} return None @@ -562,8 +562,8 @@ def add(key, reason, state, source, evidence=None, action=None, impact=None): detail = ((ci.get("workflows") or {}).get(workflow) or {}) if workflow else ci url = detail.get("url") or ci.get("url") key = impact["key"] - prompt = (f"/health Refresh CI evidence for {name}" if impact["severity"] == "stale" - else f"/bug Heart board: {name} {workflow or ci.get('workflow') or 'CI'} failing on main") + prompt = (f"Use the health skill. Refresh CI evidence for {name}" if impact["severity"] == "stale" + else f"Use the bug skill. Heart board: {name} {workflow or ci.get('workflow') or 'CI'} failing on main") if url: prompt += f" — failing run: {url}" add(key + (":" + workflow if workflow else ""), impact["text"], WARN, @@ -573,7 +573,7 @@ def add(key, reason, state, source, evidence=None, action=None, impact=None): # Non-gating failures remain advisory, never red release blockers. add("ci", reason, WARN if state == FAIL else state, "CI", ci.get("url"), {"label": "inspect CI", "kind": "prompt", - "payload": f"/health Inspect CI for {name}: {reason}"} if state != OK else None) + "payload": f"Use the health skill. Inspect CI for {name}: {reason}"} if state != OK else None) if "repo_state" in unobserved: add("checkout_unobserved", "repo state n/a here", UNOBS, "local checkout") @@ -651,6 +651,26 @@ def _repo_section( links=links[:4], entries=entries) +def _portable_cached_prompts(value): + """Adapt old snapshots without mutating evidence or shell commands.""" + if isinstance(value, list): + return [_portable_cached_prompts(item) for item in value] + if isinstance(value, dict): + result = {} + for key, item in value.items(): + is_prompt = key == "prompt" or ( + key == "payload" and value.get("kind") == "prompt") + if is_prompt and isinstance(item, str): + for skill in ("bug", "health", "release"): + prefix = "/" + skill + if item == prefix or item.startswith(prefix + " "): + item = f"Use the {skill} skill." + item[len(prefix):] + break + result[key] = _portable_cached_prompts(item) + return result + return value + + def build_board( snapshot: dict | None, verdict: dict | None, @@ -662,7 +682,8 @@ def build_board( devbox: dict | None = None, ) -> Board: """Assemble the format-agnostic :class:`Board`. Pure; never raises.""" - snapshot = snapshot or {} + snapshot = _portable_cached_prompts(snapshot or {}) + devbox = _portable_cached_prompts(devbox) verdict = verdict or {} unobserved = tuple(unobserved) repos = snapshot.get("repos", {}) or {} @@ -757,7 +778,7 @@ def build_board( "source": "local worktree inventory", "observed_at": ts, "evidence": path, "action": {"kind": "prompt", "label": "triage drift", - "payload": f"/health Inspect worktree drift: {path} — {reason}. " + "payload": f"Use the health skill. Inspect worktree drift: {path} — {reason}. " "Run pyauto-heart fix drift for context; reconcile active claims, " "preserve user edits and obtain approval before cleanup."}}) # Local details are uncapped; publication still scrubs private paths. @@ -1068,12 +1089,12 @@ def build_board( for section in sections: if section.key == "release_validation" and section.state in (FAIL, WARN): section.action = {"label": "inspect release validation", "kind": "prompt", - "payload": "/release Review the current release-validation evidence and failing stages; " + "payload": "Use the release skill. Review the current release-validation evidence and failing stages; " "plan any repair or rehearsal through the existing gates. Do not publish a release."} elif section.key == "test_run" and section.state in (FAIL, WARN): section.action = {"label": "inspect workspace validation", "kind": "prompt", - "payload": "/health Inspect the latest workspace validation report, identify failures " - "and timeouts, and route confirmed repairs through /bug and start-dev."} + "payload": "Use the health skill. Inspect the latest workspace validation report, identify failures " + "and timeouts, and route confirmed repairs through the bug and start-dev skills."} board = Board( verdict=v, @@ -1107,15 +1128,15 @@ def build_fix_plan(board: Board, snapshot: dict | None = None, *, They are evidence to diagnose, not instructions to execute blindly. """ lines = [ - "/health Work through this Heart dashboard systematically in this chat.", + "Use the health skill. Work through this Heart dashboard systematically in this chat.", f"Snapshot: {board.ts or 'unknown'}; verdict: {board.verdict}; score: {board.score}.", "1. Read current authoritative Heart evidence first. Reconcile older dev-box " "observations and the published board before acting; this snapshot may be stale.", "2. Make a deduplicated checklist: real release blockers, missing evidence, " "local drift, then advisory timing and score improvements. A red section is " "not necessarily a release blocker. Missing evidence is not a code failure.", - "3. Use existing /health, /bug and start-dev, /hygiene, /repo-cleanup and " - "/release rehearse doors as appropriate. Follow plan approvals and active " + "3. Use the health, bug, start-dev, hygiene, repo-cleanup and " + "release skills (rehearse for release) as appropriate. Follow plan approvals and active " "task claims. This prompt is not approval to merge, delete work or release; " "rehearsal and publication are separate actions.", "4. Complete authorized items in this chat, refresh evidence after relevant " @@ -1502,7 +1523,7 @@ def _unobs_section(key: str, title: str) -> Section: # and the all-in-one plan are written from, so the two can never disagree. TICK_CMD = "pyauto-heart tick" VERIFY_INSTALL_CMD = "pyauto-heart verify_install --report-json" -REHEARSE_STEP = ("dispatch a release rehearsal with `/release rehearse`, then " +REHEARSE_STEP = ("dispatch a release rehearsal with the release skill with `rehearse`, then " "`pyauto-heart validate --ingest `") STALE_REMEDIES: dict[str, dict] = { @@ -1554,7 +1575,7 @@ def _unobs_section(key: str, title: str) -> Section: # What a stale row copies when its key has no entry here (a gap added since # this table, or a verdict from an older Heart that carries no keys at all). -GENERIC_STALE_PROMPT = "/health re-run the stale evidence: {text}" +GENERIC_STALE_PROMPT = "Use the health skill. re-run the stale evidence: {text}" def stale_remedy(key: str) -> dict | None: @@ -1564,10 +1585,10 @@ def stale_remedy(key: str) -> dict | None: def _stale_prompt(text: str, remedy: dict | None) -> str: - """One gap's Claude prompt: what to re-run, on which gap, and the rule.""" + """One gap's AI prompt: what to re-run, on which gap, and the rule.""" if not remedy: return GENERIC_STALE_PROMPT.format(text=text) - return (f"/health {remedy['step']} — the Heart's evidence gap: \"{text}\". " + return (f"Use the health skill. {remedy['step']} — the Heart's evidence gap: \"{text}\". " "Re-run the check only, never change code to clear it; then " f"`{TICK_CMD}` and re-read `pyauto-heart readiness`.") @@ -1598,7 +1619,7 @@ def build_stale_plan(stale_reasons: list, stale_keys: list) -> dict | None: if cmd and cmd not in commands: commands.append(cmd) prompt = ( - f"/health clear the Heart's {len(stale_reasons)} evidence gap(s) — re-run " + f"Use the health skill. clear the Heart's {len(stale_reasons)} evidence gap(s) — re-run " "the checks named below; never change code to clear one:\n" + "\n".join(steps) + f"\nThen run `{TICK_CMD} && pyauto-heart readiness` and report the new verdict." @@ -1639,7 +1660,7 @@ def _reason_item(text: str, severity: str, repos: dict, key: str = "", command = (remedy or {}).get("command") prompt = _stale_prompt(text, remedy) else: - prompt = f"/bug Heart board: {text}" + prompt = f"Use the bug skill. Heart board: {text}" if run_url: prompt += f" — failing run: {run_url}" remedy = _repo_remedy(repo or "", (detail or {}).get("key", "")) @@ -1648,7 +1669,7 @@ def _reason_item(text: str, severity: str, repos: dict, key: str = "", run_url = None if remedy["kind"] == "command": command = remedy["payload"] - prompt = f"/health Inspect {repo}'s checkout using `{command}`; preserve user edits and review before changing it." + prompt = f"Use the health skill. Inspect {repo}'s checkout using `{command}`; preserve user edits and review before changing it." else: prompt = remedy["payload"] return {"text": text, "severity": severity, "repo": repo, @@ -1816,7 +1837,7 @@ def _md_prompts_block(items: list[dict], plan: dict | None = None) -> list[str]: if not items: return [] lines = ["
", - "📋 fix prompts — copy one into a Claude Code chat", ""] + "📋 fix prompts — copy one into an AI assistant chat", ""] if plan and items[0].get("severity") == "stale": lines += ["**Clear every gap in one go:**", "", "```", plan["prompt"], "```", ""] if plan.get("command"): @@ -1919,7 +1940,7 @@ def _html_reason(item: dict) -> str: "copy the command that re-runs this check", "copy command") if item.get("prompt"): - text += " " + _copy_btn(item["prompt"], "copy the fix prompt for a Claude Code chat") + text += " " + _copy_btn(item["prompt"], "copy the fix prompt for an AI assistant chat") return f"
  • {text}
  • " @@ -2143,7 +2164,7 @@ def _render_html(board: Board) -> str: "copy command" if payload.startswith("pyauto-heart ") else "copy prompt", icon=True)) if not actions: - prompt = (f'/health Review the Heart dashboard category "{sec.title}". ' + prompt = (f'Use the health skill. Review the Heart dashboard category "{sec.title}". ' f'Current summary: {sec.summary}. Inspect the latest evidence; ' 'refresh missing or expired observations before proposing repairs. ' 'Route confirmed repairs through the development workflow. ' @@ -2372,7 +2393,7 @@ def to_state(board: Board) -> dict[str, Any]: status is the readiness verdict (anything outside the four tiers is grey); the headline is the worst reason, else a clear line worded like the badge; items are the structured blockers (each keeping its failing-run link and - its copy-for-Claude prompt) so the cockpit acts on them without + its copy-for-assistant prompt) so the cockpit acts on them without re-deriving anything. """ status = board.verdict if board.verdict in STATE_STATUSES[:4] else "grey" diff --git a/tests/test_ci_timing.py b/tests/test_ci_timing.py index 3e9f2ab0..e3f1ff90 100644 --- a/tests/test_ci_timing.py +++ b/tests/test_ci_timing.py @@ -166,7 +166,7 @@ def test_cancelled_pr_run_with_no_successor_is_suspect(tmp_path): assert event["kind"] == "suspect_cancelled" assert event["run_url"] == "https://github.invalid/run/77" assert event["prompt"] == ( - "/bug kill timer: RepoA Gate One suspect_cancelled after 3300s on feat/y " + "Use the bug skill. kill timer: RepoA Gate One suspect_cancelled after 3300s on feat/y " "— https://github.invalid/run/77" ) @@ -185,7 +185,7 @@ def test_timed_out_is_always_an_event_with_its_prompt(tmp_path): assert event["head_branch"] == "main" assert event["at"] == "2026-08-20T09:00:00Z" assert event["prompt"] == ( - "/bug kill timer: RepoA Gate One timed_out after 18000s on main " + "Use the bug skill. kill timer: RepoA Gate One timed_out after 18000s on main " "— https://github.invalid/run/9" ) @@ -278,7 +278,7 @@ def test_aggregate_flags_a_slowed_gate_with_its_prompt(): assert gate["state"] == "warn" assert gate["baseline_s"] == 600.0 assert gate["prompt"] == ( - "/bug smoke gate RepoA: Gate One median wall-clock rose 600s → 1200s " + "Use the bug skill. smoke gate RepoA: Gate One median wall-clock rose 600s → 1200s " f"vs its recent history — {ACTIONS}" ) @@ -357,10 +357,10 @@ def test_aggregate_concatenates_events_with_repo_context(): side = _sidecar(600.0) side["events"] = [{"kind": "timed_out", "workflow": "Gate One", "run_url": "u", "duration_s": 900.0, "head_branch": "main", - "at": "t", "prompt": "/bug kill timer: RepoA ..."}] + "at": "t", "prompt": "Use the bug skill. kill timer: RepoA ..."}] roll = ct.aggregate([side], {}, "2026-08-24", "T", ct.DEFAULT_CI_TIMING_THRESHOLDS) assert roll["events"][0]["repo"] == "RepoA" - assert roll["events"][0]["prompt"].startswith("/bug kill timer:") + assert roll["events"][0]["prompt"].startswith("Use the bug skill. kill timer:") def test_summary_line_counts_gates_slowdowns_and_events(monkeypatch): diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index d6d2467d..dc5eab6b 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -508,7 +508,7 @@ def test_blockers_are_structured_with_links_and_prompts(): assert b["repo"] == "autolens_workspace" assert b["repo_url"] == WS_REPO_URL assert b["run_url"] == RUN_URL - assert b["prompt"].startswith("/bug Heart board: autolens_workspace") + assert b["prompt"].startswith("Use the bug skill. Heart board: autolens_workspace") assert b["run_url"] in b["prompt"] @@ -517,7 +517,7 @@ def test_html_carries_copy_buttons_and_run_links(): red_reasons=["autolens_workspace: Smoke Tests failure on main"]) out = dashboard.render(_failing_snapshot(), v, fmt="html", now=FRESH_NOW) assert "data-cmd=" in out # the shared copy handler's payload hook - assert "/bug Heart board: autolens_workspace" in out + assert "Use the bug skill. Heart board: autolens_workspace" in out assert RUN_URL in out # the failing repo group row links the run too assert "autolens_workspace run" in out @@ -529,7 +529,7 @@ def test_md_links_blockers_and_collapses_prompts(): out = dashboard.render(_failing_snapshot(), v, fmt="md", now=FRESH_NOW) assert f"[autolens_workspace]({WS_REPO_URL})" in out assert f"([run]({RUN_URL}))" in out - assert "
    " in out and "/bug Heart board:" in out + assert "
    " in out and "Use the bug skill. Heart board:" in out def test_md_brief_is_a_strip_not_a_table(): @@ -563,11 +563,11 @@ def test_failing_repo_row_link_carries_its_own_prompt(): board = dashboard.build_board(_failing_snapshot(), v, now=FRESH_NOW) ws = {s.key: s for s in board.sections}["workspaces"] (link,) = ws.links - assert link["prompt"].startswith("/bug Heart board: autolens_workspace Smoke Tests") + assert link["prompt"].startswith("Use the bug skill. Heart board: autolens_workspace Smoke Tests") assert RUN_URL in link["prompt"] html = dashboard.render(_failing_snapshot(), v, fmt="html", now=FRESH_NOW) # the row-level 📋 renders beside the run link, not only in the blockers - assert html.count("/bug Heart board: autolens_workspace") >= 2 + assert html.count("Use the bug skill. Heart board: autolens_workspace") >= 2 def test_unobserved_rows_carry_watch_line_and_observe_action(): @@ -627,7 +627,7 @@ def test_json_v2_carries_blockers_and_actions(): unobserved=dashboard.LOCAL_ONLY_FAMILIES, now=FRESH_NOW) d = json.loads(out) assert d["schema_version"] == dashboard.SCHEMA_VERSION - assert d["blockers"][0]["prompt"].startswith("/bug ") + assert d["blockers"][0]["prompt"].startswith("Use the bug skill. ") unobs = [s for s in d["sections"] if s["state"] == "unobserved"] assert unobs and all(s["action"]["payload"].startswith("pyauto-heart") for s in unobs) @@ -638,15 +638,15 @@ def test_json_v2_carries_blockers_and_actions(): EVENT_URL = "https://ci.invalid/actions/runs/9" GATE_URL = "https://ci.invalid/RepoA/actions" EVENT_PROMPT = ( - "/bug kill timer: RepoA Gate One timed_out after 18000s on main " + "Use the bug skill. kill timer: RepoA Gate One timed_out after 18000s on main " f"— {EVENT_URL}" ) GATE_PROMPT = ( - "/bug smoke gate RepoA: Gate One median wall-clock rose 600s → 900s vs its " + "Use the bug skill. smoke gate RepoA: Gate One median wall-clock rose 600s → 900s vs its " f"recent history — {GATE_URL}" ) ROW_PROMPT = ( - "/bug no_run: RepoA imaging/x.py SLOW since 2026-07-14 with no measurement — " + "Use the bug skill. no_run: RepoA imaging/x.py SLOW since 2026-07-14 with no measurement — " "retime against the real cap, then fix it or delete the marker" ) @@ -697,7 +697,7 @@ def _no_run_slice(): "prompt": ROW_PROMPT}, {"repo": "RepoA", "entry": "imaging/y.py", "marker": "NEEDS_FIX", "date": "", "reason": "raises", "measured": False, - "prompt": "/bug no_run: RepoA imaging/y.py NEEDS_FIX since unknown date"}, + "prompt": "Use the bug skill. no_run: RepoA imaging/y.py NEEDS_FIX since unknown date"}, ], } @@ -885,11 +885,11 @@ def test_malformed_performance_slices_never_break_the_board(): SCRIPT_RUN_URL = "https://ci.invalid/OwnerX/RepoA/actions/runs/7" SCRIPT_PREV_RUN_URL = "https://ci.invalid/OwnerX/RepoA/actions/runs/6" TIMEOUT_PROMPT = ( - f"/bug kill timer: RepoA imaging/slow.py TIMEOUT (600s) on {SCRIPT_RUN_URL} " + f"Use the bug skill. kill timer: RepoA imaging/slow.py TIMEOUT (600s) on {SCRIPT_RUN_URL} " f"— stack tail in the run log" ) SLOW_SCRIPT_PROMPT = ( - "/bug slow script: RepoA imaging/x.py 10s → 30s between runs " + "Use the bug skill. slow script: RepoA imaging/x.py 10s → 30s between runs " f"{SCRIPT_PREV_RUN_URL} → {SCRIPT_RUN_URL}" ) @@ -1166,10 +1166,10 @@ def test_each_gap_carries_the_command_that_closes_it(): # the prompt names the check AND the gap it closes — not the sentence back assert dashboard.VERIFY_INSTALL_CMD in install["prompt"] assert GAPS[0] in install["prompt"] - assert install["prompt"].startswith("/health") + assert install["prompt"].startswith("Use the health skill.") # STALE's rule survives the trip to the chip assert "never change code" in install["prompt"] - assert not any(b["prompt"].startswith("/bug") for b in board.blockers) + assert not any(b["prompt"].startswith("Use the bug skill.") for b in board.blockers) def test_a_gap_needing_a_conversation_offers_no_command(): @@ -1178,7 +1178,7 @@ def test_a_gap_needing_a_conversation_offers_no_command(): (gap,) = board.blockers assert gap["command"] is None # the Heart never dispatches a rehearsal - assert "/release rehearse" in gap["prompt"] + assert "release skill with `rehearse`" in gap["prompt"] def test_an_unkeyed_gap_falls_back_to_the_generic_nudge(): @@ -1190,7 +1190,7 @@ def test_an_unkeyed_gap_falls_back_to_the_generic_nudge(): (gap,) = board.blockers assert gap["command"] is None - assert gap["prompt"] == "/health re-run the stale evidence: some gap nobody has mapped yet" + assert gap["prompt"] == "Use the health skill. re-run the stale evidence: some gap nobody has mapped yet" assert board.stale_plan is None @@ -1202,7 +1202,7 @@ def test_the_tier_carries_one_plan_that_clears_every_gap(): assert plan["count"] == 2 for gap in GAPS: assert gap in plan["prompt"] # every gap named, in order - assert plan["prompt"].startswith("/health clear the Heart's 2 evidence gap(s)") + assert plan["prompt"].startswith("Use the health skill. clear the Heart's 2 evidence gap(s)") # every gap here has a command, so the whole tier is one shell chain that # ends by re-reading the verdict assert plan["command"] == (f"{dashboard.VERIFY_INSTALL_CMD} && {dashboard.TICK_CMD}" @@ -1216,7 +1216,7 @@ def test_the_plan_withholds_a_command_chain_it_cannot_complete(): board = dashboard.build_board(make_snapshot(), v, now=FRESH_NOW) assert board.stale_plan["command"] is None - assert "/release rehearse" in board.stale_plan["prompt"] + assert "release skill with `rehearse`" in board.stale_plan["prompt"] def test_no_plan_when_nothing_is_stale(): @@ -1741,7 +1741,7 @@ def test_to_state_red_items_carry_url_and_prompt(): assert doc["headline"].startswith("PyAutoFit: CI failure") red = [i for i in doc["items"] if i["severity"] == "red"] assert red and red[0]["url"].endswith("/actions/runs/1") - assert red[0]["prompt"].startswith("/bug") + assert red[0]["prompt"].startswith("Use the bug skill.") assert any(i["severity"] == "yellow" for i in doc["items"]) diff --git a/tests/test_dashboard_disclosures.py b/tests/test_dashboard_disclosures.py index 2e3545bb..2c803c65 100644 --- a/tests/test_dashboard_disclosures.py +++ b/tests/test_dashboard_disclosures.py @@ -113,7 +113,7 @@ def test_timing_cards_are_inside_category_and_checks_precede_score_actions_gaps( def test_icon_copy_payloads_round_trip_quotes_newlines_and_markup(): - payload = '/health Inspect "repo"\nKeep & don\'t execute it.' + payload = 'Use the health skill. Inspect "repo"\nKeep & don\'t execute it.' for face in ('copy command', 'copy prompt'): root = Page(dashboard._copy_btn(payload, 'Inspect "repo"', face, icon=True)).root button = next(root.find('button')) diff --git a/tests/test_dashboard_reasons.py b/tests/test_dashboard_reasons.py index 788b0477..190bad5f 100644 --- a/tests/test_dashboard_reasons.py +++ b/tests/test_dashboard_reasons.py @@ -35,7 +35,7 @@ def test_only_configured_library_checkout_is_release_red(): assert all(e["state"] == "warn" and not e["affects_release"] for e in (other, ws)) assert v["red_reasons"] == ["LibA: 2 commit(s) behind origin"] blocker = next(e for e in b.blockers if e["severity"] == "red") - assert "pull --ff-only" in blocker["prompt"] and "/bug" not in blocker["prompt"] + assert "pull --ff-only" in blocker["prompt"] and "Use the bug skill." not in blocker["prompt"] assert "not a task worktree" in blocker["prompt"] assert blocker["run_url"] is None @@ -74,7 +74,7 @@ def test_dirty_and_branch_remedies_are_checkout_diagnostics(): reasons = [r for r in b.blockers if r["severity"] == "red"] assert len(reasons) == 2 assert all(r["command"] == "pyauto-heart fix dirty LibA" for r in reasons) - assert all(r["prompt"].startswith("/health") for r in reasons) + assert all(r["prompt"].startswith("Use the health skill.") for r in reasons) def test_fix_dirty_on_clean_wrong_branch_emits_preserving_plan(monkeypatch, capsys, tmp_path): @@ -142,8 +142,8 @@ def test_validation_actions_and_json_contract_remain_separate(): b, v = board_for({}, test_run={"ready": False, "failed": 1}, validation_report={"release_ready": False, "stages": {"integrate": {"status": "fail"}}}) sections = {s.key: s for s in b.sections} - assert sections["test_run"].action["payload"].startswith("/health") - assert sections["release_validation"].action["payload"].startswith("/release") + assert sections["test_run"].action["payload"].startswith("Use the health skill.") + assert sections["release_validation"].action["payload"].startswith("Use the release skill.") payload = dashboard.to_dict(b) assert payload["penalties"] == v["penalties"] assert all("entries" not in blocker for blocker in payload["blockers"]) diff --git a/tests/test_dashboard_timings.py b/tests/test_dashboard_timings.py index bb6e967a..09f79b7e 100644 --- a/tests/test_dashboard_timings.py +++ b/tests/test_dashboard_timings.py @@ -129,3 +129,25 @@ def test_zero_run_ci_is_information_and_not_a_passing_gate(): section = _section(board, "ci_timing") assert section.state == dashboard.INFO assert "Median unavailable" in section.timing_html + + +def test_legacy_timing_prompt_conversion_preserves_evidence_and_commands(): + from heart.dashboard import _portable_cached_prompts + snapshot = {"ci_timing": {"gates": [{"prompt": "/bug CI slow\nKeep edits.", + "command": "/bug", "median_s": 91}]}} + converted = _portable_cached_prompts(snapshot) + row = converted["ci_timing"]["gates"][0] + assert row["prompt"] == "Use the bug skill. CI slow\nKeep edits." + assert row["command"] == "/bug" + assert row["median_s"] == 91 + assert snapshot["ci_timing"]["gates"][0]["prompt"].startswith("/bug") + + +def test_legacy_devbox_actions_only_convert_prompt_payloads(): + from heart.dashboard import _portable_cached_prompts + entries = [{"action": {"kind": "prompt", "payload": "/health Inspect CI"}}, + {"action": {"kind": "command", "payload": "/health Inspect CI"}}] + converted = _portable_cached_prompts({"entries": entries})["entries"] + assert converted[0]["action"]["payload"] == "Use the health skill. Inspect CI" + assert converted[1] == entries[1] + assert entries[0]["action"]["payload"] == "/health Inspect CI" diff --git a/tests/test_no_run_census.py b/tests/test_no_run_census.py index e7204b4a..178a96dd 100644 --- a/tests/test_no_run_census.py +++ b/tests/test_no_run_census.py @@ -93,28 +93,28 @@ def test_measured_flag_lands_on_the_row(): def test_unmeasured_slow_prompt_is_exact(): assert _rows()["imaging/slow_capped.py"]["prompt"] == ( - "/bug no_run: RepoA imaging/slow_capped.py SLOW since 2026-07-14 with no " + "Use the bug skill. no_run: RepoA imaging/slow_capped.py SLOW since 2026-07-14 with no " "measurement — retime against the real cap, then fix it or delete the marker" ) def test_undated_unmeasured_slow_says_unknown_date(): assert _rows()["imaging/slow_undated.py"]["prompt"] == ( - "/bug no_run: RepoA imaging/slow_undated.py SLOW since unknown date with no " + "Use the bug skill. no_run: RepoA imaging/slow_undated.py SLOW since unknown date with no " "measurement — retime against the real cap, then fix it or delete the marker" ) def test_measured_slow_prompt_is_exact(): assert _rows()["imaging/slow_measured.py"]["prompt"] == ( - "/bug no_run: RepoA imaging/slow_measured.py SLOW since 2026-07-14 — " + "Use the bug skill. no_run: RepoA imaging/slow_measured.py SLOW since 2026-07-14 — " "takes 233.7s, over the 300s cap" ) def test_needs_fix_prompt_is_exact(): assert _rows()["imaging/broken.py"]["prompt"] == ( - "/bug no_run: RepoA imaging/broken.py NEEDS_FIX since 2026-07-14 — " + "Use the bug skill. no_run: RepoA imaging/broken.py NEEDS_FIX since 2026-07-14 — " "raises on the new API. Reproduce before fixing: stale markers have " "evaporated before" ) diff --git a/tests/test_smoke_timings.py b/tests/test_smoke_timings.py index 2fce9a5f..43d726b2 100644 --- a/tests/test_smoke_timings.py +++ b/tests/test_smoke_timings.py @@ -247,7 +247,7 @@ def test_a_timeout_becomes_an_event_with_its_own_prompt(tmp_path): assert event["kind"] == "timeout" and event["entry"] == "imaging/slow.py" assert event["run_url"] == RUN_URL and event["cap_s"] == 600.0 assert event["prompt"] == ( - f"/bug kill timer: {REPO} imaging/slow.py TIMEOUT (600s) on {RUN_URL} " + f"Use the bug skill. kill timer: {REPO} imaging/slow.py TIMEOUT (600s) on {RUN_URL} " f"— stack tail in the run log" ) # A killed entry has no duration, so it is an event and NOT a timed row. @@ -256,7 +256,7 @@ def test_a_timeout_becomes_an_event_with_its_own_prompt(tmp_path): def test_a_timeout_without_a_cap_still_prompts(): assert smt.timeout_prompt(REPO, "imaging/x.py", None, RUN_URL).startswith( - f"/bug kill timer: {REPO} imaging/x.py TIMEOUT (?s) on ") + f"Use the bug skill. kill timer: {REPO} imaging/x.py TIMEOUT (?s) on ") def _prev_board(rows): @@ -317,7 +317,7 @@ def test_aggregate_flags_a_slowed_row_with_its_prompt(tmp_path): assert row["prev_s"] == 10.0 and row["prev_run_id"] == 6 assert row["run_id"] == 7 and row["run_url"] == RUN_URL assert row["prompt"] == ( - f"/bug slow script: {REPO} imaging/x.py 10s → 30s between runs " + f"Use the bug skill. slow script: {REPO} imaging/x.py 10s → 30s between runs " f"{PREV_RUN_URL} → {RUN_URL}" ) assert roll["slowed"] == [row]