Collapse handoff turns in the transcript instead of streaming them
This commit is contained in:
@@ -587,6 +587,10 @@ func (m *Manager) message(ctx context.Context, l *live, actor, text string, imag
|
||||
if len(images) > 0 {
|
||||
payload["images"] = images
|
||||
}
|
||||
compacting := isHandoffPrompt(actor, text)
|
||||
if compacting {
|
||||
payload["handoff"] = true
|
||||
}
|
||||
err := m.emit(ctx, l, actor, "user.message", payload)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -597,7 +601,7 @@ func (m *Manager) message(ctx context.Context, l *live, actor, text string, imag
|
||||
l.asked = false
|
||||
l.bounced = false
|
||||
l.wantCompact = false
|
||||
l.compacting = isHandoffPrompt(actor, text)
|
||||
l.compacting = compacting
|
||||
l.rateLimited = nil
|
||||
m.mu.Unlock()
|
||||
|
||||
|
||||
@@ -587,6 +587,9 @@ func TestCompactCarriesHandoff(t *testing.T) {
|
||||
t.Fatalf("handoff turn.ended %v: want handoff and no inbox summary", ev.Payload)
|
||||
}
|
||||
}
|
||||
if ev.Kind == "user.message" && ev.Actor == "byre" && *ev.AgentSessionId == old.Id && ev.Payload["handoff"] != true {
|
||||
t.Fatalf("handoff prompt %v: want handoff flag", ev.Payload)
|
||||
}
|
||||
}
|
||||
|
||||
sessions, err := e.store.ListSessions(e.ctx, e.task.Id)
|
||||
|
||||
@@ -250,6 +250,9 @@ WHERE json_extract(focus, '$.task_id') IS NOT NULL;
|
||||
DELETE FROM lead_inputs WHERE text LIKE 'The human switched the right pane %' OR text = 'The human cleared the right pane.';
|
||||
`}, {"add-task-merging-by", `
|
||||
ALTER TABLE tasks ADD COLUMN merging_by TEXT NOT NULL DEFAULT '';
|
||||
`}, {"flag-handoff-prompts", `
|
||||
UPDATE events SET payload = json_set(payload, '$.handoff', json('true'))
|
||||
WHERE kind = 'user.message' AND actor = 'byre' AND json_extract(payload, '$.text') LIKE 'Write a handoff for a fresh %';
|
||||
`}}
|
||||
|
||||
type Store struct {
|
||||
|
||||
Reference in New Issue
Block a user