Issue pipeline — from user report to auto-fix, including Report an Issue dialog, report agent, and scheduled automation

Issue

The issue pipeline connects user-reported bugs to automated fixes. Users click "Report an Issue" in the UI, a GitHub issue is created, and the report agent processes it.

Report an Issue (User-Facing)

Every hogwarts page has a "Report an Issue" link or icon. When clicked, a dialog opens with a textarea. On submit, a GitHub issue is created in databayt/hogwarts with the report label.

Where It Appears

LocationVariantHow
SaaS marketing footertextInline link next to "built by Databayt... GitHub"
Application form wizardiconBug icon in FormFooter next to Logo, Help, Save
School marketing pagestextBottom of page
School dashboardtextBottom of page
SaaS dashboardtextBottom of page
Auth pagestextAbsolute bottom-left
OnboardingtextBottom of page
Exam wizardtextAbsolute bottom-left

Component

src/components/report-issue.tsx

Two variants:

  • text (default) — underlined "Report an issue" link that opens the dialog
  • icon — Bug icon (lucide-react) that opens the same dialog

The dialog contains only a textarea and submit button. Bilingual via useDictionary().

Server Action

src/lib/actions/report-issue.ts

On submit:

  1. Reads GITHUB_PERSONAL_ACCESS_TOKEN from env
  2. Reads auth session via auth() (for reporter identification)
  3. Creates GitHub issue with report label
  4. Posts acknowledgment comment: "Received. This report is queued for automated review and fix."

Issue Body Format

<user's description>
 
---
 
**Page**: https://kingfahad.databayt.org/en/admissions
**Time**: 2026-04-02T08:42:26Z

Title is truncated to 80 characters from the description.

i18n

Translation keys in en.json / ar.json under reportIssue:

KeyEnglishArabic
linkReport an issueالإبلاغ عن مشكلة
titleReport an issueالإبلاغ عن مشكلة
placeholderDescribe the issue......صف المشكلة
submitSubmitإرسال
submittingSubmitting......جاري الإرسال
successSubmitted. Thank you!!تم الإرسال. شكراً لك
errorSomething went wrong. Try again..حدث خطأ. حاول مرة أخرى

Report Agent (Auto-Fix)

The report agent processes open report-labeled issues. Triggered manually by typing report in Claude Code, or by the session-start hook.

Trigger

# Manual
report
report hogwarts
 
# Session-start hook (automatic)
# Checks hogwarts + kun for open report issues on every session start

Pipeline

READ → LOCATE → CONTEXT → VALIDATE → FIX → BUILD → PUSH → CLOSE
StepWhat It Does
READgh issue view — extract description, page URL, time
LOCATEMap URL to route directory (src/app/) and component directory (src/components/)
CONTEXTRead CLAUDE.md, README.md, ISSUE.md in the component directory
VALIDATEIs it a real bug? Does it align with plans? Will the fix improve things?
FIXEdit minimum code needed, follow documented patterns
BUILDpnpm build — verify no regressions
PUSHfix: commit with Closes #N, push to main
CLOSEgh issue close with structured comment (root cause, fix, files, verification)

Validation Gate

Before writing any code, the agent answers three questions:

  1. Is it a real bug? — Can it reproduce from description + URL? If not → cannot-reproduce label
  2. Is it aligned? — Does it contradict ISSUE.md planned work? If feature request → needs-human label
  3. Is the fix safe? — Could it break shared code? When in doubt → needs-human label

Escalation

SituationAction
Build error after fixHand off to build agent
Server-side exceptionHand off to sse agent
Performance issueHand off to performance agent
Security concernHand off to guardian agent
Needs architecture changeComment + needs-human label
Cannot reproduceComment + cannot-reproduce label

Agent Definition

.claude/agents/report.md

Close Comment Format

Fixed in abc1234.
 
**What was wrong**: <root cause>
**What was fixed**: <change summary>
**Files changed**: <list>
**Verified**: build passes, auto-deploying to production

Scheduled Trigger (Paused)

A remote trigger exists that runs the report agent every 2 hours in Anthropic's cloud. Currently paused — using manual report keyword until the feature stabilizes.

FieldValue
NameReport Auto-Fix (Every 2h)
IDtrig_01MFLRtUTfMMNTDGBBGQtZLq
Schedule0 */2 * * * (every 2 hours)
StatusDisabled
Repodatabayt/hogwarts
Modelclaude-sonnet-4-6
Managehttps://claude.ai/code/scheduled

To re-enable when ready:

# In Claude Code
schedule update trig_01MFLRtUTfMMNTDGBBGQtZLq --enabled true

Session-Start Hook

Every time Claude Code opens, the session-start hook checks for open report issues:

# In ~/.claude/settings.json (SessionStart hook)
gh issue list --label report --state open --repo databayt/hogwarts
gh issue list --label report --state open --repo databayt/kun

If found, the agent processes them immediately per the rule in session-start.md.

Full Pipeline Flow

User clicks "Report an issue"
    ↓
Dialog opens → user types description → Submit
    ↓
Server action creates GitHub issue (label: report)
    ↓
Acknowledgment comment posted: "Received. Queued for review."
    ↓
Next Claude Code session → hook detects → agent processes
    OR
User types "report" → agent processes manually
    OR
Scheduled trigger (when enabled) → agent processes every 2h
    ↓
Agent: READ → LOCATE → CONTEXT → VALIDATE → FIX → BUILD → PUSH
    ↓
Issue closed with structured comment
    ↓
Vercel auto-deploys fix to production

Files

Hogwarts

FileRole
src/components/report-issue.tsxUI component (text + icon variants)
src/lib/actions/report-issue.tsServer action (GitHub API + auth + ack comment)
src/components/form/footer.tsxFormFooter with showReport prop
src/components/internationalization/en.jsonEnglish translations
src/components/internationalization/ar.jsonArabic translations

Kun (Engine)

FileRole
.claude/agents/report.mdReport agent definition (12-step pipeline)
.claude/rules/session-start.mdAuto-process rule
content/docs/issue.mdxThis documentation

Issue Creation (CLI)

Issues can also be created from Claude Code or Slack, not just the dialog.

Usage

# From Claude Code
/issue "Login crashes on Safari mobile" --repo hogwarts
 
# From keyword
issue "Add dark mode to dashboard"

Repo Mapping

RepoScope
databayt/kunEngine: agents, skills, MCP, hooks, rules, memory
databayt/hogwartsEducation: features, bugs, LMS, SIS, billing
databayt/souqE-commerce: vendors, cart, checkout
databayt/mkanRentals: listings, booking, search
databayt/shifaMedical: appointments, patient records
databayt/codebaseShared: patterns, components, templates
databayt/shadcnUI: component library
databayt/swift-appMobile: iOS app
databayt/marketingMarketing: landing pages

Labels

Priority

LabelWhen
P0-criticalProduction down, data loss, security
P1-highBlocks current sprint, customer-facing bug
P2-mediumImportant but not blocking
P3-lowNice to have, cleanup

Type

LabelWhen
reportUser-reported via dialog — auto-processed by report agent
bugSomething is broken
enhancementImprove existing feature
needs-humanAgent can't fix, needs human judgment
cannot-reproduceAgent couldn't reproduce the reported issue

Issue Body Template (CLI)

## Context
Why this matters — user impact, business context, or technical debt.
 
## Action
- [ ] Step 1
- [ ] Step 2
- [ ] Step 3
 
## Verification
How to confirm it's done — test commands, URLs to check, expected behavior.