#!/usr/bin/env bash # The Port's standing asks, from THEIR branch, fetched live. # # Why this exists: `BLOCKED.md` is the Port's standing ask list and it is not in # the Decoder's loop brief, which the file itself records as having cost three # sessions. The brief DOES force `docs/port/HANDOFF.md` to be read every # iteration, and HANDOFF is the Decoder's to write — so a pointer there routes # the asks into a file that must already be opened. Agreed as R11/§6 of # docs/agents/RETRO-2026-08-31.md. # # R11 — a cross-agent pointer must FAIL LOUDLY when it goes stale. Every # staleness incident on this project has been silent. This names a branch ref, # and a renamed branch would otherwise degrade the pointer to nothing. So: # missing remote, missing ref and missing file are each a non-zero exit with a # message, never an empty stdout. set -u REMOTE="${PEER_REMOTE:-origin}" REF="${PEER_REF:-$REMOTE/auto/port-p6-audio}" FILE="${PEER_FILE:-docs/port/BLOCKED.md}" git -C /work fetch "$REMOTE" -q 2>/dev/null || { echo "peer_asks: cannot fetch '$REMOTE' — the pointer is stale, not empty." >&2; exit 2; } git -C /work rev-parse --verify --quiet "$REF" >/dev/null || { echo "peer_asks: ref '$REF' does not exist. The Port's branch was renamed or deleted." >&2 echo " branches seen on '$REMOTE':" >&2 git -C /work branch -r --list "$REMOTE/*" | sed 's/^/ /' >&2 echo " fix the ref in this script and in docs/port/HANDOFF.md — do not ignore this." >&2 exit 3; } # ⚠️ Existence is checked with `cat-file -e` and the content is then `exec`d. # The obvious form -- `git show ... || { echo "missing"; exit 4; }` -- was written # first and is WRONG: piping this script into `head` closes the pipe, `git show` # dies of SIGPIPE, and the fallback fires, printing "the file is missing" for a # file that had just been printed in full. An error path that fires on success is # worth no more than one that never fires. git -C /work cat-file -e "$REF:$FILE" 2>/dev/null || { echo "peer_asks: '$FILE' is not in $REF. It was renamed or removed." >&2; exit 4; } exec git -C /work show "$REF:$FILE"