Skip to content

Instantly share code, notes, and snippets.

@keyboardAnt
Created February 20, 2026 17:07
Show Gist options
  • Select an option

  • Save keyboardAnt/90b14e1a5dc4ade4d4c3919837aee8cc to your computer and use it in GitHub Desktop.

Select an option

Save keyboardAnt/90b14e1a5dc4ade4d4c3919837aee8cc to your computer and use it in GitHub Desktop.
single-file VS Code code:5 repro harness (Copilot Chat + Remote-SSH)
#!/usr/bin/env bash
set -euo pipefail
# Single-file repro harness for VS Code renderer crash code 5
# Usage:
# bash single_file_repro.sh start [duration_seconds]
# bash single_file_repro.sh status
# bash single_file_repro.sh stop
#
# Optional:
# CPU_BURST=1 bash single_file_repro.sh start 1800
cmd="${1:-start}"
duration="${2:-1800}"
root=".mre-single"
pid_file="$root/pids"
mkdir -p "$root" "notes"
osc_loop() {
local dur="$1"
local end=$((SECONDS + dur))
local i=0
while (( SECONDS < end )); do
i=$((i + 1))
printf '\033]0;single-mre-%06d\007' "$i"
printf '\033]8;;https://example.com/%06d\007mre-link-%06d\033]8;;\007\n' "$i" "$i"
printf '\033]633;A\007'
printf 'tick=%06d ts=%(%Y-%m-%dT%H:%M:%S%z)T payload_start\n' "$i" -1
printf '\033]633;B\007'
for j in $(seq 1 25); do
printf 'line=%06d.%02d payload=%08x%08x\n' "$i" "$j" "$RANDOM" "$RANDOM"
done
printf 'tick=%06d payload_end\n' "$i"
sleep 0.15
done
}
churn_loop() {
local dur="$1"
local end=$((SECONDS + dur))
local i=0
mkdir -p "$root/tmp" "$root/archive"
local log="$root/churn.log"
: > "$log"
while (( SECONDS < end )); do
i=$((i + 1))
local f="$root/tmp/file_$i.txt"
{
printf 'index=%d\n' "$i"
printf 'ts=%(%Y-%m-%dT%H:%M:%S%z)T\n' -1
printf 'data=%08x%08x%08x\n' "$RANDOM" "$RANDOM" "$RANDOM"
} > "$f"
cat "$f" >> "$log"
printf 'churn=%06d file=%s\n' "$i" "$f" >> "$log"
if (( i % 100 == 0 )); then
mv "$f" "$root/archive/file_$i.txt"
find "$root/tmp" -type f | head -n 20 | xargs -I{} rm -f "{}" 2>/dev/null || true
fi
sleep 0.1
done
}
cpu_loop() {
local dur="$1"
local end=$((SECONDS + dur))
while (( SECONDS < end )); do
local pids=()
for _ in $(seq 1 8); do
yes > /dev/null &
pids+=("$!")
done
sleep 2
kill "${pids[@]}" 2>/dev/null || true
wait "${pids[@]}" 2>/dev/null || true
sleep 4
done
}
start_cmd() {
if [ -f "$pid_file" ]; then
echo "Already running. Use: bash single_file_repro.sh status"
exit 1
fi
osc_loop "$duration" > "$root/osc.log" 2>&1 &
p1="$!"
churn_loop "$duration" > "$root/churn_driver.log" 2>&1 &
p2="$!"
p3=""
if [ "${CPU_BURST:-0}" = "1" ]; then
cpu_loop "$duration" > "$root/cpu_burst.log" 2>&1 &
p3="$!"
fi
printf '%s %s %s\n' "$p1" "$p2" "$p3" > "$pid_file"
cat <<EOF
Started single-file MRE load.
PIDs: $(cat "$pid_file")
Next (Copilot Chat in Agent/tool mode):
1) Run: ls -la and rg -n "tick|churn|payload" -S .
2) Run: tail -n 120 $root/churn.log
3) Edit notes/repro-note.md and re-run a search.
4) Repeat for 15-60 minutes.
Status command:
bash single_file_repro.sh status
EOF
}
status_cmd() {
if [ ! -f "$pid_file" ]; then
echo "Not running."
exit 0
fi
read -r p1 p2 p3 < "$pid_file"
for p in "$p1" "$p2" "$p3"; do
[ -z "$p" ] && continue
if kill -0 "$p" 2>/dev/null; then
echo "alive pid=$p"
else
echo "dead pid=$p"
fi
done
}
stop_cmd() {
if [ ! -f "$pid_file" ]; then
echo "Not running."
exit 0
fi
read -r p1 p2 p3 < "$pid_file"
for p in "$p1" "$p2" "$p3"; do
[ -z "$p" ] && continue
kill "$p" 2>/dev/null || true
done
rm -f "$pid_file"
echo "Stopped."
}
case "$cmd" in
start) start_cmd ;;
status) status_cmd ;;
stop) stop_cmd ;;
*)
echo "Unknown command: $cmd"
echo "Usage: bash single_file_repro.sh {start [duration]|status|stop}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment