dcorking / google-wave-resources

Automatically exported from code.google.com/p/google-wave-resources
0 stars 0 forks source link

Bug: Robot receives own document_changed event with wrong modifiedBy - may cause infinite recursion #150

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Robot uses:

{"javaClass":"com.google.wave.api.impl.OperationMessageBundle","operations":{"ja
vaClass":"java.util.ArrayList","list":[{"type":"DOCUMENT_DELETE","blipId":"<reda
cted>","waveId":"wavesandbox.com!<redacted>","waveletId":"wavesandbox.com!conv+r
oot","property":{"javaClass":"com.google.wave.api.Range","start":0,"end":33},"in
dex":-1,"javaClass":"com.google.wave.api.impl.OperationImpl"},{"type":"DOCUMENT_
INSERT","blipId":"<redacted>","waveId":"wavesandbox.com!<redacted>","waveletId":
"wavesandbox.com!conv+root","property":"Only
I get to edit the top
blip!","index":0,"javaClass":"com.google.wave.api.impl.OperationImpl"}]}}

The resulting document changed event is received by bot itself (which is
not meant to happen according to the API docs) and received with the wrong
modifiedBy (panda@gwave.com instead of the real identity of the robot):

{"blips":{"map":{"<redacted>":{"lastModifiedTime":1249904164186,"contributors":{
"javaClass":"java.util.ArrayList","list":["<redacted>@wavesandbox.com","dice-bot
@appspot.com","-redacted--bot@appspot.com"]},"waveletId":"wavesandbox.com!conv+r
oot","waveId":"wavesandbox.com!<redacted>","parentBlipId":null,"version":6438,"c
reator":"<redacted>@wavesandbox.com","content":"Only
I get to edit the top
blip!\n","blipId":"<redacted>","javaClass":"com.google.wave.api.impl.BlipData","
annotations":{"javaClass":"java.util.ArrayList","list":[{"range":{"start":0,"jav
aClass":"com.google.wave.api.Range","end":33},"name":"lang","value":"en","javaCl
ass":"com.google.wave.api.Annotation"}]},"elements":{"map":{},"javaClass":"java.
util.HashMap"},"childBlipIds":{"javaClass":"java.util.ArrayList","list":["<redac
ted>"]}}},"javaClass":"java.util.HashMap"},"events":{"javaClass":"java.util.Arra
yList","list":[{"timestamp":1249904164201,"modifiedBy":"panda@gwave.com","javaCl
ass":"com.google.wave.api.impl.EventData","properties":{"map":{"blipId":"<redact
ed>"},"javaClass":"java.util.HashMap"},"type":"DOCUMENT_CHANGED"}]},"wavelet":{"
lastModifiedTime":1249904164201,"title":"","waveletId":"wavesandbox.com!conv+roo
t","rootBlipId":"<redacted>","javaClass":"com.google.wave.api.impl.WaveletData",
"dataDocuments":{"map":{},"javaClass":"java.util.HashMap"},"creationTime":124956
4298334,"waveId":"wavesandbox.com!<redacted>","participants":{"javaClass":"java.
util.ArrayList","list":["<redacted>@wavesandbox.com","-redacted--bot@appspot.com
","dice-bot@appspot.com","parroty@appspot.com"]},"creator":"<redacted>@wavesandb
ox.com","version":6439}

Original issue reported on code.google.com by redbe...@gmail.com on 10 Aug 2009 at 12:28

GoogleCodeExporter commented 9 years ago
Robots should not receive their own DOCUMENT_CHANGED event, but Panda (language 
detector agent) may have modified the document right after and caused that 
event.

Original comment by pamela.fox on 1 Oct 2009 at 4:17

GoogleCodeExporter commented 9 years ago
I ran into the same issue causing infinite recursion. I also saw that
'panda@a.gwave.com' caused the change event.

If this issue is set to 'WontFix' - how should I detect this situation? Causing
endless loops by robots constantly changing the document cannot be desired by 
Google.

In my special case the robot appended a new Blip with a url as content. Is it
possible that Panda created a document change to render it as a link? Any help 
on how
to avoid these situations is highly welcome.

Original comment by jan.kars...@googlemail.com on 5 Oct 2009 at 9:11

GoogleCodeExporter commented 9 years ago
Perhaps it would be better if we could check if the blip modifier is automatic, 
I added 
a test for if the participant contains the string "@a.gwave.com" - but who 
knows what 
later automatic stuff Google could add, so an API method to check that would be 
great. 
:)

Original comment by soil...@gmail.com on 11 Oct 2009 at 1:41

GoogleCodeExporter commented 9 years ago
Yes, we're looking into this now. Thanks for the thought.

Original comment by pamela.fox on 11 Oct 2009 at 1:50

GoogleCodeExporter commented 9 years ago
I think this is issue is very prominent. I'm trying to do a live-text-edit using
DOCUMENT_CHANGED, but currently I cannot due to the robot firing another
DOCUMENT_CHANGED causing an infinite loop.

Original comment by carole...@googlemail.com on 14 Nov 2009 at 10:57

GoogleCodeExporter commented 9 years ago
Have you tried filtering your actions based on the modifier of the blip?

Original comment by pamela.fox on 14 Nov 2009 at 10:59

GoogleCodeExporter commented 9 years ago
I'm running into the same problem.  I end up having to do something like this - 

List<String> participants = wavelet.getParticipants();
String editingUser = e.getModifiedBy();
if (participants.contains(editingUser))
{
     //do stuff
}

It would be nice to have an Event.CausedByHuman() flag or something.

Original comment by yoenho...@gmail.com on 4 Dec 2009 at 10:18