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
- NVIDIA says Nemotron 3 Ultra hit 97.1% on agentic RTL chip-design tasks — NVIDIAAI · 2026-07-27
- Tokyo Agent Forge hackathon shipped production-ready AI agents in one day — DavidBennett__ · 2026-07-27
- Long-running agents will need immutable event logs, this thread argues — sebpaquet · 2026-07-27
- Agentic Data Science in Practice: Agents Write Code but Answer Wrong Questions — hugobowne · 2026-07-27
- A VS Code extension adds Markdown-style highlighting to Alchemy string templates — samgoodwin89 · 2026-07-27
- Claude’s Stripe MCP connector is being called unusable after repeated disconnects — evielync · 2026-07-27