MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestPackKeepsPairedToolMessage

Function TestPackKeepsPairedToolMessage

internal/ctx/ctx_test.go:176–186  ·  view source on GitHub ↗

TestPackKeepsPairedToolMessage: a healthy assistant+tool pair that fits the budget stays intact: don't regress into dropping good pairs.

(t *testing.T)

Source from the content-addressed store, hash-verified

174// TestPackKeepsPairedToolMessage: a healthy assistant+tool pair that fits the
175// budget stays intact: don't regress into dropping good pairs.
176func TestPackKeepsPairedToolMessage(t *testing.T) {
177 history := []Message{
178 {Role: RoleAssistant, ToolCalls: []ToolCall{{ID: "c1", Name: "bash"}}},
179 {Role: RoleTool, ToolCallID: "c1", Content: "ok"},
180 {Role: RoleAssistant, Content: "done"},
181 }
182 r := Pack(history, 10000)
183 if len(r.Messages) != 3 {
184 t.Fatalf("all 3 messages should be kept, got %d: %+v", len(r.Messages), r.Messages)
185 }
186}
187
188// TestPackKeepsNewestToolPairOverBudget: when the newest message is a tool
189// result and its owning assistant won't fit the budget, Pack must keep the pair

Callers

nothing calls this directly

Calls 1

PackFunction · 0.85

Tested by

no test coverage detected