From b9b9b0496125006e6e30c3b3760cf0999cd88d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Ign=C3=A1cio=20Fontoura=20Solla?= Date: Sat, 1 Aug 2026 21:50:28 -0300 Subject: [PATCH] Raise agent pool default concurrent slots from 5 to 12. Aligns with Pro+ cloud agent capacity; start always writes POOL_MAX_SLOTS and hard cap moves to 16. --- .cursor/skills/agent-pool/SKILL.md | 8 ++++---- .github/workflows/agent-pool.yml | 2 +- docs/plans/agent-pool-orchestrator.md | 10 +++++----- scripts/agent-pool.mjs | 8 ++++++-- scripts/lib/agent-pool-state.mjs | 8 ++++---- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.cursor/skills/agent-pool/SKILL.md b/.cursor/skills/agent-pool/SKILL.md index 477ddd46..92ad7977 100644 --- a/.cursor/skills/agent-pool/SKILL.md +++ b/.cursor/skills/agent-pool/SKILL.md @@ -11,7 +11,7 @@ description: >- # Agent pool — operação do supervisor remoto -O pool mantém até **5 Cursor Cloud Agents** (configurável, máx 8) rodando `work-issue` sobre Issues `ready` elegíveis para autonomia. O supervisor é **determinístico** (não é um agente): workflow **`.github/workflows/agent-pool.yml`** (tick stateless a cada 10 min + a cada merge em `main` + sob dispatch) rodando `scripts/agent-pool.mjs`. Arquitetura e elegibilidade: `docs/plans/agent-pool-orchestrator.md`. +O pool mantém até **12 Cursor Cloud Agents** (configurável, máx 16) rodando `work-issue` sobre Issues `ready` elegíveis para autonomia. O supervisor é **determinístico** (não é um agente): workflow **`.github/workflows/agent-pool.yml`** (tick stateless a cada 10 min + a cada merge em `main` + sob dispatch) rodando `scripts/agent-pool.mjs`. Arquitetura e elegibilidade: `docs/plans/agent-pool-orchestrator.md`. **O pool NUNCA deploya** — deploy gated fica em `ci.yml` após merge em `main`. @@ -39,7 +39,7 @@ Apresente, nesta ordem: 1. **Estado do pool** — `desligado` | `ligado` | `pausado`; `maxSlots`; `startedAt`/`startedBy` se houver; slots `ocupados/max`. 2. **Workers ativos** (se houver) — Issue #N, URL do agente, classificação do tick (ocupado / auto-merge / …). 3. **Fila elegível** (`isAutonomousClaimable`, mesma ordem do claim) — lista completa ou as primeiras ~15 se longa. -4. **Próximas N em paralelo** — destaque as primeiras **`maxSlots`** (default **5**) entradas da fila elegível: são as que o próximo tick claimaria/spawnaria ao ligar (ou no tick seguinte se já ligado com gap). Inclua `#`, id, `model:`, título. +4. **Próximas N em paralelo** — destaque as primeiras **`maxSlots`** (default **12**) entradas da fila elegível: são as que o próximo tick claimaria/spawnaria ao ligar (ou no tick seguinte se já ligado com gap). Inclua `#`, id, `model:`, título. 5. **Exclusões relevantes** — `needs:consent` / `blocked` / deps / `migration-busy` (não precisam da lista inteira se for barulho; cite as que o humano costuma achar “por que não entrou”). ### Confirmação de start (pool desligado) @@ -79,7 +79,7 @@ Pergunte de forma explícita, por exemplo: ## Operação remota (canal canônico = workflow_dispatch) ```bash -pnpm agent:pool -- start # liga (default 5 slots) — só após confirmação no fluxo acima +pnpm agent:pool -- start # liga (default 12 slots) — só após confirmação no fluxo acima pnpm agent:pool -- start -- --max-slots 3 pnpm agent:pool -- stop # para de spawnar; ativos drenam até o merge pnpm agent:pool -- pause # audit solitário / manutenção @@ -112,4 +112,4 @@ Os wrappers disparam `gh workflow run agent-pool.yml -f action=…`; acompanhe c ## Se algo quebrar - `tick` vermelho no Actions: ler o log do job — gh sem `actions:write` (permissões do workflow), `CURSOR_API_KEY` ausente/errada, ou API da Cursor fora. O tick seguinte re-tenta; nada fica em estado intermediário perigoso (claim revertido em falha de spawn). -- "You’ve reached the limit" no spawn: arquivar agents antigos em cursor.com/agents (cap do plano: 8 simultâneos no Pro; o pool usa ≤5 para deixar margem a humanos). +- "You’ve reached the limit" no spawn: arquivar agents antigos em cursor.com/agents (cap do plano Cursor por tier; o pool default é 12). diff --git a/.github/workflows/agent-pool.yml b/.github/workflows/agent-pool.yml index cc17b58f..8f4a16dd 100644 --- a/.github/workflows/agent-pool.yml +++ b/.github/workflows/agent-pool.yml @@ -33,7 +33,7 @@ on: - tick - status maxSlots: - description: 'Slots simultâneos (só com action=start; default 5, máx 8)' + description: 'Slots simultâneos (só com action=start; default 12, máx 16)' required: false type: string diff --git a/docs/plans/agent-pool-orchestrator.md b/docs/plans/agent-pool-orchestrator.md index 57719820..e7e12ace 100644 --- a/docs/plans/agent-pool-orchestrator.md +++ b/docs/plans/agent-pool-orchestrator.md @@ -1,6 +1,6 @@ --- name: Agent pool orchestrator -overview: 'Supervisor remoto stateless (GitHub Actions tick) que mantém até 5 Cursor Cloud Agents rodando work-issue sobre Issues ready; claim coordenado pelo supervisor, modelo da Issue no spawn, estado em repo variables + derivação; promote stage→main continua humano.' +overview: 'Supervisor remoto stateless (GitHub Actions tick) que mantém até 12 Cursor Cloud Agents rodando work-issue sobre Issues ready; claim coordenado pelo supervisor, modelo da Issue no spawn, estado em repo variables + derivação; promote stage→main continua humano.' todos: - id: fase0-spike content: 'Spike API Cursor: GET /v1/models, spawn com model explícito, agentId idempotente, boot real' @@ -24,7 +24,7 @@ isProject: false ## 1. Resumo executivo -Um **supervisor remoto stateless** mantém até **5 Cursor Cloud Agents** em paralelo, cada um +Um **supervisor remoto stateless** mantém até **12 Cursor Cloud Agents** em paralelo, cada um executando `work-issue` sobre uma GitHub Issue `ready` e elegível para autonomia. O supervisor é um **workflow do GitHub Actions** (`.github/workflows/agent-pool.yml`) que roda `node scripts/agent-pool.mjs tick` a cada 10 minutos, a cada merge em `stage`, e sob @@ -62,7 +62,7 @@ flowchart TB Tick <--> Derive end - subgraph workers [Workers — Cursor Cloud Agents, cap 5] + subgraph workers [Workers — Cursor Cloud Agents, cap 12] Spawn["POST /v1/agents — prompt work-issue + model da Issue"] W["worker × N: claim pré-feito → implementa → PR base stage → watch CI até merge"] Spawn --> W @@ -78,7 +78,7 @@ flowchart TB Cada tick é um job curto (< 2 min) e idempotente que executa, nesta ordem: -1. **Lê config** — repo variables: `POOL_ENABLED`, `POOL_MAX_SLOTS` (default 5), `POOL_PAUSED`, +1. **Lê config** — repo variables: `POOL_ENABLED`, `POOL_MAX_SLOTS` (default 12), `POOL_PAUSED`, `POOL_STARTED_AT`, `POOL_STARTED_BY`. 2. **Sai cedo** se `POOL_ENABLED != true` ("pool desligado") ou `POOL_PAUSED == true` ("pausado — audit solitário"). @@ -129,7 +129,7 @@ O step "set/get variables" usa `gh variable` com `GITHUB_TOKEN` e `permissions: ```bash # start (qualquer máquina/phone com gh auth; também via browser Actions → Run workflow) -gh workflow run agent-pool.yml -f action=start # maxSlots default 5 +gh workflow run agent-pool.yml -f action=start # maxSlots default 12 gh workflow run agent-pool.yml -f action=start -f maxSlots=3 # stop (para de spawnar; ativos drenam naturalmente até o merge) diff --git a/scripts/agent-pool.mjs b/scripts/agent-pool.mjs index baaa43bd..ab73451e 100644 --- a/scripts/agent-pool.mjs +++ b/scripts/agent-pool.mjs @@ -2,7 +2,7 @@ * `pnpm agent:pool` — agent pool supervisor CLI * (docs/plans/agent-pool-orchestrator.md). * - * The pool keeps up to POOL_MAX_SLOTS (default 5) Cursor Cloud Agents running + * The pool keeps up to POOL_MAX_SLOTS (default 12) Cursor Cloud Agents running * work-issue over `ready` autonomous-eligible issues. The supervisor is * REMOTE: a stateless GitHub Actions tick (`.github/workflows/agent-pool.yml`) * runs `workflow --action …` / `tick --live`; humans drive it via @@ -62,6 +62,7 @@ import { decidePoolAutoStop, parsePoolConfig, parsePoolEvents, + POOL_DEFAULT_MAX_SLOTS, POOL_OCCUPIED_CLASSES, POOL_VARIABLE_NAMES, reconcilePoolClaims, @@ -430,7 +431,10 @@ const runWorkflow = async ({ action, actor, maxSlots }) => { writePoolVariable(POOL_VARIABLE_NAMES.startedAt, now) writePoolVariable(POOL_VARIABLE_NAMES.startedBy, actor || 'desconhecido') writePoolVariable(POOL_VARIABLE_NAMES.paused, 'false') - if (maxSlots) writePoolVariable(POOL_VARIABLE_NAMES.maxSlots, String(maxSlots)) + writePoolVariable( + POOL_VARIABLE_NAMES.maxSlots, + String(maxSlots ? Number.parseInt(maxSlots, 10) : POOL_DEFAULT_MAX_SLOTS), + ) log(`pool ligado por ${actor ?? '?'} (${now})`) await runTick({ dryRun: false }) return diff --git a/scripts/lib/agent-pool-state.mjs b/scripts/lib/agent-pool-state.mjs index 36e52b30..a6ff049f 100644 --- a/scripts/lib/agent-pool-state.mjs +++ b/scripts/lib/agent-pool-state.mjs @@ -17,10 +17,10 @@ export const POOL_VARIABLE_NAMES = { startedBy: 'POOL_STARTED_BY', } -export const POOL_DEFAULT_MAX_SLOTS = 5 -// Cursor Pro allows 8 concurrent cloud agents (plan §14); the pool leaves the -// remaining slots for human sessions. -export const POOL_HARD_MAX_SLOTS = 8 +export const POOL_DEFAULT_MAX_SLOTS = 12 +// Pro+ / Ultra allow more than Pro's 8 concurrent cloud agents; hard cap is a +// pool safety rail, not the Cursor plan limit. +export const POOL_HARD_MAX_SLOTS = 16 /** * @param {Record} [vars] raw `gh api` variable map