Skip to content

Commit 415e398

Browse files
authored
fix: align and correct eventBelongsToBranch to match _is_event_belongs_to_branch in adk-python (#437)
1 parent 5c47306 commit 415e398

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal/llminternal/contents_processor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func buildContentsDefault(agentName, invocationBranch string, events []*session.
123123
}
124124

125125
func eventBelongsToBranch(invocationBranch string, event *session.Event) bool {
126-
if invocationBranch == "" {
126+
if invocationBranch == "" || event.Branch == "" {
127127
return true
128128
}
129129
if event.Branch == invocationBranch {

internal/llminternal/contents_processor_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,18 @@ func TestContentsRequestProcessor(t *testing.T) {
335335
Content: genai.NewContentFromText("In branch 2", "user"),
336336
},
337337
},
338+
{
339+
Author: "user",
340+
Branch: "",
341+
LLMResponse: model.LLMResponse{
342+
Content: genai.NewContentFromText("empty branch", "user"),
343+
},
344+
},
338345
},
339346
want: []*genai.Content{
340347
genai.NewContentFromText("In branch 1", "user"),
341348
genai.NewContentFromText("In branch 1 and task 1", "user"),
349+
genai.NewContentFromText("empty branch", "user"),
342350
},
343351
},
344352
{

0 commit comments

Comments
 (0)