Show first user message in resume picker

This commit is contained in:
weishu
2026-05-20 20:31:40 +08:00
parent 2ef90f84fb
commit 856af6d8b2
9 changed files with 137 additions and 6 deletions
+43
View File
@@ -991,6 +991,49 @@ describe('session model', () => {
}
})
it('includes first user message in local resumable sessions', () => {
const store = new Store(':memory:')
const engine = new SyncEngine(
store,
{} as never,
new RpcRegistry(),
{ broadcast() {} } as never
)
try {
const session = engine.getOrCreateSession(
'local-resume-first-message',
{
path: '/tmp/project',
host: 'localhost',
machineId: 'machine-1',
flavor: 'codex',
codexSessionId: 'codex-thread-1',
name: 'Generated title'
},
null,
'default'
)
store.messages.addMessage(session.id, {
role: 'agent',
content: { type: 'text', text: 'agent warmup' }
})
store.messages.addMessage(session.id, {
role: 'user',
content: { type: 'text', text: ' Build the picker\nwith search ' }
})
const sessions = engine.listLocalResumableSessions('default', { machineId: 'machine-1' })
expect(sessions.find((item) => item.sessionId === session.id)).toMatchObject({
name: 'Generated title',
firstUserMessage: 'Build the picker with search'
})
} finally {
engine.stop()
}
})
it('local handoff succeeds immediately for inactive sessions', async () => {
const store = new Store(':memory:')
const engine = new SyncEngine(