mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-29 11:46:12 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f80c5e1a0 |
@@ -4508,6 +4508,70 @@ describe("ClaudeAgentSession context window usage", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("settles the first tool call after a compaction whose summary is synthetic", async () => {
|
||||
// Claude Code 2.1.330 sends the compaction summary as a user message marked isSynthetic
|
||||
// (seen live after /compact), so it is skipped before it can consume the compaction state.
|
||||
const session = await createSessionForTurns([
|
||||
[
|
||||
createCompactingStatus(),
|
||||
createCompactBoundary({ compact_metadata: { trigger: "auto", pre_tokens: 167_000 } }),
|
||||
{
|
||||
type: "user",
|
||||
parent_tool_use_id: null,
|
||||
isSynthetic: true,
|
||||
message: {
|
||||
role: "user",
|
||||
content: "This session is being continued from a previous conversation.",
|
||||
},
|
||||
uuid: "compact-summary-1",
|
||||
session_id: "session-1",
|
||||
},
|
||||
{
|
||||
type: "assistant",
|
||||
parent_tool_use_id: null,
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: [
|
||||
{
|
||||
type: "tool_use",
|
||||
id: "toolu-after-compact",
|
||||
name: "Bash",
|
||||
input: { command: "ls" },
|
||||
},
|
||||
],
|
||||
},
|
||||
uuid: "assistant-after-compact",
|
||||
session_id: "session-1",
|
||||
},
|
||||
{
|
||||
type: "user",
|
||||
parent_tool_use_id: null,
|
||||
message: {
|
||||
role: "user",
|
||||
content: [{ type: "tool_result", tool_use_id: "toolu-after-compact", content: "a.go" }],
|
||||
},
|
||||
uuid: "tool-result-after-compact",
|
||||
session_id: "session-1",
|
||||
},
|
||||
createSuccessResult(),
|
||||
],
|
||||
]);
|
||||
|
||||
try {
|
||||
const events = await collectStreamEvents(session, "keep working");
|
||||
const statuses = events.flatMap((event) =>
|
||||
event.type === "timeline" &&
|
||||
event.item.type === "tool_call" &&
|
||||
event.item.callId === "toolu-after-compact"
|
||||
? [event.item.status]
|
||||
: [],
|
||||
);
|
||||
expect(statuses).toEqual(["running", "completed"]);
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("reports the plan mode Claude enters on its own with EnterPlanMode", async () => {
|
||||
// Claude Code announces a mode it switched to itself as a status message
|
||||
// carrying the new permissionMode, right after the EnterPlanMode tool call.
|
||||
|
||||
@@ -2698,7 +2698,6 @@ class ClaudeAgentSession implements AgentSession {
|
||||
private lastOptionsModel: string | null = null;
|
||||
private lastRuntimeModel: string | null = null;
|
||||
private readonly resultMeter = new ClaudeResultMeter();
|
||||
private compacting = false;
|
||||
private compactionMarkerOpen = false;
|
||||
private queryPumpPromise: Promise<void> | null = null;
|
||||
private queryRestartNeeded = false;
|
||||
@@ -5468,7 +5467,6 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
const status = toObjectRecord(message)?.status;
|
||||
if (status === "compacting") {
|
||||
this.compacting = true;
|
||||
// Claude Code repeats this status every 30 seconds until the compaction
|
||||
// finishes. Each repeat used to open its own marker, and the app only ever
|
||||
// resolves one of them, so the rest stayed on "Compacting..." forever.
|
||||
@@ -5554,11 +5552,10 @@ class ClaudeAgentSession implements AgentSession {
|
||||
message: Extract<SDKMessage, { type: "user" }>,
|
||||
events: AgentStreamEvent[],
|
||||
): Promise<void> {
|
||||
if (isSyntheticUserEntry(message)) {
|
||||
return;
|
||||
}
|
||||
if (this.compacting) {
|
||||
this.compacting = false;
|
||||
// The compaction summary is skipped by what it is, never by being the next user message:
|
||||
// Claude marks it synthetic (isCompactSummary in older streams), and a position-based skip
|
||||
// swallowed the first tool result after every compaction instead.
|
||||
if (isSyntheticUserEntry(message) || toObjectRecord(message)?.isCompactSummary === true) {
|
||||
return;
|
||||
}
|
||||
const messageId =
|
||||
|
||||
Reference in New Issue
Block a user