fix(banner): drop stale passive-cost constants and the budget row

The banner, plugin-advisor and status-reporter kept hand-copied token
costs (gstack 2750, ui-ux 400) that the 2026-09-28 prune fixed only in
doctor.sh. The banner budget row and its now-dead detect_plan are gone;
the agents point to make doctor for the measured cost.
This commit is contained in:
bchanot committed 2026-11-10 18:00:20 +01:00
1 parent a655b06eee
commit 1971b8d0f5
6 files changed
+51 -116

No files matched your search

+1 -25
View File
@@ -4,7 +4,7 @@
# Sourced by: session-start.sh, doctor.sh, agents/status-reporter.md
#
# detect_* return 0 (detected) or 1 (not detected), silently — callers
# handle messaging. detect_plan and list_on_plugins print to stdout.
# handle messaging. list_on_plugins prints to stdout.
# ============================================================
# --- Always-on plugins ---
@@ -86,27 +86,3 @@ detect_graphifyy() {
# Graphifyy — codebase knowledge graph, installed via pipx
command -v graphify &>/dev/null
}
# --- Plan detection ---
detect_plan() {
# Detect Claude plan: max or pro.
# Never call the `claude` CLI here: it starts a session whose
# SessionStart hook calls detect_plan again (BLK-043).
# Checks ~/.claude.json for model access hints.
# Returns plan name on stdout, always exits 0.
local claude_json="$HOME/.claude.json"
if [ -f "$claude_json" ]; then
# Max plan: has opus model access or max flag
if grep -q '"planType".*"max"' "$claude_json" 2>/dev/null; then
echo "max"; return 0
fi
# Check cached features for max indicators
if grep -q '"tengu_cobalt_compass": true' "$claude_json" 2>/dev/null \
&& grep -q '"tengu_harbor": true' "$claude_json" 2>/dev/null; then
echo "max"; return 0
fi
fi
echo "pro"
}
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
# lib/tests/detect-plan.test.sh
# Regression for BLK-043: detect_plan must never call the claude CLI
# (a hook-launched claude re-enters session-start.sh: fork bomb).
# lib/tests/hook-recursion-guard.test.sh
# Regression for BLK-043: session-start.sh must guard against re-entry
# and never call the claude CLI (a hook-launched claude re-enters the
# hook: fork bomb).
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
LIB="${DETECT_PLUGINS_LIB:-$ROOT/lib/detect-plugins.sh}"
HOOK="$ROOT/hooks/session-start.sh"
WORK=$(mktemp -d) || exit 1
trap 'rm -rf "$WORK"' EXIT
@@ -17,27 +17,11 @@ check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
. "$ROOT/lib/tests/claude-stub.sh" || exit 1
claude_stub_install "$WORK"
# detect_plan, no .claude.json: pro, no claude call.
mkdir -p "$WORK/empty"
out=$(HOME="$WORK/empty" bash -c 'source "$1"; detect_plan' _ "$LIB")
check T1-no-json-plan "$out" pro
check T1-no-json-calls "$(claude_stub_calls)" 0
# detect_plan, max markers: max, no claude call.
mkdir -p "$WORK/maxhome"
printf '{"tengu_cobalt_compass": true, "tengu_harbor": true}\n' \
>"$WORK/maxhome/.claude.json"
: >"$CLAUDE_LOG"
out=$(HOME="$WORK/maxhome" bash -c 'source "$1"; detect_plan' _ "$LIB")
check T2-max-plan "$out" max
check T2-max-calls "$(claude_stub_calls)" 0
# Hook HOME: real ~/.claude entries + max fixture (no fallback needed).
# Hook HOME: real ~/.claude entries.
mkdir -p "$WORK/hookhome/.claude" "$WORK/proj"
for e in "$HOME"/.claude/*; do
ln -s "$e" "$WORK/hookhome/.claude/$(basename "$e")"
done
cp "$WORK/maxhome/.claude.json" "$WORK/hookhome/.claude.json"
# Guard: hook exits 0 silently when already running.
out=$(cd "$WORK/proj" && HOME="$WORK/hookhome" SESSION_START_RUNNING=1 \
@@ -62,5 +46,5 @@ chmod +x "$WORK/stub/git"
check T4-child-sees-guard "$(head -1 "$GIT_LOG")" 1
check T4-hook-no-claude-calls "$(claude_stub_calls)" 0
printf 'detect-plan: %d passed, %d failed\n' "$pass" "$fail"
printf 'hook-recursion-guard: %d passed, %d failed\n' "$pass" "$fail"
[ "$fail" -eq 0 ]
+18
View File
@@ -89,6 +89,10 @@ check SB3-toggle-on-uiux "$(has "$(row '🟢 ON' "$out")" ui-ux-pro-max)" 1
ok="$(row '✅ ON' "$out")"
check SB3-onrow-no-pr-review "$(has "$ok" pr-review-toolkit)" 0
# SB9: no passive-cost row and no plan budget in the banner
check SB9-no-cost-row "$(has "$out" 💰)" 0
check SB9-no-budget "$(has "$out" budget)" 0
# uiux <home> <proj>: exit status of detect_uiux_pro_max, PROFILE_PLAIN unset
uiux() {
(cd "$WORK/$2" && unset PROFILE_PLAIN && HOME="$WORK/$1" bash -c \
@@ -126,5 +130,19 @@ check SB7-empty-list-rtk-only "$ao" rtk
# SB8: no hook run of this suite called the claude CLI (BLK-043)
check SB8-no-claude-calls "$(claude_stub_calls)" 0
# SB10: no hand-copied passive-cost figure or dead plan path left
# gone <file> <regex> [filter]: 1 when no line (after the filter) matches
gone() {
if grep -v "${3:-^\$}" "$ROOT/$1" | grep -qE -- "$2"; then echo 0
else echo 1; fi
}
check SB10-hook-costs "$(gone hooks/session-start.sh \
'_plugin_costs|TOKEN_WARN|detect_plan')" 1
check SB10-lib-detect-plan "$(gone lib/detect-plugins.sh detect_plan)" 1
check SB10-reporter-const "$(gone agents/status-reporter.md \
'PLUGIN_TOKENS|~[1-9][0-9-]*t')" 1
check SB10-advisor-figures "$(gone agents/plugin-advisor.md \
'~[1-9][0-9-]*t' 'plan budget')" 1
printf 'session-banner: %d passed, %d failed\n' "$pass" "$fail"
[ "$fail" -eq 0 ]