This commit is contained in:
Ian Gulliver
2026-10-20 22:02:59 -07:00
parent ccbbb5807f
commit 57324fe9a2
5 changed files with 31 additions and 53 deletions
+3 -23
View File
@@ -163,29 +163,9 @@ func (m *Manager) agyTurnEnded(ctx context.Context, l *live, p antigravityProces
m.mu.Unlock()
success := res.Status == "SUCCESS"
bounce := false
if success && l.implementer() {
var err error
bounce, err = m.takeBounce(ctx, l, final)
if err != nil {
return err
}
}
if bounce {
err := m.emit(ctx, l, "byre", "user.message", map[string]any{"text": proseQuestionNudge, "mid_turn": true, "bounce": true})
if err != nil {
return err
}
m.mu.Lock()
l.lastText = ""
m.mu.Unlock()
go func() {
err := p.s.Send(proseQuestionNudge)
if err != nil {
slog.Error("send prose question nudge", "session", l.id, "err", err)
}
}()
return nil
bounce, err := m.continueProseQuestion(ctx, l, p, final, success)
if err != nil || bounce {
return err
}
r := endResult{
+3 -23
View File
@@ -250,29 +250,9 @@ func (m *Manager) codexTurnCompleted(ctx context.Context, l *live, s *codex.Sess
final := l.lastText
m.mu.Unlock()
bounce := false
if turn.Status == codex.TurnStatusCompleted && l.implementer() {
var err error
bounce, err = m.takeBounce(ctx, l, final)
if err != nil {
return err
}
}
if bounce {
err := m.emit(ctx, l, "byre", "user.message", map[string]any{"text": proseQuestionNudge, "mid_turn": true, "bounce": true})
if err != nil {
return err
}
m.mu.Lock()
l.lastText = ""
m.mu.Unlock()
go func() {
_, err := s.Send(context.Background(), proseQuestionNudge)
if err != nil {
slog.Error("send prose question nudge", "session", l.id, "err", err)
}
}()
return nil
bounce, err := m.continueProseQuestion(ctx, l, codexProcess{s: s}, final, turn.Status == codex.TurnStatusCompleted)
if err != nil || bounce {
return err
}
res := endResult{
+4 -6
View File
@@ -63,10 +63,6 @@ func (m *Manager) bounceProseQuestion(l *live) claude.HookFunc {
if err != nil || !bounce {
return map[string]any{}, err
}
err = m.emit(ctx, l, "byre", "user.message", map[string]any{"text": proseQuestionNudge, "mid_turn": true, "bounce": true})
if err != nil {
return nil, err
}
return map[string]any{"decision": "block", "reason": proseQuestionNudge}, nil
}
}
@@ -91,12 +87,14 @@ func (m *Manager) takeBounce(ctx context.Context, l *live, final string) (bool,
}
m.mu.Lock()
defer m.mu.Unlock()
if l.asked || l.bounced || l.compacting {
m.mu.Unlock()
return false, nil
}
l.bounced = true
return true, nil
m.mu.Unlock()
err = m.emit(ctx, l, "byre", "user.message", map[string]any{"text": proseQuestionNudge, "mid_turn": true, "bounce": true})
return err == nil, err
}
func (m *Manager) taskGuidance(ctx context.Context, task api.Task) (string, error) {
+20
View File
@@ -324,3 +324,23 @@ func (p antigravityProcess) drive(m *Manager, l *live) {
}
}
}
func (m *Manager) continueProseQuestion(ctx context.Context, l *live, p agentProcess, final string, success bool) (bool, error) {
if !success || !l.implementer() {
return false, nil
}
bounce, err := m.takeBounce(ctx, l, final)
if err != nil || !bounce {
return false, err
}
m.mu.Lock()
l.lastText = ""
m.mu.Unlock()
go func() {
err := p.send(context.Background(), proseQuestionNudge, nil)
if err != nil {
slog.Error("send prose question nudge", "session", l.id, "err", err)
}
}()
return true, nil
}