-
-
Notifications
You must be signed in to change notification settings - Fork 69.1k
[Bug]: /status reply breaks transcript tree structure, causing apparent context loss #10821
Description
GitHub Issue — Ready to Submit
Title
/status reply breaks transcript tree structure, causing apparent context loss
Body
Description
After sending /status in webchat, the entire conversation context appears to be lost. The agent no longer remembers any prior conversation, and /status itself reports very low token counts (e.g., 15k/1M at 2%) despite having had hundreds of thousands of tokens in context moments before.
This has been reproduced twice in the same session within ~10 minutes.
Root Cause (from source code analysis)
When /status is processed, it correctly does NOT create an agent run (shouldContinue: false). However, the gateway's chat.send handler then appends the status reply to the transcript via appendAssistantTranscriptMessage (gateway-cli-D_8miTjF.js:6344-6355):
if (!agentRunStarted) {
const combinedReply = finalReplyParts.map(part => part.trim()).filter(Boolean).join("\n\n").trim();
if (combinedReply) {
const appended = appendAssistantTranscriptMessage({
message: combinedReply,
sessionId: latestEntry?.sessionId ?? entry?.sessionId ?? clientRunId,
...
});
}
}The problem: appendAssistantTranscriptMessage (gateway-cli-D_8miTjF.js:5998-6050) creates transcript entries without a parentId field:
const transcriptEntry = {
type: "message",
id: messageId,
// No parentId!
timestamp: new Date(now).toISOString(),
message: messageBody
};This creates a new root node in the transcript's tree structure. When the next agent run starts, buildSessionContext may follow this orphaned root instead of the actual conversation chain, resulting in a near-empty context.
Evidence
- Session ID remained the same throughout (
bf575334) — not a session replacement /statusentries in the transcript at L557 and L587 both haveparentId=NONE- Token count dropped from hundreds of thousands to ~15k immediately after
/status - Compaction count reset to 0
- Both incidents coincided with webchat reconnection events
Steps to Reproduce
- Have a long-running webchat session with significant context (100k+ tokens)
- Send
/status - Send a normal message
- Observe that the agent has lost all prior context
Expected Behavior
/status should not affect conversation context in any way.
Suggested Fix
Either:
- Don't write
/statusreplies to the transcript at all (preferred — it's metadata, not conversation) - Set
parentIdon the appended message to link it to the current leaf entry, preserving the tree structure
Environment
- OpenClaw 2026.2.3-1 (d84eb46)
- Model: claude-opus-4-6
- Channel: webchat
- OS: Linux 6.14.0-37-generic (x64)
Labels
bug, transcript, webchat