chore: update stale tests

This commit is contained in:
can1357
2026-06-30 03:35:30 +02:00
parent 531b4d1e8f
commit d4be774eb2
2 changed files with 7 additions and 4 deletions
@@ -17,6 +17,7 @@ import { TempDir } from "@oh-my-pi/pi-utils";
import * as snapcompact from "@oh-my-pi/snapcompact";
const HANDOFF_SECRET = "HANDOFF_SECRET_TOKEN_12345";
const UNRENDERABLE_SNAPCOMPACT_TEXT = "\uE000\uE001\uE002\uE003\uE004\uE005\uE006\uE007\uE008\uE009";
describe("AgentSession handoff", () => {
// Immutable across the whole file: the model registry's synchronous bundled-model
@@ -451,7 +452,7 @@ describe("AgentSession handoff", () => {
const fixedPreparation: compactionModule.CompactionPreparation = {
firstKeptEntryId: lastEntryId,
messagesToSummarize: [
{ role: "user", content: [{ type: "text", text: "中文内容".repeat(100) }], timestamp: 1 },
{ role: "user", content: [{ type: "text", text: UNRENDERABLE_SNAPCOMPACT_TEXT.repeat(100) }], timestamp: 1 },
],
turnPrefixMessages: [],
recentMessages: [],
@@ -478,7 +479,7 @@ describe("AgentSession handoff", () => {
const fixedPreparation: compactionModule.CompactionPreparation = {
firstKeptEntryId: lastEntryId,
messagesToSummarize: [
{ role: "user", content: [{ type: "text", text: "中文内容".repeat(100) }], timestamp: 1 },
{ role: "user", content: [{ type: "text", text: UNRENDERABLE_SNAPCOMPACT_TEXT.repeat(100) }], timestamp: 1 },
],
turnPrefixMessages: [],
recentMessages: [],
@@ -11,6 +11,8 @@ import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage";
import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
import { TempDir } from "@oh-my-pi/pi-utils";
const UNRENDERABLE_SNAPCOMPACT_TEXT = "\uE000\uE001\uE002\uE003\uE004\uE005\uE006\uE007\uE008\uE009";
interface Harness {
session: AgentSession;
sessionManager: SessionManager;
@@ -42,7 +44,7 @@ async function createHarness(tempDir: TempDir, authStorage: AuthStorage, options
const settings = Settings.isolated({
"compaction.strategy": "snapcompact",
// Force a 1-token recent window so the post-turn cut always splits off the
// last turn and summarizes the seeded (CJK) history. With the default
// last turn and summarizes the seeded unrenderable history. With the default
// 20k window the cut keeps both tiny messages, leaving nothing for
// snapcompact's renderability preflight to scan.
"compaction.keepRecentTokens": 1,
@@ -153,7 +155,7 @@ describe("AgentSession auto-snapcompact local-blocker fallback", () => {
seedMessages: [
{
role: "user",
content: "你好,请帮我审查这段代码。它的逻辑似乎有问题,我无法理解为何返回空结果。",
content: UNRENDERABLE_SNAPCOMPACT_TEXT.repeat(10),
timestamp: Date.now(),
},
],