Prompt Run Robustness
# Prompt Run Robustness Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Switch from `:async` to Solid Queue, fan out each prompt run into per-row LLM jobs that retry independently, surface provider failures clearly, and let users retry only the failed rows.
**Architecture:** Engine ships row-level jobs (`GenerateRowJob`, `JudgeReviewJob`, `RunCompletionCheckJob`) with Solid Queue concurrency keys (per-provider + per-run). Generation and judging interleave — each `GenerateRowJob` enqueues its own `JudgeReviewJob`s on success. Run completion is detected by a tiny check job serialized through a per-run concurrency lock. UI status header shows two counters; failed rows surface provider-named badges with a per-run "retry failed rows" action.
**Tech Stack:** Rails 7 engine, Solid Queue (Active Job adapter), Turbo Streams, RSpec + FactoryBot, SQLite for tests / Postgres (Supabase) for prod.
**Spec:** `docs/superpowers/specs/2026-05-01-prompt-run-robustness-design.md`
---
## Conventions used in every task
- **Test path mirrors source path.** A model at `app/models/completion_kit/foo.rb` has its spec at `spec/models/completion_kit/foo_spec.rb`. A job at `app/jobs/completion_kit/foo_job.rb` has its spec at `spec/jobs/completion_kit/foo_job_spec.rb`.
- **Test database is in-memory SQLite** — its schema is hand-written in `spec/rails_helper.rb` (lines ~40–170). Any column added to a real migration MUST also be added to that schema or the spec database won't have it.
- **Run-spec broadcasts are stubbed** at the top of `spec/models/completion_kit/run_spec.rb` to avoid Action Cable noise. Follow the same pattern for any spec that exercises a method that broadcasts.
- **Factories** live in `spec/factories/`, named `completion_kit_<model>`, e.g. `create(:completion_kit_run)`.
- **Run all specs:** `bundle exec rspec`. Run one file: `bundle exec rspec spec/models/completion_kit/run_spec.rb`. Run one example: append `:LINE`.
- **No comments in code** (project-wide rule from `CLAUDE.md`). The plan never asks you to add code comments.
- **Commit messages** are subject-line only or subject + one short sentence. No multi-paragraph bodies. Do not include AI attribution.
---
# Phase 1 (PR 1): Schema + status backfill
> Goal of this PR: land all schema additions and backfill existing rows to terminal states. No behavior change. Safe to ship to web alone.
---
### Task 1: Add status + error columns to completion_kit_responses
**Files:**
- Create: `db/migrate/<timestamp>_add_status_and_error_to_responses.rb`
- Modify: `spec/rails_helper.rb` (in-memory schema, find the `create_table :completion_kit_responses` block ~line 119)
- Modify: `app/models/completion_kit/response.rb`
- Modify: `spec/factories/responses.rb`
- Test: `spec/models/completion_kit/response_spec.rb`
- [ ] **Step 1: Generate the engine migration**
Run: `bundle exec rails g migration AddStatusAndErrorToResponses --no-test-framework`
This creates a file under `db/migrate/`. Rename the timestamp portion to today's date if needed.
- [ ] **Step 2: Fill the migration**when to use it
Community prompt sourced from the open-source GitHub repo homemade-software-inc/completion-kit (NOASSERTION). A "Prompt Run Robustness" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
productivitycommunitydeveloper
source
homemade-software-inc/completion-kit · NOASSERTION
more in Productivity
Productivity✓ tested
Summarize a doc into decisions & actions
chief of staff who extracts what to DO, not just what was said
Productivity✓ tested
Draft a reply to a hard email
calm, direct communicator who de-escalates without caving
Productivity✓ tested
Turn a brain-dump into a weekly plan
planning coach who protects your focus, not just your calendar