-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Task can't be opened #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this happens when the JSON representing the task gets corrupted (for me at least, often when I try to terminate a task that's using up too many resources or something). I would love to dig in deeper but haven't had time yet... |
Can't repro with this info. Should be handled with #1383 |
Hit the same issue when machine ran out of memory and had to be cold rebooted. Couldn't reopen the Task I was working on in my last session. I assumed JSON was corrupt. Using ProcMon I found where the caches are (%AppData%\Windsurf\User\globalStorage\rooveterinaryinc.roo-cline\tasks). I think the issue is that api_conversation_history.json gets zeroed out. It seems to never be zero in other tasks I have in the cache. So I used Windows to restore previous version of the file and the task loaded up fine. Problem solved. TLDR is that writes to api_conversation_history.json aren't append-only so file may get wiped out if the process crashes at the wrong time. Needs to be append-only for BCDR. |
@KJ7LNW thoughts? |
I have seen it before but I do not know anything about that section of the code |
Probably the following pseudocode is necessary, these instructions could be handed to an AI to do the actual work. Important: create tests to validate correct behavior at any failure point in In simple terms:
try {
1. flock the file
2. write new content to temporary file `api_conversation_history.json.tmp1<random>`
3. atomic swap the files (which is not supported on all operating systems)
4. if atomic swap is not available, then:
5. rename existing api_conversation_history.json file to api_conversation_history.json.tmp2<different random>
6. rename new file to api_conversation_history.json
7. delete api_conversation_history.json.tmp2<different random>
8. release lock
}
catch {
1. delete temporary file `api_conversation_history.json.tmp1<random>`
2. if api_conversation_history.json.tmp2<different random> exists, rename it back to api_conversation_history.json
3. release the lock
} |
if someone feeds that into an artificial Intelligence it can probably do the work |
I found another repro. This time file wasn't zeroed out. It just wasn't fully written to. End of the file had {"ts":1743186528900,"type":"say","say":"reasoning","text":"It looks like we're experiencing errors because we're trying to use an Given recent greying out of UI, I've been frequently using Ctrl+Shift+P>Developer:Restart Extension Host as that's the only known mitigation. It's resumed without issues 100 times so this must be the unlucky 101. The fix was to replace },{" with }] TLDR: when trying to open a task, if JSON wasn't fully serialize, trim the end until it becomes valid. |
I am glad that you found a workaround. Ultimately we need to handle that file a little bit more safely... |
Workaround is partial - all of the recent conversation/context gets lost. It does get me back into the task, but I need to the manually get Roo back on its tracks. This implies history isn't logged linearly and dropping last appends affects more than just last prompts. |
my guess is that this is not an append operation, it completely rewrites json. was your context particularly large? I wonder if it was timing out on a promise and aborted the write. |
Yes, most of my contexts are multiple days of continuous work which makes losing them very painful. Switching to appendonly is the way. |
Good idea (ie, NDJSON), however we plan to modify the content at some point to reduce context size intelligently (like removing multiple identical reads) when the context as large enough that it would need to be truncated anyway. I think we need to have a transactional process like the one outlined above. Devs: See this link for the action item on this ticket: |
same errors of corrupted api history... lost days of work too... |
There maybe a work around-here to get your task working again: |
@gauthierhavet - if you are interested in contributing then the following comment explains how this could be fixed, so far none of the developers have taken up the task: |
@hannesrudolph if you know anyone interested in contributing or getting their feet wet in Roo development, then I think this is a relatively easy fix with low risk of side effects for someone who wishes to take it on. |
@KJ7LNW should we migrate to NDJSON or JSONL ? |
Here is a potential fix, if anyone is reproducing the issue wants to try you can input this into Roo Code mode with 2.5 pro.
|
Atomic rewrites (write to a temporary file, then rename) are still needed for full history modifications even if the file format is JSONL as I understand it. JSONL would still be good though here is how it may apply: Using JSONL with an append-only strategy for new entries means:
|
@dlab-anton Yes, I will make it easier to fix, but I think we should implement something using p-queue to queue write jobs for the same path that will be written to. |
I am fine with converting the file format which will be nice and fast for the general case of append, but let's do this in manageable steps: What do you think about the following:
Then, in a separate PR:
|
Which version of the app are you using?
3.3.9
Which API Provider are you using?
OpenRouter
Which Model are you using?
Gemini flash 2.0
What happened?
Sometimes, specific tasks can't be opened. I created a task that generated a bug in my app, and to correct it, I had to reopen this task. The curious thing is that with this specific task, I couldn't open it anymore.
Steps to reproduce
I haven't identified a pattern to explain how to replicate the bug; this issue occurs suddenly.
Relevant API REQUEST output
Additional context
No response
The text was updated successfully, but these errors were encountered: