-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: refactor chatStore from tasks dictionary to single task object (#627) #907
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
base: main
Are you sure you want to change the base?
Conversation
|
oh thats quite fast ! Thanks @gayanMatch do give me 1 - 2 days to confirm. |
Hi @a7m-1st. |
|
Thanks for the update @gayanMatch, let me review today 🙌 |
a7m-1st
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing LGTM, thanks for the very detailed and quick PR. No issues found while testing, just enhanced the console error type as throwing Error instead, and reenabled a test case. Here is what it looks like now:
The ghost chatStore is still getting created (most likely after a replayed project somewhere in the code is calling projectStore.createChatStore() ):
"1768872539549-9660": {
"taskId": null,
"nextTaskId": null,
"task": null,
"updateCount": 0
},
But I think we can keep it as it is now as it doesn't affect the system. This is the final output of my tasks for instance (new proj, replayed proj, new active proj)
{
"activeProjectId": "1768872489046-8424",
"projects": {
"1768872489046-8424": {
"id": "1768872489046-8424",
"name": "new project",
"createdAt": 1768872489046,
"updatedAt": 1768872604484,
"chatStores": {
"1768872489046-2335": {
"taskId": "1768872489053-8129",
"nextTaskId": null,
"task": {
"messages": [],
"summaryTask": "",
"taskInfo": [],
"attaches": [],
"taskRunning": [],
"taskAssigning": [],
"fileList": [],
"webViewUrls": [],
"activeAsk": "",
"askList": [],
"progressValue": 0,
"isPending": false,
"activeWorkSpace": "workflow",
"hasMessages": true,
"activeAgent": "",
"status": "pending",
"taskTime": 0,
"tokens": 0,
"elapsed": 0,
"hasWaitComfirm": true,
"cotList": [],
"hasAddWorker": false,
"nuwFileNum": 0,
"delayTime": 0,
"selectedFile": null,
"snapshots": [],
"snapshotsTemp": [],
"isTakeControl": false,
"isTaskEdit": false,
"streamingDecomposeText": ""
},
"updateCount": 0
},
"1768872603789-1292": {
"taskId": "1768872603795-2468",
"nextTaskId": null,
"task": {
"messages": [
],
"summaryTask": "Eigent Bags Token Verification & Brief Report|Investigate the purported “bags coin” link",
"taskInfo": [
],
"attaches": [],
"taskRunning": [
],
"taskAssigning": [
],
"fileList": [],
"webViewUrls": [
{
"url": "https://www.google.com",
"processTaskId": "1768872603795-2468.1"
}
],
"activeAsk": "",
"askList": [],
"progressValue": 0,
"isPending": true,
"activeWorkSpace": "workflow",
"hasMessages": true,
"activeAgent": "",
"status": "running",
"taskTime": 1768872922370,
"tokens": 2810,
"elapsed": 0,
"hasWaitComfirm": false,
"cotList": [],
"hasAddWorker": false,
"nuwFileNum": 0,
"delayTime": 0,
"selectedFile": null,
"snapshots": [],
"snapshotsTemp": [
],
"isTakeControl": false,
"isTaskEdit": false,
"streamingDecomposeText": ""
},
"updateCount": 0
}
},
"chatStoreTimestamps": {
"1768872489046-2335": 1768872489046,
"1768872603789-1292": 1768872603795
},
"activeChatId": "1768872603789-1292",
"queuedMessages": [],
"metadata": {
"status": "active",
"historyId": 30150,
"tags": []
}
},
"1768583228280-3226": {
"id": "1768583228280-3226",
"name": "Replay Project div — 3:00 PM",
"description": "Replayed project from div",
"createdAt": 1768872539549,
"updatedAt": 1768872584273,
"chatStores": {
"1768872539549-9660": {
"taskId": null,
"nextTaskId": null,
"task": null,
"updateCount": 0
},
"1768872539553-3876": {
"taskId": "1768872539553-5917",
"nextTaskId": null,
"task": {
"type": "replay",
"messages": [
],
"summaryTask": "",
"taskInfo": [],
"attaches": [],
"taskRunning": [],
"taskAssigning": [],
"fileList": [],
"webViewUrls": [],
"activeAsk": "",
"askList": [],
"progressValue": null,
"isPending": false,
"activeWorkSpace": "workflow",
"hasMessages": true,
"activeAgent": "",
"status": "pending",
"taskTime": 1768872540488,
"tokens": 0,
"elapsed": 0,
"hasWaitComfirm": false,
"cotList": [],
"hasAddWorker": false,
"nuwFileNum": 0,
"delayTime": 0.2,
"selectedFile": null,
"snapshots": [],
"snapshotsTemp": [],
"isTakeControl": false,
"isTaskEdit": false,
"streamingDecomposeText": ""
},
"updateCount": 0
}
},
"chatStoreTimestamps": {
"1768872539549-9660": 1768872539549,
"1768872539553-3876": 1768872539553
},
"activeChatId": "1768872539553-3876",
"queuedMessages": [],
"metadata": {
"status": "active",
"historyId": "1768583228280-3226",
"tags": [
"replay"
]
}
}
}
}
Thanks for the review and fixes! Good catch on the error type and re-enabling the test. Appreciate you testing thoroughly glad the ghost chatStore doesn't affect functionality. 🙏 |
|
If its all good @bytecraftii then perhaps @Wendong-Fan can you help us merging it? |
Hi @bytecraftii , @Wendong-Fan could you please merge this PR if it looks good? |
Description
Refactored chatStore to use a single
task: Task | nullinstead oftasks: { [key: string]: Task }dictionary pattern.Changes:
tasks→task(single object)activeTaskId→taskIdThis fixes the "ghost chatStore" bug where stale task references caused data issues.
What is the purpose of this pull request?