-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(ai): rewrite triage prompts and add channel context #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ac23254
d13361c
25e73d3
20de28e
3cdf10e
4779199
850bd7a
ef9478b
ce862b6
78cbe0b
c39f28b
71f8f3b
cb2e33d
96700bb
43f2405
8bbd31b
08d265b
dc43dcd
05634f1
1e80640
2abf756
47db485
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # Maintain Docs | ||
|
|
||
| --- | ||
| on: | ||
| schedule: | ||
| - cron: '0 9 * * *' # 4 AM EST = 9 AM UTC | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| tools: | ||
| github: | ||
| edit: | ||
|
|
||
| engine: copilot | ||
|
|
||
| --- | ||
BillChirico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Maintain AGENTS.md Documentation | ||
|
|
||
| ## Purpose | ||
|
|
||
| Keep the AGENTS.md file accurate and current by: | ||
| - Reviewing merged pull requests since last run | ||
| - Checking updated source files (src/, web/, tests/, etc.) | ||
| - Updating AGENTS.md to reflect any architectural or pattern changes | ||
| - Creating a pull request if updates are needed | ||
|
|
||
| ## Instructions for the Agent | ||
|
|
||
| 1. **Fetch Recent Changes**: Query the repository for merged PRs and updated files from the past 24 hours | ||
|
|
||
| 2. **Review Architecture Changes**: Check if any of these directories have significant changes: | ||
| - `src/modules/` - New modules or modified patterns | ||
| - `src/api/` - API route or middleware changes | ||
| - `src/commands/` - New slash commands | ||
| - `src/utils/` - Utility additions or pattern changes | ||
| - `web/` - Dashboard updates | ||
| - `tests/` - Testing patterns | ||
|
|
||
| 3. **Analyze Merged PRs**: Look at PR titles and descriptions to identify: | ||
| - New features added | ||
| - Architecture decisions | ||
| - Pattern changes | ||
| - Testing approach changes | ||
| - Breaking changes | ||
|
|
||
| 4. **Update AGENTS.md if Needed**: | ||
| - Architecture Overview section: Add new modules or directories | ||
| - Key Patterns section: Document new patterns or changes | ||
| - Common Tasks section: Update task examples if workflows changed | ||
| - Resources section: Add new links if applicable | ||
|
|
||
| 5. **Create Pull Request**: If changes are needed: | ||
| - Create a branch named `copilot/maintain-docs-YYYY-MM-DD` | ||
| <!-- NOTE: Replace YYYY-MM-DD with the actual run date on each execution, | ||
| e.g. copilot/maintain-docs-2026-03-07. A static date causes branch collisions | ||
| on repeated daily runs. Use a date expression or ${{ github.run_id }}. | ||
| The `copilot/` prefix is required for GitHub Copilot coding agent branches. --> | ||
| - Update AGENTS.md with discovered changes | ||
| - Create a PR with: | ||
| - Title: "docs: update AGENTS.md from merged PRs and source changes" | ||
| - Description: List the changes reviewed and what was updated | ||
| - Label: `documentation` | ||
| - Auto-merge enabled if all checks pass | ||
|
|
||
| 6. **Quality Checks**: | ||
| - Ensure Markdown formatting is correct | ||
| - Verify all links and references are accurate | ||
| - Check that code examples match current patterns | ||
| - Ensure sections remain organized and readable | ||
|
|
||
| 7. **If No Changes Needed**: Close silently or note in logs that AGENTS.md is current | ||
|
|
||
| ## Context | ||
|
|
||
| AGENTS.md documents: | ||
| - Code quality standards (ESM, single quotes, semicolons, 2-space indent, Winston logger) | ||
| - Architecture overview (src/, web/ structure) | ||
| - Key patterns (config system, caching, AI integration, database) | ||
| - Common tasks (adding features, commands, API endpoints) | ||
| - Testing requirements (80% coverage) | ||
| - Git workflow and review bots | ||
| - Troubleshooting guides | ||
| - Resources | ||
|
|
||
| Always maintain accuracy and completeness of this documentation file. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # TASK: Fix remaining 21 review threads on PR #248 | ||
|
|
||
| Branch: `refactor/triage-prompt-rewrite` | ||
| Work in: `/home/bill/worktrees/volvox-bot-248` | ||
|
|
||
| ## Threads to fix | ||
|
|
||
| ### maintain-docs.md | ||
| 1. Add `# Maintain Docs` top-level heading (markdownlint) | ||
| 2. Replace hardcoded date `2026-03-04` with `YYYY-MM-DD` placeholder + comment | ||
| 3. Capitalize "Markdown" as proper noun | ||
| 4. Line 20 — fix whatever workflow issue CodeRabbit flagged (read the file) | ||
| 5. Line 61 — branch naming: CodeRabbit says `copilot/` prefix is required for GitHub Copilot coding agent branches — read the file and fix the branch naming if it uses a non-compliant format | ||
|
|
||
| ### Backend | ||
| 6. `tests/modules/triage-prompt.test.js` line 278 — add test that channel metadata with tag-like chars is escaped via `escapePromptDelimiters()` | ||
| 7. `src/prompts/community-rules.md` line 15 — change `mute` to `timeout` in the moderation ladder (classifier only supports `warn`, `timeout`, `kick`, `ban`, `delete`) | ||
| 8. `src/prompts/triage-classify.md` line 26 — update stale example `Rule 4: No spam/shilling` to match current rule `Rule 4: No spam or drive-by promotion` | ||
|
|
||
| ### Frontend — config-sections | ||
| 9. `web/src/components/dashboard/config-sections/AiAutoModSection.tsx` line 16 — import `inputClasses` from the shared module (`config-sections/shared.ts`) instead of defining it locally | ||
| 10. `web/src/components/dashboard/config-sections/ChallengesSection.tsx` line 73 — constrain `postTime` to a real clock value (use `type="time"` input or validate `HH:MM` format before saving) | ||
| 11. `web/src/components/dashboard/config-sections/ModerationSection.tsx` line 259 — `blockedDomains` currently only updates `draftConfig` on `onBlur`. Change to update on `onChange` (or both) so saves don't miss in-progress edits | ||
| 12. `web/src/components/dashboard/config-sections/TicketsSection.tsx` line 139 — read the file and fix whatever issue CodeRabbit found | ||
| 13. `web/src/components/dashboard/config-sections/TriageSection.tsx` line 225 — `moderationLogChannel` was regressed to a plain text input; restore it to use a `ChannelSelector` component | ||
| 14. `web/src/components/dashboard/config-sections/StarboardSection.tsx` — fix whatever major issue was flagged (read file) | ||
| 15. `web/src/components/dashboard/config-sections/GitHubSection.tsx` line 43 — read and fix | ||
| 16. `web/src/components/dashboard/config-sections/ChallengesSection.tsx` — read and fix the major issue | ||
| 17. `web/src/components/dashboard/config-sections/CommunityFeaturesSection.tsx` line 76 — use stricter type for feature config entries instead of `as { enabled?: boolean } | undefined` | ||
|
|
||
| ### Frontend — lib | ||
| 18. `web/src/lib/config-updates.ts` — restrict `section` type to object-valued config sections (not `keyof GuildConfig` which includes scalars) | ||
| 19. `web/src/lib/config-normalization.ts` line 80 — clamp `decimalToPercent` to [0, 100] for symmetry with `percentToDecimal` | ||
|
|
||
| ### Frontend — config-editor | ||
| 20. `web/src/components/dashboard/config-editor.tsx` line 451 — Ctrl+S silently fails and blocks browser save when there are validation errors. Fix: only call `e.preventDefault()` when we're actually handling the save (i.e., `hasChanges && !hasValidationErrors`), otherwise let the browser default fire | ||
|
|
||
| ## Rules | ||
| - Commit each logical group separately with conventional commits | ||
| - Run `pnpm format && pnpm lint` and `pnpm --prefix web lint && pnpm --prefix web typecheck` | ||
| - Do NOT push | ||
|
Comment on lines
+1
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this PR-local checklist before merge. This is transient scratch work with a machine-specific path and review-state notes, so it will stale immediately and leaks local environment details into the repo. 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # TASK: Fix 10 remaining PR #248 review threads | ||
|
|
||
| Branch: `refactor/triage-prompt-rewrite` | ||
| Work in: `/home/bill/worktrees/volvox-bot-248` | ||
|
|
||
| ## Fixes | ||
|
|
||
| ### 1. EngagementSection.tsx — stable badge keys | ||
| - File: `web/src/components/dashboard/config-sections/EngagementSection.tsx` line 53 | ||
| - Currently uses index-based key `badge-row-${i}`. When badges are reordered or deleted, React reuses wrong DOM nodes. | ||
| - Fix: give each badge a stable `id` (e.g. `badge.id ?? badge.name ?? index`) as the key | ||
|
|
||
| ### 2. AiAutoModSection.tsx — clamp threshold before converting | ||
| - File: `web/src/components/dashboard/config-sections/AiAutoModSection.tsx` line 99 | ||
| - `150` or `-5` gets saved as `1.5`/`-0.05` without clamping | ||
| - Fix: clamp parsed value to [0, 100] before `percentToDecimal()`: | ||
| ```tsx | ||
| const clamped = Math.min(100, Math.max(0, parsed)); | ||
| onThresholdChange(percentToDecimal(clamped)); | ||
| ``` | ||
|
|
||
| ### 3. ChallengesSection.tsx — single quotes in JSX strings | ||
| - File: `web/src/components/dashboard/config-sections/ChallengesSection.tsx` line 84 | ||
| - JSX string literals use double quotes; repo convention is single quotes | ||
| - Fix: change double-quoted JSX string attributes to single quotes where applicable (biome can auto-fix this) | ||
|
|
||
| ### 4. ChallengesSection.tsx — validate IANA timezone | ||
| - File: `web/src/components/dashboard/config-sections/ChallengesSection.tsx` line 84 | ||
| - Timezone is still free-text; typos silently break scheduling | ||
| - Fix: Use `Intl.supportedValuesOf('timeZone')` to validate, or add a `<datalist>` with common timezones, and show an error if the entered value isn't a valid IANA zone: | ||
| ```tsx | ||
| const isValidTimezone = (tz: string) => { | ||
| try { Intl.DateTimeFormat(undefined, { timeZone: tz }); return true; } | ||
| catch { return false; } | ||
| }; | ||
| ``` | ||
| Show a red error message below the input if invalid. | ||
|
|
||
| ### 5. GitHubSection.tsx — sync pollIntervalMinutes with draft state | ||
| - File: `web/src/components/dashboard/config-sections/GitHubSection.tsx` line 63 | ||
| - When `pollIntervalMinutes` is unset, renders `5` but never writes it to draftConfig | ||
| - Fix: use `value={draftConfig.github?.pollIntervalMinutes ?? 5}` AND write back on change (including the default 5): | ||
| ```tsx | ||
| onChange={(e) => { | ||
| const val = Math.max(1, parseInt(e.target.value, 10) || 5); | ||
| onFieldChange('pollIntervalMinutes', val); | ||
| }} | ||
| ``` | ||
|
|
||
| ### 6. ModerationSection.tsx — mobile-responsive rate-limit grids | ||
| - File: `web/src/components/dashboard/config-sections/ModerationSection.tsx` line 229 | ||
| - Fix `grid-cols-2` and `grid-cols-3` → `grid-cols-1 sm:grid-cols-2` and `grid-cols-1 sm:grid-cols-3` | ||
|
|
||
| ### 7. StarboardSection.tsx — use `''` not `null` for cleared channelId | ||
| - File: `web/src/components/dashboard/config-sections/StarboardSection.tsx` line 57 | ||
| - `StarboardConfig.channelId` is `string`, not `string | null` | ||
| - Fix: `onChange={(val) => onFieldChange('channelId', val ?? '')}` instead of `val ?? null` | ||
|
|
||
| ### 8. StarboardSection.tsx — ignoredChannels updates on change not just blur | ||
| - File: `web/src/components/dashboard/config-sections/StarboardSection.tsx` line 133 | ||
| - Save can fire while input has focus; latest value missed if user saves before blur | ||
| - Fix: update `draftConfig` on `onChange` too (keep raw state for display but also flush to draft): | ||
| ```tsx | ||
| onChange={(e) => { | ||
| setIgnoredChannelsRaw(e.target.value); | ||
| // also flush to draft so Ctrl+S captures current value | ||
| const parsed = e.target.value.split(',').map(s => s.trim()).filter(Boolean); | ||
| onIgnoredChannelsChange(parsed); | ||
| }} | ||
| ``` | ||
|
|
||
| ### 9. TriageSection.tsx — mobile-responsive numeric grids | ||
| - File: `web/src/components/dashboard/config-sections/TriageSection.tsx` line 182 | ||
| - Same as ModerationSection — `grid-cols-2` → `grid-cols-1 sm:grid-cols-2` | ||
|
|
||
| ### 10. config-updates.ts — fix updateArrayItem early return | ||
| - File: `web/src/lib/config-updates.ts` line 137 | ||
| - Early return on missing array breaks the empty-array initialization case | ||
| - Check existing tests in `web/tests/lib/config-updates.test.ts` to understand the expected behavior | ||
| - Fix: instead of returning `prev` when the array is missing, initialize it as `[]` and proceed with the update | ||
|
|
||
| ## Rules | ||
| - Commit each logical group (backend fixes together, frontend sections together, lib fixes together) | ||
| - Run `pnpm format && pnpm lint` and `pnpm --prefix web lint && pnpm --prefix web typecheck` | ||
| - Do NOT push | ||
|
Comment on lines
+1
to
+85
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep ad-hoc review task docs out of version control. Like 🧰 Tools🪛 LanguageTool[uncategorized] ~42-~42: The official name of this software platform is spelled with a capital “H”. (GITHUB) 🪛 markdownlint-cli2 (0.21.0)[warning] 8-8: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 15-15: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 16-16: Ordered list item prefix (MD029, ol-prefix) [warning] 17-17: Ordered list item prefix (MD029, ol-prefix) [warning] 18-18: Ordered list item prefix (MD029, ol-prefix) [warning] 20-20: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 21-21: Ordered list item prefix (MD029, ol-prefix) [warning] 22-22: Ordered list item prefix (MD029, ol-prefix) [warning] 23-23: Ordered list item prefix (MD029, ol-prefix) [warning] 24-24: Ordered list item prefix (MD029, ol-prefix) [warning] 25-25: Ordered list item prefix (MD029, ol-prefix) [warning] 26-26: Ordered list item prefix (MD029, ol-prefix) [warning] 27-27: Ordered list item prefix (MD029, ol-prefix) [warning] 28-28: Ordered list item prefix (MD029, ol-prefix) [warning] 29-29: Ordered list item prefix (MD029, ol-prefix) [warning] 31-31: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 32-32: Ordered list item prefix (MD029, ol-prefix) [warning] 33-33: Ordered list item prefix (MD029, ol-prefix) [warning] 35-35: Headings should be surrounded by blank lines (MD022, blanks-around-headings) [warning] 36-36: Ordered list item prefix (MD029, ol-prefix) [warning] 38-38: Headings should be surrounded by blank lines (MD022, blanks-around-headings) 🤖 Prompt for AI Agents |
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.