Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(tests): discover all briefing handoff hook scripts in test_lib.sh (#1748)

Felipe Neves Ricardo5157f68d17bc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd6e0f13..691ae003 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,13 @@ version in [`docs/changelog/`](docs/changelog/):
## [Unreleased]
+### Fixed
+
+- Hook test suite (`tests/hooks/test_lib.sh`) now discovers all hook scripts
+ calling `ai_memory_briefing_qs` across `hooks/*/*.sh`, expanding briefing
+ opt-in test coverage to `antigravity-cli/pre-invocation.sh`,
+ `grok/post-tool-use.sh`, and `kimi-code/user-prompt-submit.sh` (#1748).
+
## [3.2.6] - 2026-10-26
### Fixed
diff --git a/tests/hooks/test_lib.sh b/tests/hooks/test_lib.sh
index 611037c5..577b90cc 100755
--- a/tests/hooks/test_lib.sh
+++ b/tests/hooks/test_lib.sh
@@ -1147,42 +1147,42 @@ mkdir -p "$BRIEF_REPO" "$PLAIN_REPO"
printf '[briefing]\ninject_on_session_start = true\nmax_chars = 6000\n' >"$BRIEF_REPO/.ai-memory.toml"
printf '[briefing]\ninject_on_session_start = false\nmax_chars = 6000\n' >"$PLAIN_REPO/.ai-memory.toml"
-# Runs bundle "$1" from repository "$2" with a fresh state dir and prints the
+# Runs script "$1" from repository "$2" with a fresh state dir and prints the
# handoff GET it sent. The payload carries every cwd and session field the
# bundles read, plus Antigravity's first-invocation marker.
session_start_handoff_get() {
rm -rf "$TMP/brief-data" "$FAKE_CURL_LOG"
- printf '{"cwd":"%s","workspacePaths":["%s"],"invocationNum":0,"session_id":"brief-s","conversationId":"brief-s"}' "$2" "$2" \
+ printf '{"cwd":"%s","workspacePaths":["%s"],"invocationNum":0,"session_id":"brief-s","conversationId":"brief-s","prompt":"continue","tool_name":"read_file","tool_input":{}}' "$2" "$2" \
| PATH="$FAKE_CURL_BIN:$PATH" AI_MEMORY_CURL_LOG="$FAKE_CURL_LOG" \
AI_MEMORY_DATA_DIR="$TMP/brief-data" AI_MEMORY_HOOK_URL='http://memory.test' \
- sh "$(dirname "$0")/../../hooks/$1/session-start.sh" >/dev/null 2>&1
+ sh "$1" >/dev/null 2>&1
grep '/handoff?' "$FAKE_CURL_LOG" 2>/dev/null || true
}
-BRIEF_BUNDLES=0
-for script in "$(dirname "$0")"/../../hooks/*/session-start.sh; do
- grep -q 'ai_memory_get_handoff' "$script" || continue
- bundle=$(basename "$(dirname "$script")")
- BRIEF_BUNDLES=$((BRIEF_BUNDLES + 1))
- GET=$(session_start_handoff_get "$bundle" "$BRIEF_REPO")
+BRIEF_SCRIPTS=0
+for script in "$(dirname "$0")"/../../hooks/*/*.sh; do
+ grep -q 'ai_memory_briefing_qs' "$script" || continue
+ name="$(basename "$(dirname "$script")")/$(basename "$script")"
+ BRIEF_SCRIPTS=$((BRIEF_SCRIPTS + 1))
+ GET=$(session_start_handoff_get "$script" "$BRIEF_REPO")
case "$GET" in
*'&briefing=true&briefing_budget=6000'*)
- PASS=$((PASS + 1)); printf ' ok %s\n' "$bundle: opted-in handoff GET carries the briefing keys" ;;
- *) FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-in handoff GET carries the briefing keys\n got =%s\n' "$bundle" "$GET" ;;
+ PASS=$((PASS + 1)); printf ' ok %s\n' "$name: opted-in handoff GET carries the briefing keys" ;;
+ *) FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-in handoff GET carries the briefing keys\n got =%s\n' "$name" "$GET" ;;
esac
- GET=$(session_start_handoff_get "$bundle" "$PLAIN_REPO")
+ GET=$(session_start_handoff_get "$script" "$PLAIN_REPO")
case "$GET" in
*'/handoff?'*briefing*)
- FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-out handoff GET omits the briefing keys\n got =%s\n' "$bundle" "$GET" ;;
+ FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-out handoff GET omits the briefing keys\n got =%s\n' "$name" "$GET" ;;
*'/handoff?'*)
- PASS=$((PASS + 1)); printf ' ok %s\n' "$bundle: opted-out handoff GET omits the briefing keys" ;;
- *) FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-out session start still fetches the handoff\n got =%s\n' "$bundle" "$GET" ;;
+ PASS=$((PASS + 1)); printf ' ok %s\n' "$name: opted-out handoff GET omits the briefing keys" ;;
+ *) FAIL=$((FAIL + 1)); printf ' FAIL %s: opted-out session start still fetches the handoff\n got =%s\n' "$name" "$GET" ;;
esac
done
# Guards the discovery itself: an empty glob or a renamed helper would
# otherwise pass with nothing checked.
-assert_eq "session-start bundles that fetch the handoff were found" "yes" \
- "$([ "$BRIEF_BUNDLES" -ge 9 ] && printf 'yes' || printf 'no (%s)' "$BRIEF_BUNDLES")"
+assert_eq "scripts that fetch the handoff with briefing were found" "yes" \
+ "$([ "$BRIEF_SCRIPTS" -ge 12 ] && printf 'yes' || printf 'no (%s)' "$BRIEF_SCRIPTS")"
# --- a handoff is never claimed without a project directory -------------
# `GET /handoff` claims the newest open handoff in whatever project the server