Skip to content

fix(auto-reply): commands in group chats lose their line breaks and indentation - #183606

Merged
obviyus merged 2 commits into
openclaw:mainfrom
L4XB:fix/group-commands-keep-multiline-args
Oct 25, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
L4XB:fix/group-commands-keep-multiline-args

Conversation

@L4XB

@L4XB L4XB commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Slash commands in group chats lose argument line breaks and indentation during mention removal. For example, /btw receives 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 shipped models auth login --provider openai --method device-code command.

Both refs ran in fresh isolated Linux Node 24.22.1 containers using their emitted pnpm build output. 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.

Runtime / capture boundary Main question received Candidate question received
Native Codex, app-server turn/start input Explain this stack: alpha() beta() Exact blank line and four/six-space indentation below
OpenClaw harness, observational capture at the emitted runBtwSideQuestion turn-input boundary Explain this stack: alpha() beta() Exact blank line and four/six-space indentation below

Candidate question, identical to the original command arguments:

Explain this stack:

    alpha()
      beta()

The real model answers were recorded at the outgoing Connector, not substituted by fixtures:

  • Native Codex main: “alpha() and beta() are function calls”, followed by an explanation of caller/stack order.
  • Native Codex candidate: “alpha() calls beta()”, identifying the caller and currently executing function.
  • OpenClaw harness candidate: “This is a simple call stack: alpha() called beta(). beta() is currently executing, while alpha() is paused until beta() returns.”
  • OpenClaw harness main: “alpha() beta() likely represents a call stack where alpha() called beta()”, 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_OK through 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 /btw tests 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 /btw tests 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.

…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.
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves slash-command line breaks and indentation after removing group-chat mentions.

Example: A group member sends @openclaw /btw Explain this stack:\n\n alpha()\n beta().

  • Before: The side question arrives as Explain this stack: alpha() beta().
  • After: The side question retains its blank line and four/six-space indentation.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, source-confirmed repair with shipped-entry-point proof, meaningful regressions, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Built OpenClaw Gateway and Teams webhook ingress exercised the changed mention owner in isolated Linux containers, with real-model turns and Connector replies; recorded agent input retained exact blank lines and indentation after the fix, and the production file is identical on the reviewed head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Pasted stack traces and structured questions lose blank lines and indentation when sent as group slash commands.
Reason: Restores documented multiline behavior through the existing shared owner without adding configuration, state, or another parsing path.

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
Reviewed head: 3278b92b437f7044f2ff43cc619f8ebaf0c40cf2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Group 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]
Loading

Technical review

Best 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

  • Final whitespace normalization in stripMentions changes intended behavior with a stated reason (72a9e58: The reply-flow split carried whitespace collapsing into the mention owner; no command-specific justification was found. The later merged multiline command repair establishes why free-text command arguments must now survive this earlier boundary.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Eden: Raw commit a61417f adds src/auto-reply/reply/mentions.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a61417fef406; files: src/auto-reply/reply/mentions.ts)

PR surface

Source +3, Tests +32. Total +35 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 2 32 0 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 36 1 +35

Review metrics

Metric Value Why it matters
Production versus test LOC Production +4/-1; tests +32/-0 Small shared-owner repair with a group command regression and an independent command-versus-prose normalization contract.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Group slash commands silently lose meaningful formatting, with limited impact on multiline command arguments.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-25T13:18:51.654Z sha 9234650 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T13:37:25.018Z sha 9234650 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T17:50:40.906Z sha 9234650 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T18:02:36.660Z sha 9234650 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-25T18:08:27.558Z sha 9234650 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-25T19:24:22.350Z sha 9234650 :: needs changes before merge. :: none

Reviewed October 25, 2026, 3:36 PM ET / 19:36 UTC (Revision 7).

@L4XB

L4XB commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 25, 2026
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

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 clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 25, 2026
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@obviyus
obviyus merged commit c0140eb into openclaw:main Oct 25, 2026
124 checks passed
@obviyus

obviyus commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Landed in c0140eb. Thanks @L4XB. Multi-line slash-command arguments now keep their formatting in group chats.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…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]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…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)
RomneyDa added a commit that referenced this pull request Oct 29, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants