feat: show the conversation evidence behind each learning trajectory

Reviewers were asked to include or exclude learning trajectories while
only seeing metadata — credit class, confidence, status. The decisions
and their redacted context turns were already captured and stored, but
no endpoint returned them, so the evidence was unreachable from the UI.

Add GET /api/learning/trajectories/:id and an expandable row on the
learning page that fetches on demand.

Also widen SentMessageSchema to accept matrixEventId, imageOutcomeCredit
and imageOutcomeAt. The learning loop added these to SentMessageRecord
and they flow out of /api/messages, but the strict contract rejected
them, breaking the dashboard.

Enable generation with shadow mode off so eligible examples reach reply
prompts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jamie BruntonandClaude Opus 5 committed 2026-08-12 08:23:22 +01:00
1 parent 687abab82b
commit 142378df33
25 files changed
+836 -28

No files matched your search

+48
View File
@@ -149,6 +149,54 @@ describe('Reddit session status', () => {
expect((await request(app, '/login/start', { method: 'POST' })).status).toBe(404);
});
it('removes an account and reports the account it deleted', async () => {
const remove = vi.fn().mockResolvedValue({ accountId: 't2_alice', redditUsername: 'alice-bot' });
const app = express();
app.use(createLoginRouter({
services: { redditAccounts: { remove } },
logger: { error: () => undefined, info: () => undefined },
} as never));
const response = await request(app, '/accounts/t2_alice', { method: 'DELETE' });
expect(response.status).toBe(200);
expect(await response.json()).toEqual({
ok: true,
account: { accountId: 't2_alice', redditUsername: 'alice-bot' },
});
expect(remove).toHaveBeenCalledWith('t2_alice');
});
it('answers 404 when the account to remove does not exist', async () => {
const app = express();
app.use(createLoginRouter({
services: {
redditAccounts: { remove: async () => { throw new Error('Reddit account not found'); } },
},
logger: { error: () => undefined, info: () => undefined },
} as never));
const response = await request(app, '/accounts/t2_missing', { method: 'DELETE' });
expect(response.status).toBe(404);
expect(await response.json()).toEqual({ ok: false, error: 'Reddit account not found' });
});
it('reports a failed removal as a server error rather than a silent success', async () => {
const app = express();
app.use(createLoginRouter({
services: {
redditAccounts: { remove: async () => { throw new Error('database is locked'); } },
},
logger: { error: () => undefined, info: () => undefined },
} as never));
const response = await request(app, '/accounts/t2_alice', { method: 'DELETE' });
expect(response.status).toBe(500);
expect(await response.json()).toEqual({ ok: false, error: 'database is locked' });
});
it('classifies Reddit navigation failures as unreachable', () => {
expect(
classifyRedditSessionError(