mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:51:25 +00:00
fix(session): prevent silent overflow on parent thread forks (#26912)
Lands #26912 from @markshields-tl with configurable session.parentForkMaxTokens and docs/tests/changelog updates. Co-authored-by: Mark Shields <239231357+markshields-tl@users.noreply.github.com>
This commit is contained in:
@@ -572,6 +572,22 @@ export async function runAgentTurnWithFallback(params: {
|
||||
}
|
||||
}
|
||||
|
||||
// If the run completed but with an embedded context overflow error that
|
||||
// wasn't recovered from (e.g. compaction reset already attempted), surface
|
||||
// the error to the user instead of silently returning an empty response.
|
||||
// See #26905: Slack DM sessions silently swallowed messages when context
|
||||
// overflow errors were returned as embedded error payloads.
|
||||
const finalEmbeddedError = runResult?.meta?.error;
|
||||
const hasPayloadText = runResult?.payloads?.some((p) => p.text?.trim());
|
||||
if (finalEmbeddedError && isContextOverflowError(finalEmbeddedError.message) && !hasPayloadText) {
|
||||
return {
|
||||
kind: "final",
|
||||
payload: {
|
||||
text: "⚠️ Context overflow — this conversation is too large for the model. Use /new to start a fresh session.",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
kind: "success",
|
||||
runId,
|
||||
|
||||
Reference in New Issue
Block a user