#!/bin/bash
# usage: retest.sh <prompt> <tag>; runs writers in both repos, prints the attribution line found
P=$1; T=$2; R=/tmp/issue-lead-26892-r1/repro
run() { local d=$1 w=$2 i=$3 out="$R/$T-$w-$d-$i.txt"
  if [ $w = pi ]; then (cd $R/$d && timeout 240 pi --no-extensions --model anthropic/claude-opus-5 -p "$(cat $P)" > $out 2>&1)
  else (cd $R/$d && timeout 240 opencode run -m anthropic/claude-haiku-5-5 "$(cat $P)" > $out 2>&1); fi
  echo "$w $d #$i exit=$? :: $(grep -oiE '[^\\"]*(model:|harness|claude-opus|claude-haiku)[^\\"]*' $out | head -1)"; }
for d in repo-norule repo; do for w in pi opencode; do for i in 1 2; do run $d $w $i & done; done; done; wait
