Skip to content

fix(auto-reply): add localized abort triggers - #181990

Open
alosslessdev wants to merge 1 commit into
openclaw:mainfrom
alosslessdev:fix/localized-abort-triggers
Open

alosslessdev wants to merge 1 commit into
openclaw:mainfrom
alosslessdev:fix/localized-abort-triggers

Conversation

@alosslessdev

@alosslessdev alosslessdev commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary

Resubmission of #61075 (and test-only #61067), rebased on current main with the review findings fixed.

  • Problem: abort detection recognized stop/interrupt commands mostly in English and a few other languages, so users speaking Spanish, French, Hindi, or Arabic could not reliably halt a run in an emergency.
  • Why it matters: safety and accessibility. Users need to stop agent execution in their native language.
  • What changed: added localized stop/interrupt phrases to the shared ABORT_TRIGGERS set in src/auto-reply/reply/abort-trigger-text.ts, and matching positive/negative cases in src/auto-reply/reply/abort.detection.cases.ts.
  • What did NOT change: the matching logic. It is still an exact match after lowercase/whitespace/trailing-punctuation normalization, and /stop handling is untouched.

Review findings addressed

  • French: replaced the source/test mismatch. "avorter" is not used; French now uses the computing terms "abandonner" and "interrompre" in both source and tests.
  • Test coverage: every added trigger has a positive assertion, and all 66 entries in ABORT_TRIGGERS are covered by the positives list, including capitalization and punctuation normalization through isAbortRequestText.
  • False positives: added negative assertions showing that multi-word uses of the new words do not match ("para ti", "no lo hagas ahora", "basta de esto", "alto el fuego", "cancel that meeting").
  • Trailing whitespace removed from the Hindi test lines; git diff --check passes.
  • Rebased onto current main (the trigger set moved to abort-trigger-text.ts since the original PR).

What Problem This Solves

Abort detection only recognized stop/interrupt words in English plus a few languages, so a Spanish, French, Hindi, or Arabic speaker could not reliably halt an active run by typing a stop command. This PR adds the missing standalone phrases to the shared trigger set so those users can abort in their native language.

Evidence

Focused test on this head:

$ pnpm test src/auto-reply/reply/abort.test.ts -t "isAbortTrigger matches standalone abort trigger phrases" --maxWorkers=1
Test Files  1 passed (1)
     Tests  1 passed | 32 skipped (33)

Direct production-boundary run with tsx (isAbortTrigger + isAbortRequestText):

PASS abort(true) request(true) <- "para"
PASS abort(true) request(true) <- "no lo hagas"
PASS abort(true) request(true) <- "basta"
PASS abort(true) request(true) <- "abandonner"
PASS abort(true) request(true) <- "interrompre"
PASS abort(true) request(true) <- "रुकिए"
PASS abort(true) request(true) <- "बंद करो"
PASS abort(true) request(true) <- "قف"
PASS abort(true) request(true) <- "إلغاء"
PASS abort(true) request(true) <- "cancel"
PASS reject abort(false) request(false) <- "para ti"
PASS reject abort(false) request(false) <- "no lo hagas ahora"
PASS reject abort(false) request(false) <- "alto el fuego"
PASS reject abort(false) request(false) <- "cancel that meeting"
PASS reject abort(false) request(false) <- "please wait"

git diff --check passes.

Live Gateway trace (fresh isolated state)

Current head running from source with an isolated config/state, the real Gateway chat.send ingress, and a real model request (opencode-go/deepseek-v4.1-flash). Token and API key omitted.

[+0.1s] START {"runId":"trace2-start-1","status":"started"}
[+2.7s] ABORT_PHRASE {"ok":true,"aborted":true,"runIds":["trace2-start-1"]}
[+4.3s] CONTAINING_SENTENCE {"runId":"trace2-normal-1","status":"started"}
[+6.4s] HISTORY [{"role":"user","text":"Write a 6000-word detailed essay ..."},
                  {"role":"user","text":"para ti, what time is it in UTC?"},
                  {"role":"assistant","text":"I'll check the actual clock rather than guess. "}]

The same run in the Gateway log:

[diagnostic] lane task error: ... error="agent run aborted" errorName=AbortError taskKind=turn sessionKey=agent:main:proof-trace-2 runId=trace2-start-1
[model-fallback/decision] model fallback chain stopped: reason=caller_signal_aborted candidate=opencode-go/deepseek-v4.1-flash errorName=AbortError

Pre-fix comparison on the published [email protected] release with a fresh state dir: the same phrase was accepted as normal text instead of aborting ({"runId":"up-old-phrase","status":"started"}).

The upgrade leg was also exercised: a fresh state was created by published [email protected], that Gateway was stopped, and the current head was started on the same state. With existing settings intact:

[+4.4s] START {"runId":"upg2-start","status":"started"}
[+19.1s] ABORT_PHRASE {"ok":true,"aborted":true,"runIds":["upg2-start"]}
[+20.7s] CONTAINING_SENTENCE {"runId":"upg2-normal","status":"started"}
[+45.0s] HISTORY [{"role":"user","text":"para ti, what time is it in UTC?"},
                   {"role":"toolResult","text":"... UTC"},
                   {"role":"assistant","text":"**00:15 UTC** — Saturday, October 24, 2026. ..."}]

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

User-visible / Behavior Changes

A message that is exactly one of the added phrases now stops the active run, the same as the existing English/Spanish/Japanese/etc. triggers. Phrases that merely contain one of the words are not affected because matching stays exact.

Security Impact

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No

Human Verification

  • Verified scenarios: ran an isolated real Gateway from this head, started a long model run, and sent "बंद करो" as a second chat.send; the Gateway returned {"ok":true,"aborted":true,"runIds":["trace2-start-1"]} and logged agent run aborted / AbortError. A containing sentence ("para ti, what time is it in UTC?") was then accepted as a normal run and answered.
  • Pre-fix behavior: the published [email protected] release accepted the same phrase as normal text (status:"started") on a fresh state dir.
  • Edge cases checked: multi-word phrases containing the new triggers do not match; uppercase and trailing punctuation are normalized as before.
  • Test proof: pnpm test src/auto-reply/reply/abort.test.ts -t "isAbortTrigger matches standalone abort trigger phrases" --maxWorkers=1 -> Test Files 1 passed (1), Tests 1 passed | 32 skipped.
  • What I did not verify: live channel delivery for each language (no bot credentials); the trace used the Gateway chat.send ingress.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No

Risks and Mitigations

  • Risk: short standalone words such as "para", "alto", "corta", and "cancel" are consumed as abort requests when sent alone.
    • Mitigation: matching is exact after normalization, so normal sentences are unaffected; negative cases cover the common multi-word uses. This is the same tradeoff already accepted for "pare" and the other single-word triggers.
  • Risk: none for orchestration/state; the change only expands a static string set.

@clawsweeper

clawsweeper Bot commented Oct 23, 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.

@alosslessdev

Copy link
Copy Markdown
Author

Resubmitted from #61075 (test-only #61067 folded in) because the old PR could not be reopened. Changes on this head:

  • Rebased on current main; the trigger set now lives in src/auto-reply/reply/abort-trigger-text.ts.
  • French review finding: "avorter" is gone from both source and tests; French uses "abandonner" and "interrompre".
  • Every new phrase has a positive assertion; added negative assertions for multi-word false positives ("para ti", "no lo hagas ahora", "basta de esto", "alto el fuego", "cancel that meeting").
  • Removed the Hindi trailing whitespace; git diff --check passes.

Evidence:

$ pnpm test src/auto-reply/reply/abort.test.ts -t "isAbortTrigger matches standalone abort trigger phrases" --maxWorkers=1
Test Files  1 passed (1)
     Tests  1 passed | 32 skipped (33)

I also exercised the production boundary directly with tsx (isAbortTrigger + isAbortRequestText): all 10 added-language positives and all 5 negative phrase checks returned the expected result.

@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. labels Oct 23, 2026
Expand the shared abort trigger set with Spanish, French, Hindi, and
Arabic stop phrases plus English "cancel" so users can halt an agent in
their native language. Keep French on computing terms ("abandonner",
"interrompre") and cover every new phrase with positive and negative
detection cases.
@alosslessdev
alosslessdev force-pushed the fix/localized-abort-triggers branch from ef6ef9b to 1ad34d1 Compare October 23, 2026 22:57
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds 23 standalone abort phrases and recognition cases for English, Spanish, French, Hindi, and Arabic.

Example: An authorized user sends "बंद करो" during an active Gateway run.

  • Before: The phrase enters the normal message path.
  • After: The phrase aborts the active run.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The supplied Gateway and upgrade traces adequately prove the focused implementation; readiness remains capped by the unresolved vocabulary direction.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): Exact-head logs exercise the shared recognizer through real Gateway chat.send with a real model: बंद करो aborts an active run, while a containing sentence is answered normally, on both fresh and v2026.10.6-created state; the updated upgrade trace resolves the previous proof blocker.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Users typing these native-language stop phrases cannot currently halt a run through the plain-text shortcut.
Reason: The patch adds useful vocabulary through the existing owner, but selecting additional global defaults is a product choice that conflicts with the earlier preference for configurable phrases.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open for an owner decision on global abort vocabulary; the focused patch has no concrete correctness finding, but prior discussion favors configurable phrases.

Priority: P2
Reviewed head: 1ad34d151f9408eb8a71956305d36956d892d6be
Owner decision: Required. See Decision needed.

Decision needed

Before merge

  • Await maintainer action - The feature owner must approve these global abort defaults or choose the configurable-vocabulary direction.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Missing end-to-end proof: No red-on-base test execution is recorded, although the source and published-release comparison establish the pre-fix difference.
Agent review details

How this fits together

The shared recognizer classifies normalized inbound text for channel routing, Gateway chat, and TUI cancellation.

flowchart LR
  A[Channel message] --> D[Shared abort recognizer]
  B[Gateway chat] --> D
  C[TUI submission] --> D
  D --> E[Authorized stop operation]
  D --> F[Normal message processing]
  E --> G[Session controller]
Loading

Technical review

Best possible solution:

Have the feature owner choose whether these phrases belong in global defaults or the configurable-vocabulary direction.

Do we have a high-confidence way to reproduce the issue?

Current-main source excludes the added phrases, and the contributor's published-release comparison shows बंद करो entering the normal message path; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Expanding the existing set is the smallest implementation for approved global defaults, but configurable vocabulary better follows the recorded direction and avoids imposing deployment-specific words globally.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a69cf566f908.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +58. Total +58 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 58 0 +58
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 58 0 +58

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Additional native-language stop phrases improve cancellation accessibility, while existing stop commands remain available.
  • merge-risk: 🚨 message-delivery: Standalone messages such as para, alto, and cancel will be consumed as abort commands instead of reaching normal message processing.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve the feature owner's global-default versus configurable-vocabulary decision.

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 (2 earlier review cycles)
  • reviewed 2026-10-23T23:16:31.191Z sha 1ad34d1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-24T00:05:47.907Z sha 1ad34d1 :: needs real behavior proof before merge. :: none

Reviewed October 23, 2026, 8:23 PM ET / October 24, 2026, 00:23 UTC (Revision 3).

@alosslessdev

Copy link
Copy Markdown
Author

Acknowledged, and thanks for the precise review.

On the direction question: current main has no configuration surface for abort vocabulary. ABORT_TRIGGERS is a fixed set and every consumer (command-detection, fast abort, inline actions, Gateway chat, TUI) calls isAbortTrigger / isAbortRequestText without any config argument. The recorded owner direction points at configurable triggers, and #164870 (session.abortTriggers, reviving #30103) is the canonical request. It is still unimplemented, so nothing configurable replaces this PR today.

We are not asking for the global-default decision to be overridden. If #164870 lands the extension contract, this language set becomes redundant and we are fine with this PR being closed. Until then we would like to leave it open as a fallback for the localized defaults; it is rebased, green on the changed-path checks, and has positive/negative coverage for every entry.

If maintainers prefer to close it now and track only #164870, that is fine too — please say so and we will close it ourselves. No further action from our side on the product decision.

On proof: the remaining gap is a live channel/Gateway trace. We have not supplied one because it requires bot/channel credentials and a real model run. The supplied evidence covers the owning recognizer boundary (isAbortTrigger + isAbortRequestText) and the focused unit test. Happy to add an end-to-end trace if the PR becomes the chosen path.

@alosslessdev

Copy link
Copy Markdown
Author

Real behavior proof added to the PR body. Summary of the live trace on this head (1ad34d15), isolated config/state, real Gateway chat.send ingress, real model (opencode-go/deepseek-v4.1-flash):

[+0.1s] START {"runId":"trace2-start-1","status":"started"}
[+2.7s] ABORT_PHRASE {"ok":true,"aborted":true,"runIds":["trace2-start-1"]}
[+4.3s] CONTAINING_SENTENCE {"runId":"trace2-normal-1","status":"started"}
[+6.4s] HISTORY [... "para ti, what time is it in UTC?" ... assistant reply ...]

[diagnostic] lane task error: ... error="agent run aborted" errorName=AbortError ... runId=trace2-start-1
[model-fallback/decision] model fallback chain stopped: reason=caller_signal_aborted ... errorName=AbortError

Pre-fix comparison on published 2026.10.6 with a fresh state: the same phrase returned {"runId":"up-old-phrase","status":"started"}, i.e. normal text, no abort.

The v2026.10.6-state upgrade leg is not claimed: this checkout's agent-database activation aborted on plugin-load errors from an --ignore-scripts dependency install, so I could not produce a clean upgraded-state trace. Fresh-state behavior, the abort path, and the containing-sentence path are exercised end to end.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 24, 2026
@alosslessdev

Copy link
Copy Markdown
Author

Upgraded-state proof added. Created a fresh state with published [email protected], stopped that Gateway, then started this head (1ad34d15) on the same state with the same config. Isolated tokens/keys omitted.

[+4.4s] START {"runId":"upg2-start","status":"started"}
[+19.1s] ABORT_PHRASE {"ok":true,"aborted":true,"runIds":["upg2-start"]}
[+20.7s] CONTAINING_SENTENCE {"runId":"upg2-normal","status":"started"}
[+45.0s] HISTORY [{"role":"user","text":"para ti, what time is it in UTC?"},
                   {"role":"toolResult","text":"... UTC"},
                   {"role":"assistant","text":"**00:15 UTC** — Saturday, October 24, 2026. ..."}]

This covers the last proof gap from the previous review: upgraded state, real chat.send ingress, real model, phrase aborts the active run, containing sentence is answered normally. The remaining blocker is the maintainer product decision on global defaults vs configurable vocabulary (#164870), which we are not trying to override; the fallback position in my earlier comment stands.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant