Sessions on one akh still serialise on the per-workspace Agent mutex, so parallel ACP sessions remain impossible #318
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/wi-019fa44f-sessions-on-one-akh-still-serialise-on-t"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Anima work item
019fa44f-da1f-78e1-813d-1897f0ce5fd4.Why this exists separately
akh-medu WI-221 ("Extract per-session SessionContext from ChatProcessor", merged 2026-07-27 as PR #237) removed the first of two serialisation points. It was scoped, correctly, to
ChatProcessor— that is what its description asked for and that is what it delivered:kg_cache,trajectoryandelizamoved into a per-sessionSessionContext, theRefCell-inside-Mutexanti-pattern removed, and the clone-modify-write per turn eliminated.The second lock was never in scope. An operator believed they had extended WI-221 to cover it, but the channel used (
description_revisionswithauthor_id = 'operator') is filtered out before it reaches any agent — see the correction documentanima-prompt-inventory-correction-20260727. Neither the implementer nor the reviewer ever saw the extension. This work item states it properly.The remaining serialisation point
On
origin/main:Every ACP turn takes the per-workspace
Arc<Mutex<Agent>>, and the background learning daemon holds the same lock on its own schedule. So two sessions on one akh workspace cannot both make progress, regardless of WI-221.Evidence this is real, not theoretical
2026-07-27 09:13:25 — three work items dispatched to tecton in the same second:
WI-37's entire session:
No
acp.agent_thoughtat all — the model never ran. Exactly 300s of nothing between handshake and watchdog. That is lock contention, not slow inference.A second observation the same day is sharper: when two sessions ran concurrently (WI-37 and WI-33, 12:43-13:25), they did not cleanly serialise with one winning. Both crawled — WI-37 produced 27 events in 41 minutes and pushed nothing at all. Contention degrades both sessions rather than queueing them.
Required change
Agentmutex actually protects during a turn. Separate genuinely-shared workspace state (the engine, the KG) from per-turn state that belongs alongsideSessionContext.MutexforRwLockwithout checking that turns are read-mostly — measure rather than assume.Acceptance
kg_cache/trajectory/eliza. (WI-221 established this; keep it.)Why it matters now
tecton is being run at WIP 1 by hand because of this. The target architecture (2026-07-27) puts throughput management in the runners and expects executors to advertise real capacity; an akh that can only ever run one turn at a time caps that at 1 per workspace. This is the blocker between the current fleet and per-akh parallelism.
REVIEW — CHANGES REQUESTED (2026-07-31, PR #277 @ stale)
Rebase-and-reimplement on current
main. The branch cannot land as it stands.mergeable: false, last touched 2026-07-29 19:48 — two days stale.302fb347) and #279 (0f9f1261), both now onmain, which rewrotesrc/acp/mod.rsandsrc/agent/agentic_chat.rs— two ofthe files this branch also edits. The conflict is structural, not textual.
WI-222-IMPLEMENTATION-SUMMARY.md(+163) anddocs/ai/plans/2026-07-29-concurrent-acp-sessions.md(+194) at the repo root /docs tree. Neither belongs in a change whose scope is the per-workspace
Agentmutex. Drop them.
ooda.rs,oxifed.rs,email/mod.rsandtrigger.rs. Justify each file that is not on the lock path, or leave it alone.What has changed underneath this item
The idle watchdog no longer kills a turn during tool-call generation:
#279added a client-side 10s heartbeat delivered through a
recv_timeoutselect(not from inside the blocking read loop), plus
AKH_SOCKET_READ_TIMEOUT_SECS(default 60s) separating socket death from application stall. Deployed as image
0fc0416b257don 2026-07-31.That matters here: the previous eleven attempts at this work item were killed
mid-generation by that bug, which is why the branch looks half-finished. Start
from current
mainand the turn should now survive long edits.The acceptance criteria in the original brief stand unchanged — in particular
two ACP sessions on the SAME workspace must both make progress concurrently;
a sequential test proves nothing.
Verdict entered by hand on the primary DB — the operator PAT lacks
workitem.submit_review.8015607659fcc77d19efbc0d7378b35e1e4703cfWIP: Sessions on one akh still serialise on the per-workspace Agent mutex, so parallel ACP sessions remain impossibleto Sessions on one akh still serialise on the per-workspace Agent mutex, so parallel ACP sessions remain impossible