Compare commits

..

3 Commits

Author SHA1 Message Date
Zamil Majdy
4787b11805 dx(orchestrate): reset poll interval when waiting_approval agents present
Sentry flagged that adaptive backoff could delay auto-approval by up to
5 minutes. Fix: treat waiting_approval agents same as active kick/recycle
events — reset to base interval (30s) immediately.
2026-04-08 09:38:02 +07:00
Zamil Majdy
5fd9f17265 dx(orchestrate): adaptive polling in run-loop — 30s base, back off to 5min when idle 2026-04-08 09:31:42 +07:00
Zamil Majdy
11f9dce1cb dx: bypass onboarding in /pr-test skill for test user
Add step 3i to the pr-test skill that calls POST /api/onboarding/step?step=VISIT_COPILOT
after login, marking onboarding as complete for test@test.com before browser tests run.
This prevents the browser from landing on the onboarding flow instead of the feature UI.
2026-04-08 09:18:20 +07:00
2 changed files with 35 additions and 4 deletions

View File

@@ -27,7 +27,9 @@ chmod +x "$STABLE_SCRIPTS_DIR"/*.sh
SCRIPTS_DIR="$STABLE_SCRIPTS_DIR"
STATE_FILE="${ORCHESTRATOR_STATE_FILE:-$HOME/.claude/orchestrator-state.json}"
POLL_INTERVAL="${POLL_INTERVAL:-30}"
POLL_INTERVAL="${POLL_INTERVAL:-30}" # base interval: 30 seconds
POLL_IDLE_MAX=300 # back off up to 5 minutes when nothing is happening
POLL_CURRENT=$POLL_INTERVAL # adaptive: starts at base, increases when idle
# ---------------------------------------------------------------------------
# update_state WINDOW FIELD VALUE
@@ -130,7 +132,7 @@ handle_approve() {
# ---------------------------------------------------------------------------
# Main loop
# ---------------------------------------------------------------------------
echo "[$(date +%H:%M:%S)] run-loop started (mechanical only, poll every ${POLL_INTERVAL}s)"
echo "[$(date +%H:%M:%S)] run-loop started (mechanical only, poll ${POLL_INTERVAL}s${POLL_IDLE_MAX}s adaptive)"
echo "[$(date +%H:%M:%S)] Supervisor: orchestrating Claude session (not a separate window)"
echo "---"
@@ -159,6 +161,16 @@ while true; do
RUNNING=$(jq '[.agents[] | select(.state | test("running|stuck|waiting_approval|idle"))] | length' \
"$STATE_FILE" 2>/dev/null || echo 0)
echo "[$(date +%H:%M:%S)] Poll — ${RUNNING} running ${KICKED} kicked ${DONE} recycled"
sleep "$POLL_INTERVAL"
echo "[$(date +%H:%M:%S)] Poll — ${RUNNING} running ${KICKED} kicked ${DONE} recycled (next in ${POLL_CURRENT}s)"
# Adaptive backoff: reset to base on activity or waiting_approval agents; back off when truly idle
WAITING=$(jq '[.agents[] | select(.state == "waiting_approval")] | length' "$STATE_FILE" 2>/dev/null || echo 0)
if (( KICKED > 0 || DONE > 0 || WAITING > 0 )); then
POLL_CURRENT=$POLL_INTERVAL
else
POLL_CURRENT=$(( POLL_CURRENT * 3 / 2 ))
(( POLL_CURRENT > POLL_IDLE_MAX )) && POLL_CURRENT=$POLL_IDLE_MAX
fi
sleep "$POLL_CURRENT"
done

View File

@@ -310,6 +310,25 @@ TOKEN=$(curl -s -X POST 'http://localhost:8000/auth/v1/token?grant_type=password
curl -H "Authorization: Bearer $TOKEN" http://localhost:8006/api/...
```
### 3i. Disable onboarding for test user
The frontend redirects to `/onboarding` when the `VISIT_COPILOT` step is not in `completedSteps`.
Mark it complete via the backend API so every browser test lands on the real feature UI:
```bash
ONBOARDING_RESULT=$(curl -s -X POST \
"http://localhost:8006/api/onboarding/step?step=VISIT_COPILOT" \
-H "Authorization: Bearer $TOKEN")
echo "Onboarding bypass: $ONBOARDING_RESULT"
# Verify it took effect
ONBOARDING_STATUS=$(curl -s \
"http://localhost:8006/api/onboarding/completed" \
-H "Authorization: Bearer $TOKEN" | jq -r '.is_completed')
echo "Onboarding completed: $ONBOARDING_STATUS"
[ "$ONBOARDING_STATUS" = "true" ] || echo "WARNING: onboarding bypass may have failed — browser tests may hit the onboarding flow"
```
## Step 4: Run tests
### Service ports reference