Repository navigation
feat(abort): add session.abortTriggers for user-defined stop phrases - #30103
AytuncYildizli wants to merge 4 commits into
Conversation
…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
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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 SummaryThis PR implements user-configurable abort triggers via Key Changes:
Design: The implementation is additive—custom triggers augment rather than replace built-in triggers. Both sets go through the same Confidence Score: 5/5
Last reviewed commit: 4a56751 |
Additional Comments (1)
This is the most critical code path for abort detection — every message goes through Prompt To Fix With AIThis 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.
|
Addressed Greptile's review:
|
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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 👍 / 👎.
|
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. |
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_TRIGGERSset 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멈춰, Italianfermati) 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_TRIGGERSset is untouched.extraTriggersaugments it. Users who don't setsession.abortTriggerssee 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.extraTriggersobject (as proposed in #26113), this uses a flatsession.abortTriggersarray — consistent with the existingsession.resetTriggerspattern already in the codebase.Files changed
src/auto-reply/reply/abort.tsisAbortTriggerandisAbortRequestTextaccept optionalextraTriggersparamsrc/auto-reply/command-detection.tscfg.session?.abortTriggersthrough main detection pathsrc/auto-reply/reply/get-reply-inline-actions.tscfg.session?.abortTriggersthrough inline abort pathsrc/config/types.base.tsSessionConfiggains optionalabortTriggers?: string[]src/config/zod-schema.session.tsSessionSchemagains optionalabortTriggersarraysrc/config/schema.labels.tssrc/config/schema.help.tsTesting
Two new test blocks covering:
isAbortTriggerwith extraTriggers: normalization, case insensitivity, punctuation stripping, built-in triggers still work, no extraTriggers = original behaviourisAbortRequestTextwith extraTriggers: same propertiesRelated