Theme-Cosmos, DCSPA_UserPortal/ACPRIMARY_0 Thread and base thread mismatches

Using Pega infinity 8.23.4 version and Theme Cosmos 04.01. When opening assignment from clicking GO button, it opens DCSPA_UserPortal/ACPRIMARY_0 thread, once click submit (Finish assignment), case back to review mode. But still ACPrimary thread available in the clipboard. Is this expected or supposed to be removed from Pega.

Issues being faced-

Using utility panel for adding documents, we call external service to add documents and also persist or update pyWorkPage with DocIDs which will be used to retrive documents. So in the above approach, when use is on the assignment, as its AJAX and only that screen refresh, user with out fully done with assignment, adding a document. When adding document, it has local action, there it uses pyWorkPage from base thread, which has different data than ACPrimary update. How to sync the threads? What is OOTB way.

Also when assignment is being performed, need to update case summary panel sections, for that on submit button actions, doing finish assignment and running script reloadMySection shared from Richard article. Even with out any custom refresh, just finsihAssignment is also not removing ACPrimary thread after assignment container submitted?

Yes, this is expected in Theme Cosmos: the assignment runs in the ACPRIMARY thread, and that thread is not always removed immediately after FinishAssignment because Pega usually clears work threads through normal tab or portal cleanup actions later.
The correct fix is to treat ACPRIMARY as the only working source while the assignment is open.
Before your document local action or external service call runs, add Post Value on the needed fields, or refresh the section on change, so the latest screen values are pushed into the clipboard first.
Then make the document logic read and update pyWorkPage from that assignment thread only, not from the base thread.
This keeps the assignment data and document data in sync during AJAX actions and avoids the mismatch you are seeing.