mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
fix(cli): change_title updates metadata.name for visible renames (#1896)
* fix(cli): change_title updates metadata.name for visible renames Agent change_title was writing metadata.summary only, so spawn --name sessions kept showing the old title. Route explicit renames through metadata.name (web rename semantics) across MCP, Codex, and Pi. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): voice context prefers metadata.name for session title Voice bootstrap/full formatters only read summary.text, so after change_title sets name the spoken context kept a stale title. Use the same name→summary precedence as getSessionTitle. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: polish title rename tests after cold review Rename the Codex root title test to match last-writer-wins behavior, and skip the voice full-context summary header when no title signal exists (avoid literal undefined). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -104,16 +104,15 @@ async function completePlan(f: Awaited<ReturnType<typeof fixture>>, status = 'co
|
||||
}
|
||||
|
||||
describe('shared plan actions', () => {
|
||||
it('persists remote title tools while retaining native terminal rename events', async () => {
|
||||
it('applies remote change_title as metadata.name then lets native terminal rename win', async () => {
|
||||
const f = await fixture();
|
||||
const item = { id: 'title', type: 'mcpToolCall', server: 'hapi', tool: 'change_title',
|
||||
arguments: { title: 'Remote title' }, status: 'completed', result: { content: [], isError: false } };
|
||||
f.native.notify('item/completed', { threadId: 'thread', turnId: 'turn', item });
|
||||
await vi.waitFor(() => expect(f.metadata().summary?.text).toBe('Remote title'));
|
||||
await vi.waitFor(() => expect(f.metadata().name).toBe('Remote title'));
|
||||
f.native.notify('thread/name/updated', { threadId: 'thread', threadName: 'Terminal title' });
|
||||
await vi.waitFor(() => expect(f.metadata().name).toBe('Terminal title'));
|
||||
await f.root.refresh();
|
||||
expect(f.metadata().summary?.text).toBe('Remote title');
|
||||
expect(f.metadata().name).toBe('Terminal title');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user