Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ func ensureToolResults(msgs []llm.Message) []llm.Message {
// outside it. Reversing that order lets a turn whose result was compacted
// away reach forward and take the result of a later turn sharing its id,
// leaving the live call with a stub and the model with stale output.
byID := make(map[string][]int)
byID := make(map[string][]int, len(msgs))
for i, m := range msgs {
if m.Role == llm.RoleTool {
byID[m.ToolCallID] = append(byID[m.ToolCallID], i)
Expand All @@ -1255,7 +1255,7 @@ func ensureToolResults(msgs []llm.Message) []llm.Message {
end int
bound []int // parallel to the turn's ToolCalls; -1 until a result binds
}
var turns []turn
turns := make([]turn, 0, len(msgs))
for i, m := range msgs {
if m.Role != llm.RoleAssistant {
continue
Expand Down
2 changes: 1 addition & 1 deletion internal/agent/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (a *Agent) Panel(ctx context.Context, question string, models []string, emi
}
wg.Wait()

var usable []PanelAnswer
usable := make([]PanelAnswer, 0, len(answers))
for _, ans := range answers {
if ans.Err == "" && strings.TrimSpace(ans.Answer) != "" {
usable = append(usable, ans)
Expand Down
2 changes: 1 addition & 1 deletion internal/server/handlers_engagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (s *Server) handleEngagementSessions(w http.ResponseWriter, r *http.Request
Findings int `json:"findings"`
Intel int `json:"intel"`
}
out := make([]row, 0)
out := make([]row, 0, len(sessions))
for _, sess := range sessions {
f, intel := 0, 0
if s.agent.Findings() != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/store/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *sqlStore) ListMemories(ctx context.Context, scope, scopeKey string, lim
return nil, err
}
defer rows.Close()
out := []Memory{}
out := make([]Memory, 0, limit)
for rows.Next() {
m, err := scanMemory(rows)
if err != nil {
Expand Down Expand Up @@ -103,7 +103,7 @@ func (s *sqlStore) SearchMemories(ctx context.Context, query string, limit int)
}
}
defer rows.Close()
out := []Memory{}
out := make([]Memory, 0, limit)
for rows.Next() {
m, err := scanMemory(rows)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/store/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (s *sqlStore) ListCronRuns(ctx context.Context, jobID string, limit int) ([
return nil, err
}
defer rows.Close()
out := []CronRun{}
out := make([]CronRun, 0, limit)
for rows.Next() {
var (
r CronRun
Expand Down
4 changes: 2 additions & 2 deletions internal/store/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (s *sqlStore) ListSessions(ctx context.Context, f SessionFilter) ([]Session
}
defer rows.Close()

out := []Session{}
out := make([]Session, 0, limit)
for rows.Next() {
sess, err := scanSession(rows)
if err != nil {
Expand Down Expand Up @@ -326,7 +326,7 @@ func (s *sqlStore) SearchMessages(ctx context.Context, query string, limit int)
}
defer rows.Close()

out := []SearchHit{}
out := make([]SearchHit, 0, limit)
for rows.Next() {
var (
h SearchHit
Expand Down
Loading