Skip to content

Feat/core brain integration - #30

Closed
dsactivi-2 wants to merge 6 commits into
mainfrom
feat/core-brain-integration
Closed

Feat/core brain integration#30
dsactivi-2 wants to merge 6 commits into
mainfrom
feat/core-brain-integration

Conversation

@dsactivi-2

Copy link
Copy Markdown
Owner

No description provided.

dsactivi and others added 6 commits January 1, 2026 04:00
- 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
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

@sentry review

Comment on lines +468 to +470
onClick={() => {
setSelectedTask(task);
handleReject();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dsactivi-2

Copy link
Copy Markdown
Owner Author

Bereits gemerged als PR #24 (commit d939731)

@dsactivi-2 dsactivi-2 closed this Jan 1, 2026
dsactivi-2 pushed a commit that referenced this pull request Jan 27, 2026
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.

2 participants