ci / vet-and-test (pull_request) Successful in 48s
Why: Real-run before/after evidence (phase01 card) showed later turns never re-read the uploaded source (0 original reads in plan-followup) because the attachment only existed in the current turn's injection and the context window hard default was 32000 chars - a 25k-char transcript tripped the clear-on-first request, replacing old tool results with a pointer the model has no tool to follow. MiniMax is an interleaved-thinking model whose docs require <think> blocks in assistant history; dropping them degrades later turns. Evidence: SELF - new tests TestThinkReplayWrapsAssistantHistory, TestContextWindowScalesFromTokens, TestThinkReplayEnabled, TestPersistInputTextsAndListWorkspaceInputs; go test ./internal/... passes; live before/after comparison on the golden task set recorded on the phase02 task card per the new policy clause. Impact: models.chat.contextWindow/outputReserve/contextBuffer (tokens, defaults 128k/16k/4k) drive the in-run clear threshold, converted to chars; cleared tool results spill to <sandbox>/.agent/results with readable paths; attachment parse text persists as inputs/<name>.md and the env section lists all workspace inputs every turn; context.thinkReplay (auto|on|off, auto = MiniMax) replays thinking blocks into request-side assistant history only.
26 lines
911 B
Go
26 lines
911 B
Go
package ctxasm
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
core "agent-system-core"
|
|
)
|
|
|
|
func TestSummarizeBeyondInjectsExtract(t *testing.T) {
|
|
var history []core.Message
|
|
for i := 0; i < 5; i++ {
|
|
history = append(history, core.Message{ID: core.ID("m"), Role: core.RoleUser, Parts: []core.Part{{Type: core.PartText, Text: "早期事实"}}})
|
|
}
|
|
current := core.Message{ID: "cur", Role: core.RoleUser, Parts: []core.Part{{Type: core.PartText, Text: "现在"}}}
|
|
prof := core.AgentProfile{Context: core.ContextPolicy{MaxHistoryMessages: 2, SummarizeBeyond: true}}
|
|
msgs, rep := AssembleInput(prof, core.EffectiveSettings{}, history, current, nil, nil, nil, nil, nil, nil, AssembleOptions{})
|
|
joined := ""
|
|
for _, m := range msgs {
|
|
joined += m.Content
|
|
}
|
|
if !strings.Contains(joined, "更早对话摘要") || !strings.Contains(joined, "早期事实") {
|
|
t.Fatalf("summary missing: %s items=%v", joined, rep.Items)
|
|
}
|
|
}
|