docs(agentctl): document the ACP session-transition lock so new session paths do not bypass it - #3396
docs(agentctl): document the ACP session-transition lock so new session paths do not bypass it#3396nova28 wants to merge 1 commit into
Conversation
PR kdlbs#3338 added Adapter.sessionTransitionMu to serialize NewSession, LoadSession, and ResetSession, but the invariant was never written down where a future change to adapter_session.go would find it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe ACP adapter guidance now requires serialized handling of session lifecycle transitions, superseded-session cleanup, and all writes to ChangesACP session lifecycle guidance
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This change documents the existing ACP session-transition locking invariant without changing runtime behavior. No current merge-readiness risk remains. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| apps/backend/internal/agentctl/AGENTS.md | Adds accurate documentation of the ACP session-transition locking invariant and its concurrency rationale. |
Reviews (1): Last reviewed commit: "docs(agentctl): document ACP session-tra..." | Re-trigger Greptile
|
Thanks for the contribution. The added guidance records the existing session-transition mutex invariant for NewSession, LoadSession, ResetSession, and superseded-session cleanup. I found no additional code fix or unresolved review thread to apply. |
Tip
PR walkthrough: Open the visual walkthrough
Contributors reading
apps/backend/internal/agentctl/AGENTS.mdhad no written record that ACP session-transition RPCs (NewSession,LoadSession,ResetSession) must run serialized behindAdapter.sessionTransitionMu— the invariant that PR #3338 introduced to stop a concurrent transition from closing a session that had already become live again. Anyone touching this code path had to reconstruct that constraint by reading the lock sites themselves.Today: the serialization invariant PR #3338 added exists only in code; nothing documents it, so the next contributor adding a session-transition path has no written warning that it must hold the mutex for the whole transition, not just the write.
After this:
AGENTS.mdstates the invariant directly, naming the three serialized operations and the reason (agentctl dispatches WS requests to the adapter without serialization).Who hits this: anyone extending ACP session lifecycle handling in
apps/backend/internal/agentctl/server/adapter/transport/acp/.Scope: standalone documentation follow-up from PR #3338's review (three independent reviewers flagged the missing invariant).
Not here: no production code changes — the fix already shipped in
mainvia PR #3338'ssessionTransitionMu.Validation
This is a documentation-only change (one sentence appended to
apps/backend/internal/agentctl/AGENTS.md). Verification confirmed the documented invariant against the live code and ran the full check gauntlet:adapter_session.go:NewSession,LoadSession,ResetSession,closeSupersededSessionLocked) against the sentence added; confirmedResetSessionholds the mutex acrossnewSessionandcloseSupersededSessionLockedend to end, and that the only production writers ofa.sessionID(newSession,LoadSession) both run under the mutex.make fmtmake typecheck(backend + web)make lint(backend, web, harness, specs, architecture)make lint-formatpnpm run i18n:ratchet— clean, no UI source touchedgo test -tags fts5 ./...(backend, full suite): 13 packages failed. Reproduced the same 13 packages against a scratch worktree checked out at this branch's merge-base (ddcc4fc6a, pre-dating this change) — 12 failed identically (pre-existing sandbox filesystem restriction unrelated to any code, e.g.open npm cache root: not a directory), and the 13th (internal/orchestrator) failed only once, from a test-timeout caused by unrelated concurrent test runs on the shared build machine; it passed cleanly in isolation. None of these packages are touched by this diff (a single markdown file).E2E was not required: the sole changed path is
apps/backend/internal/agentctl/AGENTS.md, not underapps/web/where Playwright specs live.Possible Improvements
None — this documents an invariant that already shipped; no behavior changes.
Checklist
apps/web/), I have added or updated Playwright e2e tests inapps/web/e2e/and verified them withmake test-e2e.docs/public/**and updated them or noted why no docs change is needed.Preview Environment
aab19a0