🤖 bug: unlocked handle writers can still replace or drop concurrent workspace-turn handle writes (#5362 follow-up)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- distributed-systems
Research direction
Start at settleWorkspaceTurn and markWorkspaceTurnBackgroundWorkNotifyOnTerminal, then trace withWorkspaceTurnPublicationLock and the settlement callers; review refs #4926, #5362, and #5361 for locking assumptions. Done means settlement preserves an already-terminal record and attentionPolicy uses a publication-locked read-modify-write, so concurrent writes are not lost.
Written by the indexing model from the issue text.
Description
Problem
Follow-up from #5362. The owner's acceptance (markWorkspaceTurnAccepted) and a foreign explicit interrupt (interruptWorkspaceTurn) now read and write the handle under a per-handle cross-process publication lock, so neither overwrites a record the other wrote after its read.
settleWorkspaceTurn still reads the handle under the owner's in-process settlement lock only, then awaits before its upsert. If another backend's explicit interrupt writes interrupted in that window, the owner's settlement replaces it with its own terminal outcome (for example error). This is step 3 of #4926. The execution mirror stays consistent with the handle (#5361 fences the foreign mirror write), so the visible effect is a mislabeled terminal outcome, not a running/terminal mismatch.
A second unlocked writer has the same shape: markWorkspaceTurnBackgroundWorkNotifyOnTerminal writes attentionPolicy (with a new updatedAt) without the publication lock. If it lands between the owner acceptance's locked re-read and its upsert, the acceptance publishes running from the older record and the policy is lost, so the terminal background notification never fires. The same loss existed before #5362 (the acceptance then wrote back a read taken before its mirror-claim await). Found in review of #5433.
Possible fix
Take the same withWorkspaceTurnPublicationLock around settlement's read and write (keep the current record when it is already terminal) and around the attention-policy read-modify-write. The settlement path has many callers, so it needs its own review.
Refs #4926, #5362
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $10.87
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 140
- Avg merge
- 2h 27m
- Merged PRs (30d)
- 873
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/xum
-
🤖 bug: workspace header buttons shift left when the skills indicator loadsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug investigation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
approved backlog
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
approved backlog
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
Similar issues
-
status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
a2ui-project/a2ui#3158 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
hemilabs/ui-monorepo#2475 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#32279 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
github/gh-aw-firewall#9879 ·
Maintainers usually reply within 1 day
-
[Bug]: Arrow-key cursor movement in combined diff view doesn't scroll to keep the cursor visibleOpenos:macos
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day