mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Session persistence moves from internal/runtime/agent to internal/state/sessionstore: the Session type, its checkpoint and event log, listing sidecars, branches, leases, recovery copies, migration, and the compaction and subagent records saved beside a transcript. The agent keeps the loop and imports the store; history, historycatalog, migration, guardian, instanceid and sessiontool now reach the store instead of the agent, which drops layer-order from 26 to 18. Tests that exercise only store internals moved with it; the rest stay in agent and qualify the moved names. DigestSessionMessages and CompactionStateSchemaV1 are exported for the agent tests that build legacy fixtures. Baseline: carried with -allow-widen. The moved files bring their essay, file-size, complexity and orphan debt unchanged under new paths, and boot.go, acp/service.go, serve/serve.go, agent/task.go and control/controller.go each gain the one import line the split costs.
34 lines
1.4 KiB
Go
34 lines
1.4 KiB
Go
package agent
|
|
|
|
import (
|
|
"reasonix/internal/state/sessionstore"
|
|
"testing"
|
|
|
|
"reasonix/internal/base/testenv"
|
|
"reasonix/internal/contract/event"
|
|
"reasonix/internal/contract/provider"
|
|
"reasonix/internal/runtime/agent/testutil"
|
|
)
|
|
|
|
// billedThinkingTokens stands in for a provider that charged for thinking whose
|
|
// text never arrived — the only shape a replay can actually recover.
|
|
const billedThinkingTokens = 64
|
|
|
|
// TestModelSilentToolCallReasoningIsNotReplayed pins the cost fix: a tool-call
|
|
// turn billed zero thinking tokens is ordinary model behaviour between tools,
|
|
// so it must neither replay the request nor consume the incident's one replay.
|
|
func TestModelSilentToolCallReasoningIsNotReplayed(t *testing.T) {
|
|
prov := toolCallReasoningRequiredProvider{testutil.NewMock("deepseek-proxy")}
|
|
a := New(prov, echoRegistry(), sessionstore.NewSession(""), Options{MissingReasoningWarnStateDir: testenv.TempDir(t)}, event.Discard)
|
|
calls := []provider.ToolCall{{ID: "c1", Name: "echo", Arguments: `{"text":"hi"}`}}
|
|
|
|
for round := 1; round <= 3; round++ {
|
|
if got := a.observeMissingToolCallReasoning(calls, "", 0); got != reasoningModelSilent {
|
|
t.Fatalf("silent round %d = %v, want %v", round, got, reasoningModelSilent)
|
|
}
|
|
}
|
|
if got := a.observeMissingToolCallReasoning(calls, "", billedThinkingTokens); got != reasoningLostReplay {
|
|
t.Fatalf("lost field after silent rounds = %v, want %v", got, reasoningLostReplay)
|
|
}
|
|
}
|