fix(hooks): session-start memory.sh check bounded by timeout 2

An unbounded registry check could stall every session start; it now uses the digest's timeout shape. SD16 proves a hung check returns under 3.5 s.
This commit is contained in:
bchanot committed 2026-11-06 16:36:16 +01:00
1 parent 9b3961e622
commit d93f06cb9b
2 files changed
+15 -2

No files matched your search

+10
View File
@@ -195,6 +195,16 @@ check SD12-rc "$rc" 0
check SD12-banner "$(printf '%s' "$out" | grep -c 'make doctor')" 1
check SD12-no-digest "$(printf '%s' "$out" | grep -c 'memory digest:')" 0
# SD16: a memory.sh whose `check` hangs costs under 3.5 s, exit 0
printf '#!/usr/bin/env bash\ncase "$*" in *check*) sleep 10 ;; esac\n' \
> "$WORK/sd9/lib/memory.sh"
p=$(mkproj sd16)
t0=$(now_ms)
out=$(run "$p" - "$S9"); rc=$?
t1=$(now_ms)
check SD16-hang-bounded "$([ $((t1 - t0)) -lt 3500 ] && echo yes || echo no)" yes
check SD16-rc "$rc" 0
# mkhome <name> [json]: a HOME that links the real ~/.claude entries and
# holds the given memory.json (none when omitted); prints its path.
mkhome() {