Skip to content

Serialize dashboard state read-modify-write with a lock - #3

Open
k0shir0 wants to merge 1 commit into
JustinGamer191:mainfrom
k0shir0:state-lock
Open

Serialize dashboard state read-modify-write with a lock#3
k0shir0 wants to merge 1 commit into
JustinGamer191:mainfrom
k0shir0:state-lock

Conversation

@k0shir0

Copy link
Copy Markdown

The server threads every request, but the mutating endpoints all do read-state, mutate, write-state with a Codex or network call in the middle - so two overlapping requests can have the slower one silently overwrite the faster one's update. Added an RLock held across the whole cycle in those handlers (reentrant because the agent path writes once mid-command and once at the end), with read_state and write_state also locking themselves so the plain state POST is covered too. Chat doesn't persist anything so it stays unlocked. The trade is that mutations now queue behind a long Codex call, which for a single-user dashboard beats losing an update. Compile-checked and hammered with an 8-thread read-modify-write smoke test locally.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@k0shir0