Files
coucou/scripts/test-approval-queue.sh
T
ClaudeandMydao57 e391a142c9 Permission requests queue up instead of pushing each other away
When two sessions or agents asked for permission at once, the second
request answered "ask" to the first and sent it back to its terminal.
Requests now wait in line (ApprovalQueue from #157 by @Mydao57, up to 5;
past that the newest goes back to its terminal). The card shows the
oldest, with "1/N" next to "needs permission" while others wait, and
names the project of the session that asks. A click answers the request
that was on screen and is ignored if the card has moved on, so it can
never approve the next one. Each request keeps its own hang-up monitor
and 115 s timeout, and is settled by its own session's events.

Events from other sessions on the same pill are no longer dropped while
a request waits (only the asking session's are held back), so a sibling
session's Stop or SessionEnd is not lost; the pill keeps its approval
state meanwhile. The iPhone relay answers the request it was shown.

Co-Authored-By: Mydao57 <150259698+Mydao57@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-10-11 22:57:16 +02:00

9 lines
320 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-approval-queue.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc NotchBuddy/Sources/App/ApprovalQueue.swift \
tests/ApprovalQueueTests.swift -o "$TEST_DIR/approval-queue-tests"
"$TEST_DIR/approval-queue-tests"