fix(agent-pool): tick falhava em ERR_MODULE_NOT_FOUND (dotenv) (#72)

Os scripts do pool NAO sao dependency-free: agent-pool.mjs -> agent-github.mjs
-> scripts/lib/cli.mjs -> dotenv. O workflow agora instala deps como os irmaos
(pnpm/action-setup + cache + pnpm install --frozen-lockfile). Guard adicional:
pull_request closed sem merge nao dispara o tick (ruido em todo PR de stage).

Verificado localmente: o script carrega e para na leitura estrita de variables
(fail-closed desenhado; em GHA o GITHUB_TOKEN tem actions:write).

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
Francisco Solla 2026-07-30 23:41:59 -03:00 committed by GitHub
parent b2b11c3dfe
commit f357fcd780
2 changed files with 12 additions and 5 deletions

View file

@ -51,13 +51,18 @@ jobs:
tick:
runs-on: ubuntu-latest
timeout-minutes: 10
# pull_request closed WITHOUT merge is not a replenish signal — skip.
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
# The pool scripts are dependency-free .mjs (gh CLI + native fetch) — no
# pnpm install, ticks stay under a minute.
cache: pnpm
# The pool scripts import scripts/lib/cli.mjs (dotenv) via agent-github —
# they are NOT dependency-free, so install like every sibling workflow.
- run: pnpm install --frozen-lockfile
- name: agent:pool workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -65,7 +70,7 @@ jobs:
ACTION: ${{ inputs.action }}
MAX_SLOTS: ${{ inputs.maxSlots }}
run: |
# schedule / pull_request closed → reconcile tick; dispatch → the chosen action.
# schedule / pull_request merged → reconcile tick; dispatch → the chosen action.
if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
args=(--action "$ACTION" --actor "$GITHUB_ACTOR")
if [ -n "$MAX_SLOTS" ]; then args+=(--max-slots "$MAX_SLOTS"); fi

View file

@ -229,8 +229,10 @@ Parâmetros (só relevantes ao backoff de retry de tick): `spawnRetryBackoff = p
## 6. API de controle
`pnpm agent:pool -- < comando >` → `scripts/agent-pool.mjs` (Node 24, zero deps npm: `gh` CLI +
`fetch` nativo; roda no runner GHA sem `pnpm install`):
`pnpm agent:pool -- < comando >` → `scripts/agent-pool.mjs` (Node 24; `gh` CLI + `fetch` nativo,
mas com a dependência transitiva habitual de `scripts/lib/cli.mjs` → `dotenv` — o workflow instala
deps como os workflows irmãos; corrigido em 2026-07-31 após o ERR_MODULE_NOT_FOUND da primeira
ativação):
| Comando | Faz |
| ----------------------- | ------------------------------------------------------------------------------------------------------ |