You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Service has no session-end signal over gRPC/HTTP (learned permission rules never evict there) #10
Surfaced by the #3 panel review (done in 67c6da4).
Problem
Service.CloseSession is the only path that evicts a session's learned permission rules (OnCloseSession → permstore.Forget). Today only the ACP adapter calls CloseSession (on editor disconnect). The gRPC and HTTP transports have no session-end signal, so on a long-lived mecated served over gRPC/HTTP, a session's learned allow_always rules (and any future per-session state wired to OnCloseSession) persist until process exit.
Bounded and per-session-isolated (each rule requires a human allow-always approval; permstore dedups), so not attacker-exploitable — but a real slow accumulation, and the per-session learned-rule slice is itself uncapped.
Options
Give gRPC/HTTP a session-end RPC/signal that routes through Service.CloseSession (symmetric with ACP).
Add a per-session cap on learned rules in permstore.Memory as a backstop.
A session TTL/idle eviction in the Service.
Related design note
The architecture review also flagged that Service.Config now has cross-cutting func hooks (OnCloseSession); if a third session-lifecycle consumer appears, prefer a single SessionLifecycleListener interface over more OnX hooks.
Implemented in f3c8b07 (feat(server): session-end signal over gRPC/HTTP + per-session learned-rule cap).
Option 1 — symmetric session-end signal ✅
New gRPC CloseSession RPC and HTTP DELETE /v1/sessions/{id}, both routing through a new precondition-checked Service.EndSession (verifies the session exists → NotFound/404 for a never-created id, then runs the same idempotent CloseSession teardown that ACP already used on editor disconnect).
Service.CloseSession keeps its void/idempotent signature (ACP depends on it); EndSession is its error-returning sibling for the request surfaces.
Close releases session-scoped resources only: it does not delete the persisted snapshot and does not cancel an in-flight run.
Option 2 — client-independent backstop ✅
permstore.Memory caps a session's learned-rule slice at maxRulesPerSession (256). Dedup runs first, so an identical re-learn at the cap is a no-op; only a new distinct rule is dropped — which makes that call keep asking. Fail-safe toward asking, never toward a silent allow.
Option 3 — TTL / idle eviction: deferred
Deliberately deferred pending telemetry. Recorded in ADR 0001.
Activity
JAORMX commentedon Jun 1, 2026
Shipped — closing as done
Implemented in f3c8b07 (
feat(server): session-end signal over gRPC/HTTP + per-session learned-rule cap).Option 1 — symmetric session-end signal ✅
CloseSessionRPC and HTTPDELETE /v1/sessions/{id}, both routing through a new precondition-checkedService.EndSession(verifies the session exists →NotFound/404 for a never-created id, then runs the same idempotentCloseSessionteardown that ACP already used on editor disconnect).Service.CloseSessionkeeps its void/idempotent signature (ACP depends on it);EndSessionis its error-returning sibling for the request surfaces.Option 2 — client-independent backstop ✅
permstore.Memorycaps a session's learned-rule slice atmaxRulesPerSession(256). Dedup runs first, so an identical re-learn at the cap is a no-op; only a new distinct rule is dropped — which makes that call keep asking. Fail-safe toward asking, never toward a silent allow.Option 3 — TTL / idle eviction: deferred
Design note (from the related architecture flag)
SessionLifecycleListenerrefactor was declined: Service has no session-end signal over gRPC/HTTP (learned permission rules never evict there) #10 adds callers of the existingOnCloseSessionhook, not a new hook, so the single-observer shape still holds. If a third session-lifecycle consumer appears, revisit.Tests are offline (mockllm + memfs): gRPC/HTTP close idempotency + NotFound,
EndSessioneviction/teardown-once, and the permstore cap + dedup-at-cap.feat(server): session-end signal over gRPC/HTTP + per-session learned…
feat(acp): mid-session teardown via session/close (#9)