Page MenuHomePhabricator

Integrate Stashbot better visually with Phabricator
Closed, DeclinedPublic3 Estimated Story Points

Description

Currently @Stashbot adds excerpts from system administration logs whenever a task is mentioned in an entry; e. g. T152440:

stashbot.png (125×1 px, 15 KB)

This layout has several visually confusing shortcomings when viewed in connection with other items on a task's timeline:

  1. In the place where usually the acting user's name is displayed, it says @Stashbot.
  2. The acting user's name is in a different domain (IRC); in some cases, users use the same nick name in Phabricator and IRC, in some (like this one) the reader has to deduce who the acting user is.
  3. The timestamp is redundant (except for debugging).
  4. It is labelled as a comment, but it is a log entry; comments are expected to reply to previous conversations, etc., log entries are meant to give other system administrators a short overview what has happened (and may have caused havoc).

@gerritbot faces the same problems, but due to the move to Differential on the horizon it is probably a moot point.

I suggest that @Stashbot's functionality is (better) visually integrated with Phabricator, i. e.:

  1. The acting user should be the Phabricator user who has claimed the referenced IRC nick name.
  2. The timestamp should be set to the actual log time.
  3. The "top line" should read: "@fgiunchedi added a log entry in #wikimedia-operations.".
  4. The "box" should read: "upload ieee-data 20160613.1 and upgrade jessie machines to it T152440".

Event Timeline

@epriestley: I looked at https://secure.phabricator.com/T3179 and https://secure.phabricator.com/tag/doorkeeper/, but did not find something similar to this task. Do you know of existing or planned applications for Phabricator that "import" (more like quote) system administration logs when they refer to Maniphest tasks? Can you share how other Phabricator users log activities related to a task (reboot servers, deploy new software, etc.)?

The closest upstream match is probably this one: https://secure.phabricator.com/T9789

(This might also be an approximate approach, without custom code: https://secure.phabricator.com/T11934 -- not perfect, but maybe a little cleaner visually depending on where we end up with it. However, not sure when we'll actually pursue that.)

Maniphest hasn't converted to modular transactions yet, but you'll be able to write a custom transaction type once it does.

This conversion process is fairly straightforward, we just haven't done a major iteration on Maniphest since ModularTransactions were developed.

It's possible you could hack your way through things with CustomFields today, but this is probably a huge mess.

We also don't allow users to impersonate other users, and don't currently plan to ever allow that. With ModularTransactions you could have the UI show whatever you wanted in text, but the action will still fundamentally come from the bot, use their profile icon, use their "From" address/name if it generates email, show their "authorPHID" in any raw data, etc. If you want the bot to be able to post as other users, you'll need to patch that locally (or require every user to go through an OAuth flow).

@Stashbot posts it's messages via conduit calls, so if there was something better to call than a 'maniphest.update' + 'comment' it would be easy to switch to that.

Mapping irc users to Phab users isn't really something that I would want to maintain in the bot itself, but maybe something could be done using the optional IRC Nick profile data on the Phab side of things.

Writing a new conduit api is pretty easy (or at least has been for the couple we made to deal with things that Striker wanted to do), so if something can be worked up based on https://secure.phabricator.com/T9789 or another feature in Phab then I'd personally have no objections.

Is there maybe a way that we could (ab)use the "$USER mentioned this in $TASK" type of events that are recorded for a task?

Once Maniphest switches infrastructure, you can interact with Modular Transactions over the slightly more modern maniphest.edit (you can switch today, but won't get any benefits immediately).

maniphest.edit is pretty much the same as maniphest.update, but accepts a list of edits. One of the motivations is to allow those edits to include custom, third-party transaction types.

You could write a new API today, but there's no value you can really write into the database to do anything useful without a lot of more extensive/fragile changes. Modular Transactions are the best fix for that, and also support integration into the existing APIs.

Is there maybe a way that we could (ab)use the "$USER mentioned this in $TASK" type of events that are recorded for a task?

Maybe, but probably not quite what you want:

You could create a new application to record these logs, then mention the task in that application's objects. However, the task would show "user mentioned this task in WMFIRC13234: Log of IRC" or whatever, and you can't customize how that mention renders (it's always "<user> metioned this in <other object>"). This is also quite a bit more work if you only care about getting these mentions.

We plan at some point to let you mirror an IRC chat into a Conpherence (roughly https://secure.phabricator.com/T6875 upstream). This would automatically create mentions on tasks as a side effect. This is probably quite a ways away, though.

In both cases, mentions are a one-time relationship: you can't mention an object on another object twice. This might not be what you want for this.

We could also modularize the "Related Objects" panel (the one with the task graph and mentions tabs, under the task description), and you could write logs into a custom table and then query it in a custom panel. This is a bit more work, but would give you total control over what things looked like. However, it wouldn't appear inline in the transaction log. Not sure if having it be a separate panel that's more custom would be better or worse for your use case.

Aklapper triaged this task as Lowest priority.Apr 7 2019, 8:48 PM
Aklapper removed a subscriber: epriestley.

I am not aware of any way to match a random ever-changing IRC nickname____|afk with a Phabricator username, thus I'd decline points 1 and 2.

Regarding point 4, there is no concept of "log entry" in contrast to "comment" in Phabricator, and I don't think additional code complexity would be justified.

Which leaves us with point 3 about the often redundant timespan (if there is no lag) which sounds like a minor annoyance only.

Thus I'm boldly declining this task.