openjournals / whedon-api

A small service that provides the basic Whedon API
MIT License
6 stars 14 forks source link

Whedon should respond to commands embedded in bigger comments #116

Open jni opened 4 years ago

jni commented 4 years ago

See this comment:

https://github.com/openjournals/joss-reviews/issues/2683#issuecomment-694435958

I think it should be pretty straightforward to split incoming comments by newlines and fish out the command within a bigger comment?

arfon commented 3 years ago

:wave: thanks for posting this @jni. Whedon currently very deliberately only listens to comments at the start of an issue (i.e. is anchored with the \A regex). This primarily to stop run-away robot behavior whereby Whedon starts responding to itself, or accidentally to others (this has happened in the past).

By anchoring to the start of the entire text, we can support interactions like this:

@whedon assign me as editor

:wave: @jni - I'll be editing this submission for you.

We could potentially add in some kind of additional safety checks to try and prevent runaway behavior and accidental input (e.g. when people simply say How do I get @whedon to do this thing?) but I've not seriously investigated this.

/ cc @xuanxu incase he has any thoughts.

jni commented 3 years ago

@arfon my suggestion is that any command beginning with @whedon on its own line should be valid. See the comment I linked above and the one immediately after it.

I think that offers enough protection against the issues you mention?

jni commented 3 years ago

Besides a runaway AI on GitHub would make for a great Joss Whedon screenplay, which is just so delightfully meta, how can you resist? =P

xuanxu commented 3 years ago

The main problem I see with making any command beginning with @whedon on its own line valid, is the code comments. For example, this comment would unleash hell: https://github.com/openjournals/joss-reviews/issues/2695#issuecomment-698432082 It would also allow for comments running many whedon commands, I'm not sure that's something we want.

We could warn editors and change the Whedon responses adding a space before each command, but I think many users use code comments to showcase Whedon commands as they don't expect the command to run that way.

We can probably modify current responses, document policies for editors and make regexes complex enough to manage dangerous behaviours, but is not a straightforward change.

jni commented 3 years ago

Fair enough! Thanks for the detailed description @xuanxu! So I think at a minimum we would need to do some markdown parsing and remove code in code blocks.

I also don't understand why whedon can call whedon — that seems a priori like it should be disabled?

xuanxu commented 3 years ago

I also don't understand why whedon can call whedon — that seems a priori like it should be disabled?

So true, I guess it's not disabled because with the current whedon responses it's something that never happens, but if we change anything to parse embedded comments we should disable this for sure. It's a simple change, we can open an issue for it.

Anyway, we are focusing most of our current dev efforts in Buffy, JOSS' future editorial bot and those calls are disabled there.