cloud-atlas-ai / obsidian-am

Interoperability between Obsidian and Amazing Marvin
MIT License
14 stars 1 forks source link

Mark As Done failing silently when the Tasks plugin is active #22

Closed muness closed 7 months ago

muness commented 7 months ago

In https://github.com/cloud-atlas-ai/obsidian-am/issues/18#issuecomment-1869561125, @judisohn reported that Amazing Marvin tasks don't get marked as done, even when the feature is enabled in settings.

Update: per @judisohn's investigation, we think this is a conflict with some other task-related plugin behavior. I'll keep this open until we can figure out the conflict and then I'll try to make this plugin compatible.

muness commented 7 months ago

I haven't been able to reproduce this issue, @judisohn . Can you try again and include anything I might be able to use to replicate the problem?

judisohn commented 7 months ago

I see you've made some other commits... how about I try again with an updated version once you have a new release .zip and see if I'm still struggling here? I can record a video for you if it's still a problem.

muness commented 7 months ago

Thanks @judisohn , that would be great!

muness commented 7 months ago

Updated release at https://github.com/cloud-atlas-ai/obsidian-am/releases/tag/0.5.0b2

judisohn commented 7 months ago

Unfortunately. This is still failing for me (although the Local Server option is persisting correctly).

Now when I create a task it's scheduling for a day in advance instead of today.

Here's a screen shot of my entry in Obsidian:

CleanShot 2023-12-26 at 18 04 36@2x

But it's creating the task with a scheduled date of 12/27 instead of today, 12/26:

CleanShot 2023-12-26 at 18 04 58@2x

CleanShot 2023-12-26 at 18 05 33@2x

And when I complete it in Obsidian, nothing happens. Nothing in the developer console. Only updates I see are from the List Modified Plugin.

CleanShot 2023-12-26 at 18 06 18@2x

I did also get some errors trying above for Failed to load resource: the server responded with a status of 429 running the create command originally. But then when I tried again the modal came up.

Let me know if there's a better way to get you more useful logs.

muness commented 7 months ago

Only updates I see are from the List Modified Plugin.

My guess is that it's preventing my own handler that watches for the task to be checked as I only look for the [ ] to turn into a [x] and because it adds a bunch of text, that's now broken.

Mind disabling it and trying again?

muness commented 7 months ago

As for the erroneous Scheduled date, I suspect a timzone offset issue: the public AM server runs UTC. I do no handling whatsover of the +today and rely on AM to parse it. I do send the timezone offset of the machine so it should work.

I can replicate this, will see if my timezoneoffset is incorrect and fix that.

muness commented 7 months ago

As for the erroneous Scheduled date, I suspect a timzone offset issue: the public AM server runs UTC. I do no handling whatsover of the +today and rely on AM to parse it. I do send the timezone offset of the machine so it should work.

I can replicate this, will see if my timezoneoffset is incorrect and fix that.

The offset being sent in ET is +300. Looks like this should be -300. Per the docs:

// Added to time to fix time zone issues.  So if the user is in Pacific time,
// this would be -8*60. 
judisohn commented 7 months ago

My guess is that it's preventing my own handler that watches for the task to be checked as I only look for the [ ] to turn into a [x] and because it adds a bunch of text, that's now broken.

Mind disabling it and trying again?

Disabled it and tried again. When I complete a task absolutely nothing happens and there's nothing in the Dev Console. I verified that I have the local API enabled in my desktop copy and it's the same port.

judisohn commented 7 months ago

I thought for a moment that perhaps the Tasks plugin was conflicting, so I tried disabling it. Following that, I can't get your plug-in to behave at all. I get the create modal, but this error on save every time. Rate limiting? Which is supposed to be avoided with local server, no?

CleanShot 2023-12-26 at 18 52 16@2x

muness commented 7 months ago

I thought for a moment that perhaps the Tasks plugin was conflicting, so I tried disabling it. Following that, I can't get your plug-in to behave at all. I get the create modal, but this error on save every time. Rate limiting? Which is supposed to be avoided with local server, no?

This is Amazing Marvin rate limiting the requests, exactly. I've been hitting it a lot, which is why I tried the local server path, only to discover most endpoints aren't available on it. If you wait a few minutes it should start working again.

I've contacted support about this throttling. I'd be happy to run a local server to avoid overloading the public server, but that doesn't really work when only a few API endpoints are implemented.

muness commented 7 months ago

Timezone offset reversal done in #31 . Released in the new beta, https://github.com/cloud-atlas-ai/obsidian-am/releases/tag/0.5.0b4

muness commented 7 months ago

When I complete a task absolutely nothing happens and there's nothing in the Dev Console.

https://github.com/cloud-atlas-ai/obsidian-am/blob/master/src/main.ts#L246-L257 when the API call fails, I throw an error and puts a notice and a message in the dev console.

If you aren't seeing anything, that means the matcher isn't seeing the check off behavior. What checklist related plugins do you have installed? I am guessing one or more of them are changing the signature expected at https://github.com/cloud-atlas-ai/obsidian-am/blob/master/src/amTaskWatcher.ts#L22-L29

judisohn commented 7 months ago

To be sure, I created a brand new vault with nothing enabled but Amazing Marvin. it's behaving just fine there which is great.

So now I guess I need to try again disabling my existing plugins one at a time until I figure out the culprit - or I hit the rate limit again. Whichever comes first. :-) I'll give it a go tomorrow or later in the week.

muness commented 7 months ago

To be sure, I created a brand new vault with nothing enabled but Amazing Marvin. it's behaving just fine there which is great.

Thanks for confirming! I thought I had pulled off an "it works for me" somehow. ;)

So now I guess I need to try again disabling my existing plugins one at a time until I figure out the culprit - or I hit the rate limit again. Whichever comes first. :-) I'll give it a go tomorrow or later in the week.

Let me know which plugin you hone in on (or setting for a plugin). I can probably find a way to be compatible with it once we figure out what's causing the conflict.

judisohn commented 7 months ago

@muness Had a little time to test this morning.

Not sure what happened yesterday but I can confirm now without a shadow of a doubt the problem is indeed the Tasks Plugin. With it disabled the task completes just fine. With it enabled and nothing else different, the message to complete the task is never sent. It makes sense, because Tasks does have some popups and post-complete activities that is likely in the way.

This plugin is insanely popular with nearly 900K downloads so working with it should probably be a priority. Chances are I'm not the only one who would want to use both.

Let me know if there's anything else I can test for you.

muness commented 7 months ago

Thank you for the testing! I'll give it a try and see if I can figure out how to be compatible with it.

muness commented 7 months ago

When using Tasks Plugin and allowing it to update other elements, the logic doesn't match the toggle image

          if (change.length === 1 && (change.sliceString(0, 1) === "X" || change.sliceString(0, 1) === "x")) {

I'll relax the logic to allow a match, which should work.

muness commented 7 months ago

@judisohn , would you give the latest release a try to make sure it fixes this issue for you? Thanks! https://github.com/cloud-atlas-ai/obsidian-am/releases/tag/0.5.1

judisohn commented 7 months ago

Woo hoo @muness it works!!! But I found a new issue which I'll start separately with the link back Advanced URI... sooo close. :-)