mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
fix(discord): cover compact gh failure traces
This commit is contained in:
@@ -625,7 +625,7 @@ async function processDiscordMessageInner(
|
||||
) => {
|
||||
if (isProcessAborted(abortSignal)) {
|
||||
// Surface so operators don't chase missing replies when an abort
|
||||
// drops a model-produced text payload (see PR for the incident).
|
||||
// drops a model-produced text payload.
|
||||
logVerbose(
|
||||
formatDiscordReplySkip({
|
||||
kind: info.kind,
|
||||
|
||||
@@ -308,6 +308,7 @@ describe("sanitizeUserFacingText", () => {
|
||||
const input = [
|
||||
"Visible intro.",
|
||||
"⚠️ 🛠️ `run openclaw definitely-not-a-real-subcommand (agent)` failed",
|
||||
"⚠️ 🛠️ gh search issues --repo openclaw/openclaw --state open --no-search-pages.jsonl /tmp/openclaw_open_unlabeled_current.json (agent) failed",
|
||||
"🛠️ run git status",
|
||||
"📖 Read: lines 1-40 from secret.md",
|
||||
"Visible outro.",
|
||||
|
||||
@@ -834,6 +834,7 @@ describe("sanitizeAssistantVisibleText", () => {
|
||||
const input = [
|
||||
"Visible intro.",
|
||||
"⚠️ 🛠️ `run openclaw definitely-not-a-real-subcommand (agent)` failed",
|
||||
"⚠️ 🛠️ gh search issues --repo openclaw/openclaw --state open --no-search-pages.jsonl /tmp/openclaw_open_unlabeled_current.json (agent) failed",
|
||||
"🛠️ run git status",
|
||||
"Visible outro.",
|
||||
].join("\n");
|
||||
|
||||
@@ -15,8 +15,10 @@ const INTERNAL_TRACE_LINE_QUICK_RE =
|
||||
/(?:📊|🛠️|📖|📝|🔍|🔎|⚙️|tool[-_ ]?call|tool[-_ ]?result|function[-_ ]?call)/i;
|
||||
const INTERNAL_TRACE_LINE_RE =
|
||||
/^(?:>\s*)?(?:⚠️\s*)?(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i;
|
||||
const INTERNAL_COMPACT_FAILURE_TRACE_LINE_RE =
|
||||
/^(?:>\s*)?⚠️\s*🛠️\s+\S[\s\S]*\s+\(agent\)`{0,2}\s+failed\s*$/i;
|
||||
const INTERNAL_COMPACT_COMMAND_TRACE_LINE_RE =
|
||||
/^(?:>\s*)?(?:⚠️\s*)?🛠️\s*(?:(?:(?:elevated|pty)\b\s*(?:·|,)\s*)+)?(?:`{1,2}\s*\S|(?:run|check|fetch|pull|push|view|show|list|switch|create|merge|rebase|stage|restore|reset|stash|search|find|print|copy|move|remove|install|start|cd|git|pnpm|npm|yarn|bun|node|python|python3|bash|sh)\b)/i;
|
||||
/^(?:>\s*)?🛠️\s*(?:(?:(?:elevated|pty)\b\s*(?:·|,)\s*)+)?(?:`{1,2}\s*\S|(?:run|check|fetch|pull|push|view|show|list|switch|create|merge|rebase|stage|restore|reset|stash|search|find|print|copy|move|remove|install|start|cd|git|pnpm|npm|yarn|bun|node|python|python3|bash|sh)\b)/i;
|
||||
const INTERNAL_CHANNEL_TRACE_LINE_RE =
|
||||
/^(?:>\s*)?(?:tool[-_ ]?call|tool[-_ ]?result|function[-_ ]?call)\s*[:=]/i;
|
||||
|
||||
@@ -785,6 +787,7 @@ export function stripAssistantInternalTraceLines(text: string): string {
|
||||
const shouldStrip =
|
||||
!isInsideCode(lineStart, codeRegions) &&
|
||||
(INTERNAL_TRACE_LINE_RE.test(trimmed) ||
|
||||
INTERNAL_COMPACT_FAILURE_TRACE_LINE_RE.test(trimmed) ||
|
||||
INTERNAL_COMPACT_COMMAND_TRACE_LINE_RE.test(trimmed) ||
|
||||
INTERNAL_CHANNEL_TRACE_LINE_RE.test(trimmed));
|
||||
if (!shouldStrip) {
|
||||
|
||||
Reference in New Issue
Block a user