Repository navigation
fix(auto-reply): commands in group chats lose their line breaks and indentation - #183606
Conversation
…p chats In groups the command text goes through stripMentions, which collapsed every run of whitespace, so /btw questions, /loop prompts and /dashboard requests arrived as one line. A slash command now leaves stripMentions trimmed but otherwise as a direct message passes it on; other text still has its whitespace collapsed.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPreserves slash-command line breaks and indentation after removing group-chat mentions. Example: A group member sends
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current group-command formatting bug with a focused change and no actionable findings; the earlier merge conflict is resolved, and current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGroup messages pass through shared mention removal before command normalization and dispatch; the resulting arguments become the side-question runner's input. flowchart LR
A[Group message] --> B[Mention removal]
B --> C[Command normalization]
C --> D[BTW handler]
D --> E[Agent runtime]
E --> F[Channel reply]
Technical reviewBest possible solution: Land the existing shared mention-removal repair once current-head required CI passes. Do we have a high-confidence way to reproduce the issue? The supplied real-Gateway A/B run shows flattened input on main and preserved input on the candidate; current-main source confirms the same group-only whitespace collapse. Is this the best way to solve the issue? This is the smallest complete fix: mention removal preserves command argument bytes, and the existing command normalizer continues owning command-specific argument policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ffea09090176. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +32. Total +35 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 25, 2026, 3:36 PM ET / 19:36 UTC (Revision 7). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Parking this one for now. The fix is proven end to end on head 9234650: built Gateway, real Teams group ingress and command dispatch, and a real local model (Qwen2.5 0.5B via Ollama). On main the /btw question arrives flattened; with this change the blank lines and indentation arrive exactly. The automated review still asks for a hosted real-model capture, which this loop can't produce right now. A maintainer can land it on this evidence, or it can wait for a hosted-model run. Thanks @L4XB. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…ndentation (openclaw#183606) fix(auto-reply): keep multiline slash-command arguments intact in group chats In group conversations, slash-command arguments lost their line breaks and indentation before they reached the command handler, so a multi-line `/btw` question arrived flattened onto one line. Group mention handling now keeps the argument text as sent. Evidence: built Gateway with real Microsoft Teams group ingress and command dispatch, and the real OpenAI model gpt-5.6-sol through both the native Codex runtime and OpenClaw's own harness, using a ChatGPT login with no API key. On main the turn received the question flattened; with this change it received the exact blank lines and 4- and 6-space indentation, and real answers came back through the Teams Connector. Earlier local-fixture and local Ollama runs showed the same difference. A focused regression fails with the production change reverted. Production change is in mentions.ts only. Thanks @L4XB. Co-authored-by: Ayaan Zaidi <[email protected]>
…ndentation (#183606) fix(auto-reply): keep multiline slash-command arguments intact in group chats In group conversations, slash-command arguments lost their line breaks and indentation before they reached the command handler, so a multi-line `/btw` question arrived flattened onto one line. Group mention handling now keeps the argument text as sent. Evidence: built Gateway with real Microsoft Teams group ingress and command dispatch, and the real OpenAI model gpt-5.6-sol through both the native Codex runtime and OpenClaw's own harness, using a ChatGPT login with no API key. On main the turn received the question flattened; with this change it received the exact blank lines and 4- and 6-space indentation, and real answers came back through the Teams Connector. Earlier local-fixture and local Ollama runs showed the same difference. A focused regression fails with the production change reverted. Production change is in mentions.ts only. Thanks @L4XB. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit c0140eb) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit d3ffae42065a6f330c7cb83e60fa77f04e840c03)
…nd realign npm override fixture (#187562) * fix(plugins): restore non-blocking setup artifact retirement on release Revert the stray plugin-instance.ts hunk carried into the release backport of #183606 (an auto-reply-only change on main), which tracked module release in the caller's work scope and made setup cache retirement wait on artifact removal. Realign the matching release-only owner-drain assertion added with #181675 to the main test. * test(plugins): expect nested npm form for exact-parent overrides #187293 intentionally maps pnpm exact-parent selectors ([email protected]>child) to npm's nested override form on this train. Realign the npm-spec selector fixture to that behavior; the npm-alias retry still drops it.
What Problem This Solves
Slash commands in group chats lose argument line breaks and indentation during mention removal. For example,
/btwreceives a flattened stack trace instead of the user's multiline question.Preserve whitespace for slash-command text after removing mentions; ordinary non-command text retains existing normalization. Thanks @L4XB for the fix and regressions.
Evidence
Real-model A/B proof: real OpenAI model via OpenClaw's native Codex runtime and a ChatGPT login; no API key. Also exercised OpenClaw's own harness with
agentRuntime.id: "openclaw"and an OpenAI OAuth profile imported using the shippedmodels auth login --provider openai --method device-codecommand.Both refs ran in fresh isolated Linux Node 24.22.1 containers using their emitted
pnpm buildoutput. Post-build budget and SDK export checks failed on both refs after artifact emission; these are inherited build-check failures, not a passing full-build claim. The actual Teams plugin received group messages through its Gateway webhook and delivered answers to an external loopback Teams Connector. A normal real-model turn established the conversation before/btw.The real OpenAI model was selected from the native app-server's authenticated model catalog. Main proof:
ba9f1eacbd0d0193081a2fc73c3759a2d6cad701. Candidate proof:9234650315392ecb8d56ccca74a6dca8519a8d48.turn/startinputExplain this stack: alpha() beta()runBtwSideQuestionturn-input boundaryExplain this stack: alpha() beta()Candidate question, identical to the original command arguments:
The real model answers were recorded at the outgoing Connector, not substituted by fixtures:
alpha()andbeta()are function calls”, followed by an explanation of caller/stack order.alpha()callsbeta()”, identifying the caller and currently executing function.alpha()calledbeta().beta()is currently executing, whilealpha()is paused untilbeta()returns.”alpha() beta()likely represents a call stack wherealpha()calledbeta()”, followed by caller/executing-function details.The regression oracle is the exact question text received by the agent turn, not answer wording. No hosted API key or custom provider endpoint was used. Account identifiers, emails, IPs and credentials are excluded from the captures.
Earlier supporting proof: deterministic Responses fixture delivered
GROUP_COMMAND_OKthrough the same group ingress and Connector, twice per ref; a real local Ollama Qwen2.5 0.5B run independently showed the same flattened/preserved input difference. Previously recorded 31 focused mention and/btwtests and scoped Oxfmt/Oxlint passed.Merged current main to resolve the test conflict, preserving main's consolidated multiline case and adding the distinct group-command regression. The PR's only changed production file,
mentions.ts, is byte-identical to the real-model candidate above, so that proof carries forward.On merged head
3278b92b437f7044f2ff43cc619f8ebaf0c40cf2, scoped Oxfmt/Oxlint pass and all 29 focused mention and/btwtests pass in the isolated container. Reverting only the production change makes the new group regression fail with the expected flattened text instead of blank lines and indentation.Simplification: retain the existing mention-removal owner and change only its command whitespace result. No alternate parser/state/policy. Production +4/-1, tests +32/-0; no further machinery to remove.
Merge danger: two-way door, fully revertible. Blast radius is whitespace in group slash-command arguments; ordinary group prose normalization and permissions are unchanged.