fix test
This commit is contained in:
parent
8e7dd60a8b
commit
331edc332d
|
|
@ -729,14 +729,14 @@ func (s *agent) Inject(prompt string) {
|
|||
s.fifo.Push(prompt)
|
||||
return
|
||||
}
|
||||
emit(s.cfg, Event{Role: "info", Content: "\n"})
|
||||
emit(s.cfg, Event{Role: "user", Content: prompt})
|
||||
s.emit(Event{Role: "info", Content: "\n"})
|
||||
s.emit(Event{Role: "user", Content: prompt})
|
||||
}
|
||||
|
||||
func (s *agent) injectRewrite(prompt string) {
|
||||
s.pendingInject.Store(&prompt)
|
||||
emit(s.cfg, Event{Role: "info", Content: "\n"})
|
||||
emit(s.cfg, Event{Role: "user", Content: prompt})
|
||||
s.emit(Event{Role: "info", Content: "\n"})
|
||||
s.emit(Event{Role: "user", Content: prompt})
|
||||
}
|
||||
|
||||
func (s *agent) Queue(prompt string) {
|
||||
|
|
@ -1074,7 +1074,7 @@ func (s *agent) executeTurn(ctx context.Context, input string) string {
|
|||
if limit <= 0 || s.session.estimateTokens() < limit {
|
||||
return
|
||||
}
|
||||
emit(s.cfg, Event{Role: "info", Content: "auto-compacting context...\n"})
|
||||
s.emit(Event{Role: "info", Content: "auto-compacting context...\n"})
|
||||
s.setState("compacting")
|
||||
if _, err := s.runCompact(ctx, "auto"); err != nil {
|
||||
panic(fmt.Sprintf("mid-turn auto-compact: %v", err))
|
||||
|
|
@ -1086,7 +1086,7 @@ func (s *agent) executeTurn(ctx context.Context, input string) string {
|
|||
if s.session != nil {
|
||||
tokens := s.session.estimateTokens()
|
||||
if compactLimit := s.autoCompactLimit(ctx); compactLimit > 0 && tokens >= compactLimit {
|
||||
emit(s.cfg, Event{Role: "info", Content: "auto-compacting context...\n"})
|
||||
s.emit(Event{Role: "info", Content: "auto-compacting context...\n"})
|
||||
s.setState("compacting")
|
||||
if _, err := s.runCompact(ctx, "auto"); err != nil {
|
||||
panic(fmt.Sprintf("auto-compact: %v", err))
|
||||
|
|
@ -1098,7 +1098,7 @@ func (s *agent) executeTurn(ctx context.Context, input string) string {
|
|||
ctxLen = defaultContextLength
|
||||
}
|
||||
pct := tokens * 100 / ctxLen
|
||||
emit(s.cfg, Event{Role: "info", Content: fmt.Sprintf("context at %d%% — will auto-compact at 75%%\n", pct)})
|
||||
s.emit(Event{Role: "info", Content: fmt.Sprintf("context at %d%% — will auto-compact at 75%%\n", pct)})
|
||||
s.warnedContext = true
|
||||
}
|
||||
}
|
||||
|
|
@ -1145,7 +1145,7 @@ func (s *agent) executeTurn(ctx context.Context, input string) string {
|
|||
if !overflowRetried && errors.As(err, &ctxErr) && s.session != nil {
|
||||
overflowRetried = true
|
||||
s.session.messages = snapMessages
|
||||
emit(s.cfg, Event{Role: "info", Content: "context overflow — compacting and retrying...\n"})
|
||||
s.emit(Event{Role: "info", Content: "context overflow — compacting and retrying...\n"})
|
||||
s.setState("compacting")
|
||||
if _, cerr := s.runCompact(ctx, "overflow"); cerr != nil {
|
||||
break
|
||||
|
|
|
|||
Reference in New Issue