Reader subagents on Capy stop sending telemetry, error runs report their error class, and test fixtures stop reading the owner's settings (#4597)

On a Capy machine, a shell that never loaded gstack's launch file (such
as a review subagent's) now sends no usage data instead of falling back
to the machine setting, as the privacy doc already promised.

Error runs now fill the existing error_class field from their exit
reason, and each setup step and outcome is reported at most once a day
per install, so a loop rerunning setup no longer floods the counts.

Tests no longer inherit the owner's preferences file, skill loadout or
plugin state, which caused false failures.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/outside-voice#1 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-21 08:11:54 +00:00
1 parent 09bd0fad0f
commit 19069a9810
13 files changed
+140 -8

No files matched your search

+4 -1
View File
@@ -118,10 +118,13 @@ if [ "$_TEL" != "off" ] && [ -x "$_BIN/gstack-telemetry-log" ]; then
fi
fi ;;
esac
# error_class: an error run's exit reason, from exit_reason's own fixed list.
_ERR_CLASS=""
[ "$OUTCOME" = error ] && case "$EXIT_REASON" in blocked|tool_error|test_failed|context_limit|gave_up) _ERR_CLASS="$EXIT_REASON" ;; esac
"$_BIN/gstack-telemetry-log" \
--skill "$SKILL_NAME" --duration "$_TEL_DUR" --outcome "$OUTCOME" \
--used-browse "$USED_BROWSE" --session-id "$SESSION_ID" \
--error-message "$ERROR_MESSAGE" --failed-step "$FAILED_STEP" \
--error-class "$_ERR_CLASS" --error-message "$ERROR_MESSAGE" --failed-step "$FAILED_STEP" \
--host "$_HOST" --routing "$_ROUTING" --harness-session "$_HSESS" \
--exit-reason "$EXIT_REASON" --invoked "$INVOKED" --model-family "$MODEL_FAMILY" --checks "$CHECKS" 2>/dev/null &
fi
+11
View File
@@ -123,6 +123,17 @@ if [ "$TIER" = "off" ]; then
exit 0
fi
# One row per onboarding step and outcome per install a day: setup sends its step on
# every run, so anything rerunning ./setup in a loop repeated it hundreds of times an hour.
# The day's marker is claimed with noclobber (O_EXCL), so concurrent runs send it once.
if [ "$EVENT_TYPE" = "onboarding" ]; then
OB_NAME="$(printf '%s' "$SKILL" | tr -cd 'A-Za-z0-9_-')--$(printf '%s' "$OUTCOME" | tr -cd 'A-Za-z0-9_-')"
OB_MARKER="$ANALYTICS_DIR/.onboarding-$OB_NAME-$(date -u +%Y-%m-%d)"
mkdir -p "$ANALYTICS_DIR" 2>/dev/null
( set -C; : > "$OB_MARKER" ) 2>/dev/null || exit 0 # best-effort: another run already recorded this step today
for _ob in "$ANALYTICS_DIR"/.onboarding-"$OB_NAME"-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]; do [ "$_ob" = "$OB_MARKER" ] || rm -f "$_ob"; done
fi
# ─── Finalize stale .pending markers ────────────────────────
# Each session gets its own .pending-$SESSION_ID file to avoid races
# between concurrent sessions. Finalize any that don't match our session.
+11
View File
@@ -40,6 +40,17 @@ if [ "${1:-}" = "--capy" ] || [ "$capy" != off ]; then
echo "$capy"
exit 0
fi
# On a Capy install (gstack-capy-install's state file in this checkout's git
# dir) only the opt-in above sends: a shell that never sourced the launch file,
# such as a /ship reader subagent's, is off, never the machine setting. Both
# the logical and the physical root count: a host directory that links only
# bin/ (Codex, Factory, OpenCode, Cursor, Kiro) resolves to the checkout -P.
for _root in "$(cd "$(dirname "$0")/.." 2>/dev/null && pwd)" "$(cd -P "$(dirname "$0")/.." 2>/dev/null && pwd)"; do
if [ -n "$_root" ] && [ -f "$(git -C "$_root" rev-parse --absolute-git-dir 2>/dev/null)/gstack-capy-install.state" ]; then
echo off
exit 0
fi
done
tier=$("$(dirname "$0")/gstack-config" get telemetry 2>/dev/null || true)
case "$tier" in
anonymous|community) echo "$tier" ;;