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
- First-ever Three.js Conference lands in Paris, with a panel on AI-shortened design workflows — OdinLovis · 2026-09-11
- Data engineering, not agent frameworks, is the real bottleneck for enterprise AI agents — dhruv2038 · 2026-09-11
- GPT-6 Astra beats Factorio with enemies in 44 in-game hours at ~$4,500 API cost — liminal_bardo · 2026-09-11
- Investment Analyst Asks How to Build a Claude-Based Diligence Agent Stack — Careless_Tie2286 · 2026-09-11
- Treating agents like 50 First Dates: a 3-layer context system so every conversation doesn't start from zero — evielync · 2026-09-11
- Running the Firefox MCP on Android via Termux, ngrok, and mcp-proxy — Nervous-Strain7544 · 2026-09-11