docs(README.md): improve 'if' clause to detect /pi by knocte · Pull Request #260 · shaftoe/pi-coding-agent-action · GitHub
//voltron/pull_requests_fragments/pull_request_layout" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
//voltron/pull_requests_fragments/pull_request_layout;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
shaftoe
pi-coding-agent-action
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star<br>33
Open<br>docs(README.md): improve 'if' clause to detect /pi#260knocte wants to merge 1 commit intoshaftoe:developshaftoe/pi-coding-agent-action:developfrom knocte:wip/startsWithRatherThanContainsknocte/pi-coding-agent-action:wip/startsWithRatherThanContainsCopy head branch name to clipboard
Conversation
Copy link
Copy Markdown
Contributor
knocte
commented
Jun 4, 2026
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Everywhere in this README.md file where the "command" /pi is explained, the verb "prefix" is used. So then it is making the user think that the "bot" will only be activated when /pi is used at the beginning of a github comment if one follows the samples (i.e. in the Quick Start section).
Therefore, it is better to change these samples to use startsWith instead of contains. On top of that, to prevent the potential (although rare) collision with other possible commands that the user might have set up, or may set up in the future (e.g. "/pin yadda yadda", or simply "/ping", etc), it's safer to add a space after "/pi" in the string: "/pi ".
BTW, if you're skeptical of merging this PR, then let me tell you a little funny story that wouldn't have happened if this change had been done before I tried your project. (Note: it's funny now, and fortunately I was using a cheap model and a pay-as-you-go provider, and I noticed only 1h after it started happening; but imagine if this happens to someone that is using a frontier model, a provider that takes your credit card, and she goes to bed after the problem starts happening; unlike me that I just went to walk the dog and that's why I caught it only 1h after.)
The story begins when I tried to instruct Pi via /pi to create a PR that changed my pi.yml workflow to secure it by adding an if github.actor = ... element to it. That's when I filed #255, remember? After that, I then created a PAT and used it in my workflow, and then I instructed Pi via /pi to try to fix the issue again.
Then I decided to go walk my dog. And then when I came back, I found that, this time, it had been able to create PR, but the message to inform me about the work that had been done was written with my user account (because of the new PAT) and it contained the string /pi (because it was telling me that now only my github user can use the "/pi" command to trigger the workflow), so then that triggered another workflow, which itself created another PR and another message, which then spawned another workflow, and so on and so forth!
I fortunately only caught the infinite loop after 1h, and only about 2USD were spent (thanks cheap Kimi 🙏). I stopped it right away and it stopped creating PRs for the same thing again and again. So with this PR in place, I HTH to avoid this happening to anyone in the future.
-->
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
-->
All reactions
docs(README.md): improve 'if' clause to detect /pi
400eb47
Everywhere in this README.md file where the "command" /pi is<br>explained, the verb "prefix" is used. So then it is making the<br>user think that the "bot" will only be activated when /pi is<br>used at the **beginning** of a github comment if one follows the<br>samples (i.e. in the Quick Start section).
Therefore, it is better to change these samples to use<br>`startsWith` instead of `contains`. On top of that, to prevent<br>the potential (although rare) collision with other possible<br>commands that the user might have set up, or may set up in the<br>future (e.g. "/pin yadda yadda", or simply "/ping", etc), it's<br>safer to add a space after "/pi" in the string: "/pi ".
Copy link
Additional details and impacted files
[![Impacted file tree...