Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: reconcile Brain captures with updated inbox records

Adam Eivy28de70da0758
diff --git a/client/src/components/brain/tabs/InboxTab.jsx b/client/src/components/brain/tabs/InboxTab.jsx
index 849a2ed028..df3a9c425a 100644
--- a/client/src/components/brain/tabs/InboxTab.jsx
+++ b/client/src/components/brain/tabs/InboxTab.jsx
@@ -105,9 +105,9 @@ export default function InboxTab({ onRefresh, settings }) {
}
for (const item of paged.items) {
if (!deleted.has(item.id)) {
- if (!map.has(item.id)) {
- map.set(item.id, item);
- }
+ // Capture acknowledgements bridge pending history; once a row is
+ // fetched, its server state supersedes that initial snapshot.
+ map.set(item.id, item);
}
}
return [...map.values()];
diff --git a/client/src/components/brain/tabs/InboxTab.test.jsx b/client/src/components/brain/tabs/InboxTab.test.jsx
index 4f4dcf655c..9b41f3120f 100644
--- a/client/src/components/brain/tabs/InboxTab.test.jsx
+++ b/client/src/components/brain/tabs/InboxTab.test.jsx
@@ -43,7 +43,8 @@ vi.mock('../../ui/Toast', () => ({
vi.mock('../VoiceCapture', () => ({ default: () => null }));
vi.mock('../RepoIntakeOptions', () => ({ default: () => null }));
-import { captureBrainThought, getBrainInbox } from '../../../services/api';
+import { captureBrainThought, getBrainInbox, resolveBrainReview } from '../../../services/api';
+import socket from '../../../services/socket';
import InboxTab from './InboxTab';
function LocationProbe() {
@@ -89,6 +90,60 @@ describe('Brain inbox capture', () => {
expect(screen.getAllByText(accepted.capturedText)).toHaveLength(1);
});
+ it.each([false, true])('shows the classified record when its capture acknowledgement arrives last: %s', async (acknowledgementLast) => {
+ const accepted = {
+ id: 'example-classified', capturedText: 'A thought to classify',
+ status: 'classifying', capturedAt: '2026-01-01T00:00:00.000Z',
+ };
+ let acknowledge;
+ captureBrainThought.mockReturnValue(new Promise(resolve => { acknowledge = resolve; }));
+ render(<MemoryRouter><InboxTab /></MemoryRouter>);
+ await waitFor(() => expect(screen.queryByText('Loading inbox history')).toBeNull());
+
+ fireEvent.change(screen.getByLabelText('New inbox thought'), { target: { value: accepted.capturedText } });
+ fireEvent.click(screen.getByLabelText('Capture thought'));
+ expect(screen.getByText('AI is classifying this thought...')).toBeInTheDocument();
+ if (!acknowledgementLast) {
+ await act(async () => { acknowledge({ inboxLog: accepted }); });
+ }
+
+ getBrainInbox.mockResolvedValue({
+ entries: [{ ...accepted, status: 'filed', filed: { destination: 'ideas', destinationId: 'example-idea' } }],
+ counts: { filed: 1 },
+ });
+ const classified = socket.on.mock.calls.find(([event]) => event === 'brain:classified')[1];
+ act(() => classified({ status: 'filed', destination: 'ideas', title: 'Example idea' }));
+ await screen.findByTitle('View in Memory');
+ if (acknowledgementLast) {
+ await act(async () => { acknowledge({ inboxLog: accepted }); });
+ }
+
+ await waitFor(() => expect(screen.queryByText('AI is classifying this thought...')).toBeNull());
+ expect(screen.getAllByText(accepted.capturedText)).toHaveLength(1);
+ expect(screen.getByTitle('View in Memory')).toBeInTheDocument();
+ });
+
+ it('shows the filed result after manually routing a capture that needed review', async () => {
+ const accepted = {
+ id: 'example-review', capturedText: 'A thought to review',
+ status: 'needs_review', capturedAt: '2026-01-01T00:00:00.000Z',
+ };
+ captureBrainThought.mockResolvedValue({ inboxLog: accepted });
+ render(<MemoryRouter><InboxTab /></MemoryRouter>);
+ fireEvent.change(screen.getByLabelText('New inbox thought'), { target: { value: accepted.capturedText } });
+ fireEvent.click(screen.getByLabelText('Capture thought'));
+ const route = await screen.findByTitle('Route to Ideas');
+
+ const filed = { ...accepted, status: 'filed', filed: { destination: 'ideas', destinationId: 'example-idea' } };
+ getBrainInbox.mockResolvedValue({ entries: [filed], counts: { filed: 1 } });
+ resolveBrainReview.mockResolvedValue({ inboxLog: filed });
+ fireEvent.click(route);
+
+ await screen.findByTitle('View in Memory');
+ expect(screen.queryByTitle('Route to Ideas')).toBeNull();
+ expect(screen.getAllByText(accepted.capturedText)).toHaveLength(1);
+ });
+
it('keeps capture usable after history fails without claiming it is still loading', async () => {
getBrainInbox.mockRejectedValue(new Error('Example history could not load'));
const accepted = {