anthropics / anthropics/claude-code-action

trigger_phrase regex rejects valid mentions preceded by non-whitespace chars like ( or "

Offen
#941 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug p2
Vorherrschende Sprache
TypeScript
Sterne
8.9k
Forks
2.1k
Ø Merge
3 T. 9 Std.
Gemergte PRs (30 T.)
10

Beschreibung

## Bug

The trigger phrase regex in `src/github/validation/trigger.ts` requires the trigger phrase to be preceded by either start-of-string or whitespace:

```typescript
const regex = new RegExp(
`(^|\\s)${escapeRegExp(triggerPhrase)}([\\s.,!?;:]|$)`,
);
```

The leading boundary `(^|\\s)` is too restrictive. Common patterns where users naturally write the trigger phrase after non-whitespace characters silently fail to trigger.

## Reproduction

With default `trigger_phrase: "@claude"`:

| Comment | Triggers? | Expected? |
|---------|-----------|-----------|
| `@claude help` | yes | yes |
| `hey @claude help` | yes | yes |
| `(@claude) can you check?` | **no** | yes |
| `"@claude can you check?"` | **no** | yes |
| `>@claude can you check?` | **no** | yes |
| `cc:@claude` | **no** | yes |

The workflow `if` condition (GitHub's `contains()`) is case-insensitive and passes all these cases, so the workflow *runs*. But the action's internal trigger check rejects them silently, logging "No trigger found, skipping remaining steps" with exit code 0.

## Environment

- `anthropics/claude-code-action@v1` (latest as of Feb 13, 2026)
- `claude_code_oauth_token` auth
- Tested on both `issue_comment` and `pull_request` event triggers

## Actual logs

```
No trigger was met for @claude
Trigger result: false
No trigger found, skipping remaining steps
```

## Suggested fix

Replace `(^|\\s)` with a negative lookbehind for word characters (to still prevent matching inside email addresses like `user@claude.com`):

```typescript
const regex = new RegExp(
`(?<=^|[^a-zA-Z0-9_])${escapeRegExp(triggerPhrase)}([\\s.,!?;:]|$)`,
"i", // also fix #910 while we're here
);
```

Or more conservatively, expand the leading boundary to include common punctuation:

```typescript
const regex = new RegExp(
`(^|[\\s(>"'/])${escapeRegExp(triggerPhrase)}([\\s.,!?;:)"']|$)`,
"i",
);
```

## Related

- #910 (case sensitivity, different issue but same regex)
- #923 (Unicode trailing boundary, closed as dup of #910)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.