Repository navigation
Recognize patronus on/off/status behind host context blocks - #90
Conversation
The Claude and Codex desktop apps put their own tagged context (e.g. <system-reminder>, <external_codex_apps_open_page>) next to the typed message, so the exact-message check never matched and chat controls were scanned as ordinary prompts. Leading tagged blocks are now set aside before matching; quoted or embedded commands still never match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8063174f73
ℹ️ 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".
|
|
||
| /** Only an entire user-authored text value is a control, never result text or a quoted fragment. */ | ||
| /** Context the host app wraps around the typed message, e.g. `<system-reminder>…</system-reminder>`. */ | ||
| const hostEnvelope = /^\s*<([a-z][\w-]*)>[\s\S]*?<\/\1>/i |
There was a problem hiding this comment.
Restrict envelope stripping to known host context tags
When a user submits XML-formatted instructions followed by a command example, this regex discards the instructions as though they were host context. For example, <document>Please explain the following command:</document>\npatronus off now resolves to off. I reproduced this through Claude's handleHook: it invokes the chat control and performs zero scans, so an ordinary explanation request instead disables protection for subsequent input and results. Limit stripping to recognized host context tags rather than treating every leading XML element as disposable.
Useful? React with 👍 / 👎.
Problem
patronus offstopped working in the Claude and Codex desktop apps. The apps put their own tagged context next to the typed message (Claude: a separate<system-reminder>Linked sessions now …</system-reminder>text block; Codex app: blocks like<external_codex_apps_open_page>…).chatCommandonly matched a single, exact text value, so the control was scanned as an ordinary prompt and the chat was never paused.Fix
chatCommand(shared by native hosts and DeepSeek) now sets aside leading<tag>…</tag>blocks in each text value, drops values that become empty, and still requires exactly one remaining value that is exactly the command. Quoted or embedded commands and result text still never match; the check stays at the user-input boundary.Bundles for Claude, Codex and Cursor rebuilt from the repo root.
Tests
plugins/nativesettings.test.ts: 8/8 pass, with new cases for a prefixed command (matches) and a command followed by extra text (does not match).<system-reminder>/<external_codex_apps_open_page>prefix and with Claude's block-array prompt: all return the chat status.DSH_SOURCE_ROOT); left to CI.🤖 Generated with Claude Code