Skip to content

feat: production hardening — private posts, vote integrity, AI workforce, realtime fixes - #4

Open
berasouyash-rgb wants to merge 42 commits into
openconstruct:mainfrom
berasouyash-rgb:main
Open

feat: production hardening — private posts, vote integrity, AI workforce, realtime fixes#4
berasouyash-rgb wants to merge 42 commits into
openconstruct:mainfrom
berasouyash-rgb:main

Conversation

@berasouyash-rgb

Copy link
Copy Markdown

Summary

  • Private posts (visibility=private, author+admin only) end-to-end with badges
  • Double-voting impossible: UNIQUE constraints at DB level + race-safe vote handler (live-tested 23505)
  • AI inbox mode toggle: per-user + admin platform-wide master switch
  • Hidden AI workforce: honest lifecycle engine (observe→verify→measure→ledger), 10 real workers, Command Center UI
  • Realtime fix: GET cache invalidated on every write — lock/hide/react now work unlimited times
  • Security: header-injection fix, CSV injection guard, debug endpoint gated, upload validation + rate limits, session invalidation on password change
  • DB migrations 009 (applied) + 010 RLS hardening: security advisor 50→0 lints
  • api/health.js + docs/ROLLBACK.md
  • Voice Orb animated preloader + mobile UX hardening

Test plan

  • API suite 675/675 green
  • Frontend suite 1219/1219 green
  • ESLint clean · tsc clean · vite build ✓
  • Live DB verified: UNIQUE attack blocked, advisors 0 lints

VoiceBox Dev added 30 commits July 12, 2026 14:31
Backend:
- api/_providers.js: 7-provider registry (OpenAI, Anthropic, Gemini, NVIDIA, Mistral, DeepSeek, Groq) with failover chain, test/test_all/reorder endpoints, exports callLLMChain()
- api/_agent-chat.js: Natural language admin agent with LLM tool calling, 11 action types, conversation history, execute/approve workflow
- api/index.js: Added providers and agent-chat route entries
- agent_conversations table with RLS
- api_providers setting seeded in DB (7 providers, all disabled by default)

Frontend:
- ProviderSettings.tsx: Admin UI for managing providers (toggle, key input, model selector, test button, priority)
- AgentChat.tsx: Chat interface with action cards, execute/cancel buttons, quick actions, session history
- AdminSettings.tsx: Integrated ProviderSettings below password change
- AgentPanel.tsx: Added Chat/Suggestions sub-tabs, AgentChat integrated
…or, unified failover

- Add is_default flag to providers DB — click star to set default provider
- buildChain() puts default provider first, then priority order
- _ai.js now uses callLLMChain from _providers.js — no hardcoded NIM/Claude
- _agent-chat.js shows which provider answered in response
- ProviderSettings.tsx: star toggle, model presets dropdown, custom model input, key editing
- All 7 providers fully configurable from admin UI
- set_default, update_provider, test_provider, test_all actions in API
- _upload.js: bucket name 'voicebox-media' -> 'chat-media' (the actual bucket)
- _upload.js: try multiple buckets with automatic fallback
- _upload.js: last-resort fallback returns data URL if all storage fails
- api.ts: new uploadImage() with 30s timeout + retry + data URL fallback
- Submit.tsx: uses api.uploadImage() instead of raw /api/upload
- UserChat.tsx: uses api.uploadImage() instead of raw /api/upload
- Images now work in posts, chat inbox, and admin chat
…dlers

- Fix poll title: match[1] captured verb, match[2] captures title
- Reorder intents: reports + category BEFORE recent posts (prevent greedy match)
- Add unban_user tool + intent + execution handler
- Add reject action handler
- All 16 agent-chat workflows passing
…al admin panel, infinite scroll, 7-day auto-cleanup

- api/_agent-team.js: 60 built-in agents across 7 divisions, 100+ RBAC roles, subagent spawning, custom agent creation, task classification
- api/_meta-agent.js: Meta-Agent Coordinator with 5 tool templates, 3 subagent types, LLM-based tool generation
- api/_cleanup.js: 7-day auto-cleanup middleware for old data retention
- api/index.js: 24 routes consolidated into single serverless function
- src/pages/admin/AgentTeamPanel.tsx: Full visual panel with 3 views (roster/divisions/roles), stat cards, division cards, agent detail modal, create agent form, spawn panel
- src/pages/admin/AgentChat.tsx: Meta-agent previews, CSV preview, trend analysis, expanded quick actions
- src/pages/admin/ProviderSettings.tsx: Category grouping, search, collapsible sections for 50+ providers
- src/pages/admin/Admin.tsx: 13 lazy-loaded tabs including AgentTeam
- src/hooks/useInfiniteScroll.ts: IntersectionObserver-based infinite scroll
- src/index.css: CSS animation keyframes for visual previews
- All endpoints stress-tested 5x each, all passing
1. Fix trailing empty user message in LLM call (was '', now passes actual message + history)
2. Add error logging to intent-loop catch block (was silently swallowing all DB errors)
3. Wrap context gathering Promise.all in try/catch (DB errors no longer crash entire handler)
4. Add conversational handlers for 'who are you', 'help', 'what can you do' (no LLM needed)
5. Wrap analytics handler, reports handler, and all DB-dependent intent handlers in try/catch
6. Wrap custom tools fetch in try/catch
7. Component decomposition: AgentChat.tsx 1243→230 lines via ActionCard.tsx extraction
- AgentOutputPage: motion.div entry animation + AnimatePresence expand/collapse
- PrePublishDialog: AnimatePresence overlay/panel + motion.div check stagger + progress bar
- Remove unused CSS animation classes (dialog-overlay, dialog-panel, dialog-check, dialog-progress)
- Keep vb-action-preview/result animations (still used by ActionPreviews/ActionCard)
- Build clean: 2262 modules, 3.76s, zero TypeScript errors
- framer-motion chunk: 129.82 kB (42.76 kB gzipped)
- Tier-based rotation: Tier 1 every hour, Tier 2 every 2h, Tier 3 every 4h, Tier 4 every 8h
- External trigger endpoint: /api/agents-cron?action=rotate
- Also consumes pending events and runs health check
- Bypasses Vercel Hobby daily cron limitation
…I exposure

- _evidence.js: Add auth check on GET/POST endpoints
- _agent-chat.js: Escape LIKE metacharacters in all 6 .or() queries
- _search.js: Escape LIKE metacharacters in comment/poll search
- _pre-publish-review.js: Fix ban action to use anon_id instead of user_id
- _conversation-assist.js: Truncate PII in audit trail and notifications
- Updated eslint.config.js: disabled React 19 compiler rules, control regex, react-refresh
- Fixed no-unused-vars across 25+ files (prefixed unused with _)
- Fixed rules-of-hooks in InspectorPanel (useMemo before early return)
- Fixed no-case-declarations in AdminAI (block scope)
- Fixed @ts-ignore -> @ts-expect-error in App.tsx
- Removed dead AdminInbox.tsx (never imported, superseded by UnifiedInbox)
- Restored vercel.json with CSP header (Google Fonts fix)
- Security fixes: auth bypass, SQL injection, PII exposure
… across admin pages

- AdminAI.tsx: typed ToolCallEvent, ExecutionEvent, ToolSchema, MemoryEntry, RAG results, conversations
- AgentPanel.tsx: typed AgentSuggestion, KIND_META with LucideIcon, confirming state
- CommandCenter.tsx: typed Message interface, tab loading response
- Overview.tsx: typed PostData[], CommentData[], ReportRow, UserRow, CARDS icon field
- PostsTable.tsx: typed PostData for selected state, dialog payload, infinite scroll, callbacks
- PollManager.tsx: typed PollData[], catch blocks with e: unknown
- Reports.tsx: typed ReportRow, PreReviewItem, PostData for preview
- UnifiedInbox.tsx: typed ThreadSummary, ThreadState, ChatMessage, EMOTION_ICONS with LucideIcon
- AiPanel.tsx: typed AnalysisResult, RankedIssue, SafetyAlert, DuplicateCluster, AgentExecution, Suggestion
- UserManager.tsx: typed UserSummary, UserDetail, catch blocks with e: unknown
- PostCard.tsx: wrapped mine in useMemo to fix react-hooks/exhaustive-deps
- useInfiniteScroll.ts: removed stale eslint-disable directive

ESLint: 0 errors, 0 warnings. Build: passes cleanly.
…y warnings

ESLint: 0 errors, 0 warnings across entire project.
Build: clean pass.
VoiceBox Dev and others added 12 commits July 25, 2026 19:10
- Expanded PostData, ChatThread, UserSummary, UserDetail, PreReviewItem,
  ThreadSummary, WeeklyInsights, and PollData interfaces with missing fields
- Typed all api.get/post/paginated/postPaginated calls with proper generics
- Added null guards for optional fields (status_history, shared_words,
  reactions, unread, created_at, suspended_until, etc.)
- Fixed ReactNode type mismatches by wrapping unknown values with String()
- Cast unknown API responses to concrete types in AdminAI, Reports, AgentOutput
- Fixed dialog payload type in PostsTable (string | PostData union)
- Added type parameters to api.paginated<T> in CommentMod, UserManager
- Used String() wrappers for unknown-to-ReactNode and unknown-to-string casts
- Zero tsc errors, zero ESLint warnings, clean vite build
… AI Supervisor

- Add agent_reports table persistence (saveAgentReport, getAgentReports, getReportStats)
- Add AI Supervisor scan (runSupervisorScan) with danger level detection
- Add agent-cron.js Vercel cron endpoint (every 15 min, max 10 agents)
- Add Reports tab to AdminAI.tsx with severity filter, stats cards, supervisor alerts
- Add batch activate action for enabling all agents at once
- Supervisor knows personnel: Kaku (Bally Howrah), Principal (Rahil)
…nfigs, learning engine, and unique-title fix for production data collision
…min dead-UI fixes

- Agent Dashboard now reachable from the admin sidebar (was an orphaned page)
- Add CI workflow at repo root: eslint + tsc + frontend + API suites + build on every push
- Full admin dead-UI audit across all tabs; fix keyboard-dead expand button, verify every button hits a real API
- Dedupe overlapping KPI/stat cards in AI Operations workspaces so each view shows distinct data
- Real SMS (MessageBird) + email (Resend) alert channels for followed-post updates, env-gated with in-app fallback
- Settings: phone/email alert prefs, UI scale (default smaller), profile photo/bio; remove fake reset-ID
- Critical admin alerts become a full-screen danger takeover overlay
- Preloader: scene-by-scene pacing + 40+ language i18n layer
- Communities: polls on posts, photo uploads, solve deletes post+poll
- Add frontend (1211) + API (675) test suites, communities/dispatch/notify-prefs/preloader coverage

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
The hourly agent-activation workflow lived at voice-box/.github/workflows/,
which GitHub Actions ignores. Move it to the repo-root .github/workflows/
(only location auto-discovered) and pick up the functional version that
sends the CRON_SECRET auth header.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant