docs(ST-qfpqpxzy): worker-quota-probe.sh + uitgebreide pre-flight runbook + architectuurdoc

- scripts/worker-quota-probe.sh: curl-probe die rate-limit-headers parset en { remaining, limit, pct, reset_at_iso } JSON retourneert
- mcp-integration.md: pre-flight sectie uitgebreid met bash-script voorbeeld, retry-strategie (sleep tot reset+5s), bekende beperking
- claude-question-channel.md: M13 quota-gate flow diagram + pre-flight loop uitleg

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scrum4Me Agent 2026-05-06 03:55:58 +02:00
parent 661601e833
commit bc6936159d
3 changed files with 96 additions and 26 deletions

View file

@ -75,5 +75,27 @@ weert).
Dit patroon (notification-channel via een bestaande pg_notify-stream) is
herbruikbaar — zie `docs/patterns/claude-question-channel.md`.
## Worker quota-gate flow (M13)
De `worker_heartbeat` MCP-tool gebruikt hetzelfde `scrum4me_changes`-kanaal met een nieuw event-type `worker_heartbeat`:
```
Worker scrum4me-mcp Postgres SSE-route NavBar
| | | | |
|--worker_heartbeat(15,low)-->| | | |
| |--pg_notify('scrum4me_changes', {type:'worker_heartbeat',is_low:true})-->|
| | | |--data:{...}---->|
| | | | |--stand-by badge
```
**Pre-flight loop** (vóór elke `wait_for_job`):
1. `get_worker_settings``min_quota_pct`
2. `bash scripts/worker-quota-probe.sh``{ pct, reset_at_iso }`
3. `worker_heartbeat(last_quota_pct, last_quota_check_at, is_low = pct < min_quota_pct)`
4. Als `is_low`: log "wachten tot quota-reset om HH:MM", slaap tot `reset_at_iso + 5s`, herhaal stap 2
5. Anders: `wait_for_job` aanroepen
De solo-store houdt `lowQuotaTokenIds: Set<string>` bij. De NavBar toont een stand-by badge wanneer `lowQuotaTokenIds.size >= connectedWorkers && connectedWorkers > 0`.
---