s/b: poll for session directory after creation

FUSE entry cache may not reflect the new session directory immediately
after the write to s/new returns. Poll until it appears, mirroring the
approach in s/sh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-24 09:17:41 +02:00
parent 00155f28fc
commit 9e26eb0375
1 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,11 @@ backend=${backend}"
model=${model}"
printf '%s\n' "$kv" > "$MOUNT/s/new" || die "failed to create session"
# Poll until the session directory is visible (FUSE entry cache may lag).
local deadline=$(( $(date +%s) + 5 ))
until [ -d "$B" ] || [ "$(date +%s)" -ge "$deadline" ]; do sleep 0.05; done
[ -d "$B" ] || die "timeout waiting for session $id"
printf '%s\n' "$prompt" > "$B/prompt" || die "failed to submit prompt"
if [ "$bg" -eq 1 ]; then