rdev/cookbooks/trees/slackpath-2-async-worker-pipeline.yaml
jordan 62a9bbb237
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: resolve 7 root causes causing cookbook deployment failures
RC-1: Gitea org fallback already removed (no-op, confirmed)
RC-3: Push/pull now explicitly target origin main (HEAD:main) in both
  pod_git_operations.go and claudebox/git.go — fixes Woodpecker webhook
  trigger by ensuring pushes always land on the main branch
RC-4: wait_for_pipeline records baseline pipeline number before polling;
  only returns success when a NEWER pipeline completes — prevents false
  positive when a prior pipeline was already success
RC-5: Redis WRONGPASS fixed on live persona-community-5 instance; platform
  gap noted (no reprovision endpoint for Redis ACL drift)
RC-6: Removed on_error:continue from all infra provisioning steps (add-db,
  add-redis) across persona-community, slackpath-2/3/4/5 trees — infra
  failures now fail the tree instead of silently continuing to a crash
RC-7: Added .pnpm-store/ to skeleton .gitignore — prevents thousands of
  cache files being committed by agents after pnpm install
RC-2: Updated all 12 cookbook trees — git_clone_url jordan/ → threesix/
  (24 occurrences across all slackpath, aeries, full-stack, genkit trees)
Also: strings.Cut and strings.SplitSeq lint fixes in pod_git_operations.go
  and claudebox/git.go

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 18:49:09 -07:00

120 lines
3.6 KiB
YAML

name: async-worker-pipeline
description: "Slack Path 2: Background Workers. Implements Producer/Consumer pattern with Redis."
version: 1
vars:
project_name: ""
feature_slug: "async-jobs"
steps:
# --- Infrastructure ---
create-project:
action: api
method: POST
endpoint: /project
body:
name: "{{ .vars.project_name }}"
description: "Slack Path 2: Async Workers"
outputs:
- project_id: .data.name
- domain: .data.domain
add-redis:
description: Add Redis for job queue
depends_on: [create-project]
action: api
method: POST
endpoint: "/projects/{{ .outputs.create-project.project_id }}/components"
body:
type: redis
name: "job-queue"
add-components:
description: Add API + Worker atomically (single git commit)
depends_on: [create-project, add-redis]
action: api
method: POST
endpoint: "/projects/{{ .outputs.create-project.project_id }}/components/batch"
body:
components:
- type: service
name: "api"
- type: worker
name: "background-processor"
wait-infra:
depends_on: [create-project, add-components]
action: wait_pipeline
project_id: "{{ .outputs.create-project.project_id }}"
# --- Implementation ---
implement-queue:
description: "Agent implements Job Queue logic in API and Worker"
depends_on: [create-project, wait-infra]
action: api
method: POST
endpoint: "/projects/{{ .outputs.create-project.project_id }}/builds"
body:
prompt: "/implement-feature {{ .vars.feature_slug }} --requirements 'API: POST /jobs pushes JSON to Redis. Worker: Pops from Redis, simulates work, updates status. API: GET /jobs/{id} returns status.'"
auto_commit: true
auto_push: true
git_clone_url: "https://git.threesix.ai/threesix/{{ .outputs.create-project.project_id }}.git"
outputs:
- build_id: .data.task_id
wait-code:
description: Wait for agent code generation
depends_on: [implement-queue]
action: wait_build
build_id: "{{ .outputs.implement-queue.build_id }}"
max_attempts: 120
poll_interval: 5
wait-deploy:
depends_on: [create-project, wait-code]
action: wait_pipeline
project_id: "{{ .outputs.create-project.project_id }}"
# --- Verification ---
verify-service-running:
description: "Verify API service is running"
depends_on: [create-project, wait-deploy]
action: shell
command: |
DOMAIN="{{ .outputs.create-project.domain }}"
HEALTH=$(curl -s "https://$DOMAIN/api/api/health" | jq -r '.data.status // empty')
if [ "$HEALTH" == "healthy" ]; then
echo "API service healthy"
exit 0
else
echo "Fail: API service not healthy"
exit 1
fi
verify-async:
description: "Create Job -> Verify Acceptance -> Poll for Completion (optional)"
depends_on: [create-project, verify-service-running]
on_error: continue
action: shell
command: |
DOMAIN="{{ .outputs.create-project.domain }}"
# 1. Enqueue
JOB_ID=$(curl -s -X POST "https://$DOMAIN/api/jobs" -d '{"type":"image_resize"}' | jq -r .id)
echo "Job enqueued: $JOB_ID"
# 2. Poll for completion (Worker should pick it up)
for i in {1..10}; do
STATUS=$(curl -s "https://$DOMAIN/api/jobs/$JOB_ID" | jq -r .status)
echo "Job status: $STATUS"
if [ "$STATUS" == "completed" ]; then exit 0; fi
sleep 2
done
echo "Job never completed"
exit 1
teardown:
- action: api
method: DELETE
endpoint: "/project/{{ .outputs.create-project.project_id }}"