Feat/core brain integration - #30
Conversation
- Add core-brain.ts client for connecting to brain-core API (49.13.158.176:5001) - Implement Pre-Recall: Search core brain before AI response for context - Implement Writeback: Store Q&A pairs in core brain (append-only) - User mapping: Pass real userId to brain-core (auto-created if not exists) Features: - coreBrainSearch(): Search central knowledge base - coreBrainStore(): Store memories (append-only, no overwrites) - coreBrainRecent(): Get recent memories - buildCoreBrainContext(): Build context string for prompt injection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Auto-fixed by GitHub Actions
- POST /api/auth/reset-password (admin only) - Validates password length (min 8 chars) - Logs password_reset event to audit log - Added new audit event types: password_reset, user_created, user_deleted 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Auto-fixed by GitHub Actions
- src/lib/api.ts: Complete API client with all 178 backend endpoints - Auth, Users, Agents, Tasks, Chat, Audit, Ops, Brain, Memory - Settings, Enforcement, GitHub, Linear, Webhooks, Modules, Billing - Full TypeScript types for all API responses - src/components/UsersPage.tsx: User management (CRUD) - List, create, edit, delete users - Password reset functionality - Role management (admin/user/demo) - User stats dashboard - src/components/AuditPage.tsx: Audit & Ops dashboard - Event log with filtering - Blocked tasks management (approve/reject) - Operations statistics - STOP-Score monitoring - src/components/IntegrationsPage.tsx: External integrations - GitHub repos and issues - Linear teams and issues - Webhook management (CRUD, test) - Updated App.tsx with new navigation tabs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Auto-fixed by GitHub Actions
|
@sentry review |
| onClick={() => { | ||
| setSelectedTask(task); | ||
| handleReject(); |
There was a problem hiding this comment.
Bug: A race condition in the "Reject" button's onClick handler causes rejections to fail silently. handleReject() is called before setSelectedTask() updates the state, so the rejection is skipped.
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The onClick handler for the "Reject" button calls setSelectedTask(task) to schedule a state update and then immediately calls handleReject(). Because React state updates are not applied synchronously within the same event handler, handleReject() is executed while the selectedTask state is still null. The guard clause if (!selectedTask) at the beginning of handleReject() then evaluates to true, causing the function to return prematurely. As a result, the API call to reject the task is never made, and the action fails silently without any visual feedback to the user.
💡 Suggested Fix
Modify the handleReject function to accept the task object as a parameter, removing its dependency on the selectedTask state. The onClick handler should be updated to onClick={() => handleReject(task)}. This ensures the correct task data is immediately available to the function, bypassing the asynchronous state update.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/components/AuditPage.tsx#L468-L470
Potential issue: The `onClick` handler for the "Reject" button calls
`setSelectedTask(task)` to schedule a state update and then immediately calls
`handleReject()`. Because React state updates are not applied synchronously within the
same event handler, `handleReject()` is executed while the `selectedTask` state is still
`null`. The guard clause `if (!selectedTask)` at the beginning of `handleReject()` then
evaluates to true, causing the function to return prematurely. As a result, the API call
to reject the task is never made, and the action fails silently without any visual
feedback to the user.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 508900
Fix issues reported in pull request 24
No description provided.