Skip to content

feat(abort): add session.abortTriggers for user-defined stop phrases - #30103

Closed
AytuncYildizli wants to merge 4 commits into
openclaw:mainfrom
AytuncYildizli:feat/configurable-abort-triggers
Closed

AytuncYildizli wants to merge 4 commits into
openclaw:mainfrom
AytuncYildizli:feat/configurable-abort-triggers

Conversation

@AytuncYildizli

Copy link
Copy Markdown
Contributor

Summary

Implements #26113. Users can now extend the built-in abort trigger set with their own stop phrases via openclaw.json — no release required, no PR needed.

{
  "session": {
    "abortTriggers": ["dur", "yeter", "그만", "custom-stop-phrase"]
  }
}

Motivation

The hardcoded ABORT_TRIGGERS set in #25103 doesn't scale: every missing language requires a new PR and a new release. #26113 identified this as a design problem. This PR resolves it by giving users direct control.

The stopgap fix in #30102 (Turkish iptal, Korean 멈춰, Italian fermati) already landed for the highest-impact missing languages. This PR makes future per-language additions unnecessary for anyone willing to set a config field.

Design

Additive, no breaking changes. The built-in ABORT_TRIGGERS set is untouched. extraTriggers augments it. Users who don't set session.abortTriggers see zero behaviour change.

Same normalization pipeline. Extra triggers go through the existing normalizeAbortTriggerText (lowercase, trim, punctuation strip, whitespace collapse) — so "Yeter!" in config matches "yeter" in a message, consistent with how built-in triggers work.

Minimal API surface. Rather than a nested abort.extraTriggers object (as proposed in #26113), this uses a flat session.abortTriggers array — consistent with the existing session.resetTriggers pattern already in the codebase.

Files changed

File Change
src/auto-reply/reply/abort.ts isAbortTrigger and isAbortRequestText accept optional extraTriggers param
src/auto-reply/command-detection.ts Passes cfg.session?.abortTriggers through main detection path
src/auto-reply/reply/get-reply-inline-actions.ts Passes cfg.session?.abortTriggers through inline abort path
src/config/types.base.ts SessionConfig gains optional abortTriggers?: string[]
src/config/zod-schema.session.ts SessionSchema gains optional abortTriggers array
src/config/schema.labels.ts Label for new field
src/config/schema.help.ts Help text for new field

Testing

Two new test blocks covering:

  • isAbortTrigger with extraTriggers: normalization, case insensitivity, punctuation stripping, built-in triggers still work, no extraTriggers = original behaviour
  • isAbortRequestText with extraTriggers: same properties
✓ src/auto-reply/reply/abort.test.ts (18 tests) 29ms

Related

…hrases

Implements openclaw#26113: users can now extend the built-in ABORT_TRIGGERS set
with their own language-specific or workflow-specific stop phrases via
openclaw.json, without waiting for a release.

  {
    "session": {
      "abortTriggers": ["dur", "yeter", "그만", "custom-stop"]
    }
  }

Changes:
- abort.ts: isAbortTrigger() and isAbortRequestText() accept optional
  extraTriggers param; normalization pipeline (lowercase, trim,
  punctuation strip) applies to extra triggers consistently
- command-detection.ts: passes cfg.session?.abortTriggers through
  isControlCommandMessage for the main detection path
- get-reply-inline-actions.ts: passes cfg.session?.abortTriggers into
  isAbortRequestText for the inline abort path
- types.base.ts: SessionConfig gains optional abortTriggers field
- zod-schema.session.ts: SessionSchema gains optional abortTriggers
  string array
- schema.labels.ts + schema.help.ts: documentation for the new field

The built-in ABORT_TRIGGERS set is preserved as-is and remains the
baseline. extraTriggers augments it — no existing behaviour changes for
users who do not set the new config field.

Closes openclaw#26113
Related: openclaw#25103, openclaw#30102

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fb7d55ad7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
const normalized = normalizeCommandBody(trimmed, options).trim().toLowerCase();
return isAbortTrigger(normalized);
return isAbortTrigger(normalized, cfg?.session?.abortTriggers);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Propagate session.abortTriggers to fast abort path

This change wires session.abortTriggers into control-command detection, but the code that actually aborts active runs still does isAbortRequestText(stripped) without config extras in tryFastAbortFromMessage (src/auto-reply/reply/abort.ts:296), which is the path invoked from dispatch-from-config.ts:300. As a result, users who set a custom trigger (for example "dur") can have that message treated as control-like while the running session is not aborted, so the new feature fails in the primary abort workflow.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR implements user-configurable abort triggers via session.abortTriggers in openclaw.json, allowing users to extend the built-in multilingual stop phrases without requiring code changes or releases. The implementation follows the existing session.resetTriggers pattern and maintains full backward compatibility.

Key Changes:

  • Added optional extraTriggers parameter to isAbortTrigger() and isAbortRequestText() functions
  • Threaded cfg.session?.abortTriggers through three call sites: command-detection.ts, get-reply-inline-actions.ts, and tryFastAbortFromMessage()
  • Extended config schema with SessionConfig.abortTriggers?: string[] and corresponding Zod validation
  • Added comprehensive unit tests covering normalization, case-insensitivity, punctuation stripping, and backward compatibility

Design: The implementation is additive—custom triggers augment rather than replace built-in triggers. Both sets go through the same normalizeAbortTriggerText() pipeline (lowercase, trim, punctuation strip, whitespace collapse) ensuring consistent matching behavior.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is straightforward, well-tested, and follows established patterns in the codebase. The additive design ensures zero breaking changes. A performance optimization suggestion was already raised in a previous thread, but the current implementation is functionally correct and safe for typical use cases (small trigger lists).
  • No files require special attention

Last reviewed commit: 4a56751

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread src/auto-reply/reply/abort.ts Resolved
@greptile-apps

greptile-apps Bot commented Feb 28, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

src/auto-reply/reply/abort.ts
tryFastAbortFromMessage ignores user-configured abortTriggers

isAbortRequestText is called here without forwarding cfg.session?.abortTriggers, so any stop phrases a user adds via session.abortTriggers will be silently ignored in the fast-abort path. Since cfg is already in scope, the fix is straightforward:

  const abortRequested = isAbortRequestText(stripped, undefined, cfg.session?.abortTriggers);

This is the most critical code path for abort detection — every message goes through tryFastAbortFromMessage before reaching the inline-action handler — so the omission effectively means user-defined triggers never fire for the primary abort flow, even though they do work in the secondary handleInlineActions path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/abort.ts
Line: 296

Comment:
**`tryFastAbortFromMessage` ignores user-configured `abortTriggers`**

`isAbortRequestText` is called here without forwarding `cfg.session?.abortTriggers`, so any stop phrases a user adds via `session.abortTriggers` will be silently ignored in the fast-abort path. Since `cfg` is already in scope, the fix is straightforward:

```suggestion
  const abortRequested = isAbortRequestText(stripped, undefined, cfg.session?.abortTriggers);
```

This is the most critical code path for abort detection — every message goes through `tryFastAbortFromMessage` before reaching the inline-action handler — so the omission effectively means user-defined triggers never fire for the primary abort flow, even though they do work in the secondary `handleInlineActions` path.

How can I resolve this? If you propose a fix, please make it concise.

…Message

Primary fast-abort path was silently ignoring user-configured triggers.
Reported by Greptile (2/5 → fix applied). One-line fix per the review.
@AytuncYildizli

Copy link
Copy Markdown
Contributor Author

Addressed Greptile's review: tryFastAbortFromMessage (the primary fast-abort path) now also receives cfg.session?.abortTriggers, so user-configured triggers are respected consistently across all abort paths.

@greptile-apps can you re-review?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc19268a8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
const normalized = normalizeCommandBody(trimmed, options).trim().toLowerCase();
return isAbortTrigger(normalized);
return isAbortTrigger(normalized, cfg?.session?.abortTriggers);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass custom abort triggers through command handling

This line classifies session.abortTriggers phrases as control commands, but the command executor path still checks isAbortTrigger(params.command.rawBodyNormalized) without config extras in src/auto-reply/reply/commands-session-abort.ts, so custom phrases are not actually applied there. In flows that call getReplyFromConfig directly (i.e., without dispatch-from-config fast-abort precheck), a configured trigger like "dur" is recognized as command-like but does not abort the session, so the new config behaves inconsistently across execution paths.

Useful? React with 👍 / 👎.

@AytuncYildizli

Copy link
Copy Markdown
Contributor Author

Closing this to reduce my active PR queue and get back under the repo limit. I can reopen or resubmit once the queue is smaller.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: allow configurable abort/stop triggers instead of hardcoded multilingual keywords

1 participant