Skip to content

Commit 8cb8032

Browse files
committed
fix: strip PID field from awk fallback output on bash < 4
The jq batch cache writes lines as PID<US>session_id<US>model<US>env. The bash >= 4 associative array path correctly uses PID as the key and stores only the remaining fields. The bash < 4 awk fallback returned the full line including PID, causing session_id to contain the PID, model to contain the session UUID, etc. Fix the awk command to print only fields 2..NF, matching the output shape of the associative array code path. Fixes #13
1 parent 6be6d82 commit 8cb8032

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/save-assistant-sessions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ resolve_pane_candidates() {
348348
if [ "$has_assoc_cache" -eq 1 ]; then
349349
cached="${STATE_CACHE[$cand_pid]:-}"
350350
elif [ -s "$state_cache_file" ]; then
351-
cached=$(awk -F"$us" -v p="$cand_pid" '$1 == p {print; exit}' "$state_cache_file")
351+
cached=$(awk -F"$us" -v p="$cand_pid" '$1 == p {for(i=2;i<=NF;i++) printf "%s%s",$i,(i<NF?FS:""); print ""; exit}' "$state_cache_file")
352352
fi
353353
if [ -n "$cached" ]; then
354354
cached_sid="${cached%%"$us"*}"

0 commit comments

Comments
 (0)