From 7444f6a4ced97f2720b03107763b9f018b543d8b Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 3 Nov 2026 08:13:52 +0000 Subject: [PATCH] fix: a SESSION_ID without urandom falls back to the start's pid, so two same-second runs keep separate lease entries (GST-1205 review round 2) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- bin/gstack-skill-start | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/gstack-skill-start b/bin/gstack-skill-start index da94d8868..aca52a879 100755 --- a/bin/gstack-skill-start +++ b/bin/gstack-skill-start @@ -234,9 +234,10 @@ _TEL_PROMPTED=$([ -f "$_GH/.telemetry-prompted" ] && echo "yes" || echo "no") _TEL_START=$(date +%s) # PID+epoch alone is guessable; a random suffix makes the block-binding token # unforgeable by content reflected into the same tool result. Falls back to -# the plain form when urandom is unavailable. +# this process's pid when urandom is unavailable, so two same-second starts +# never share a SESSION_ID (it also keys their lease runs, GST-1205). _SID_RAND=$(od -An -N4 -tx4 /dev/urandom 2>/dev/null | tr -d ' \n' || true) -_SESSION_ID="$PARENT_PID-$_TEL_START${_SID_RAND:+-$_SID_RAND}" +_SESSION_ID="$PARENT_PID-$_TEL_START-${_SID_RAND:-$$}" # The install-scoped twin (bin/gstack-lease): what bin/gstack-upgrade reads # before moving a checkout other sessions share. This run holds it until # gstack-skill-end releases its SESSION_ID (GST-1205). Fail-open, but a lease