fix: preserve conversation history on gateway restart#10060
fix: preserve conversation history on gateway restart#10060openperf wants to merge 72 commits intoopenclaw:mainfrom
Conversation
cdeb69f to
cfe7b73
Compare
|
Hi! This PR is ready for review. |
cfe7b73 to
e465f23
Compare
9c56667 to
944ea89
Compare
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 8ed13fb Co-authored-by: nicholascyh <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
- Add 'minimax-api-key-cn' auth choice for Chinese users - Reuse existing --minimax-api-key CLI option - Use MINIMAX_CN_API_BASE_URL (https://api.minimaxi.com/anthropic) - Similar to how moonshot supports moonshot-api-key-cn Tested: build ✅, check ✅, test ✅
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
2 similar comments
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
17 similar comments
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
|
Closing this PR because it has more than 20 labels, which usually means the branch is too noisy. Please recreate the PR from a clean branch. |
This PR fixes issue #10018, where a boot message injected after a gateway restart would create a new session branch, orphaning the previous conversation history.
Problem
When the gateway restarts, it sends a notification message (e.g., "Gateway restarted"). This message was being delivered to external channels (like Slack/Telegram) via
deliverOutboundPayloadsbut was not being written to the session transcript. This caused a gap in the conversation history.An earlier attempt to fix this involved replacing
deliverOutboundPayloadswith a fullagentCommandrun. However, this was an incorrect approach as it introduced significant overhead and unintended side effects (like triggering a full AI agent run for a simple notification).Solution
This PR implements a lightweight and safe solution by separating the concerns:
deliverOutboundPayloads: The original function for sending external notifications remains unchanged, preserving its low-overhead behavior.writeAssistantMessageToTranscriptis introduced. This function is called right beforedeliverOutboundPayloadsand is responsible for writing the restart message directly to the session transcript.This new function leverages the existing
SessionManagerto ensure the message is appended correctly to the conversation tree, automatically handling theparentIdand preserving the history chain.This approach cleanly fixes the bug without altering the original notification behavior, ensuring both safety and correctness.
Greptile Overview
Greptile Summary
This PR threads an optional
parentIdthrough the restart-sentinel →agentCommand→ embedded agent execution path, and addsreadSessionLeafId()to read the last transcript entry ID so the gateway’s injected boot message is appended to the existing conversation branch rather than starting a new root after restart.The new helper mirrors existing transcript tail-reading utilities (
readLastMessagePreviewFromTranscript) by scanning a bounded window at the end of the JSONL transcript and returning the last parseable entry with anid.Confidence Score: 4/5
storePathargument type, which will make the test unreliable or fail in CI.