Qwen Code adds a lease-based fence for concurrent ACP session writers
doudouOUC · ghdev · 2026-07-19
What this PR does
This PR fixes an ACP/session race in Qwen Code by fencing concurrent writers.
Core idea
- Each (runtime base, session ID) gets a single cross-process writer via an atomic hard-link lease.
- The owner reloads the authoritative transcript after acquiring the lease.
- Every append checks owner token, transcript identity, metadata, and UTF-8 byte length before advancing the in-memory tail.
Behavior changes
- The daemon reuses an already-live owner instead of creating conflicting writers.
- User, cron, notification, and teammate turns are gated on verified ownership.
- Live transcript replay is served through the owner's write barrier and pinned session storage.
- A writer conflict is surfaced to the user instead of silently creating a fresh session.
- Runtime and persistence roots stay pinned across logical working-directory changes.
Why it matters
The incident described in the PR created sibling branches because one process wrote tool results while another reloaded the same persisted session from a stale tail. This fix rejects a second cooperating writer before model work begins, preserving transcript consistency.
More from coding & agent
- Godot games are trivially decompilable — compile C# to native DLL for real protection — mflux · 2026-10-26
- Techhalla shares full 2D-to-3D workflow with Opus 5.5 and Kling 4.0 prompts — techhalla · 2026-10-26
- Jason Furman: Building Econvitals pre-AI would need ~50 people, 3 years, $20M — HarrySurden · 2026-10-26
- Dev dictates to Claude Code for 4+ hours while riding indoor bike in aero position — jacob_posel · 2026-10-26
- Proxmox and LXCs are underrated in the age of AI agents — basedjensen · 2026-10-26
- A /be-ambitious Claude skill turns Ethan Mollick's 'more ambitious' AI advice into a workflow — daniel_mac8 · 2026-10-26