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
Gateway-session idle pruning risk for long one-shot agent invocations (#3164 follow-up) #3247
#3244 retired the in-pod BRC wait arm and removed the gateway-session
keep-alive fan-out: post_heartbeat no longer calls _refresh_gateway_session, and that function was deleted. Under the
one-shot event-pump model, a pod's gateway session is refreshed at spawn
time (worktree re-attach) and by any git/gh request it makes
(validate_session bumps last_seen / expires_at).
The gateway idle window is DEFAULT_SESSION_IDLE_TIMEOUT_MINUTES = 60
(gateway/session_manager.py). It is refreshed only by actual gateway
activity — the wrapper's emit_heartbeat targets the orchestrator /heartbeat route, not the gateway. Nothing enforces a hard sub-60-min
bound on a single one-shot invocation. So a single agent invocation that
runs >60 min with no intervening gateway op (e.g. a long reviewer
deliberation, or a long no-git work window) can have its session pruned,
and its next push/gh call would fail.
A coder committing incrementally is fine (each push refreshes). The
exposure is a long invocation that does a gateway op, then >60 min of pure
non-gateway work, then needs another gateway op.
Why this is a follow-up, not an in-PR fix
The candidate mitigations each carry a design tradeoff that the
keep-alive removal in #3244 was a deliberate choice about:
Raise the gateway idle timeout — weakens abandoned-session cleanup
globally.
Add a per-invocation activeDeadlineSeconds < idle timeout — bounds
the window but changes one-shot Job failure semantics.
Picking among these is an architecture decision for the #3164 author /
operator, not a defensible default to ship inside a feedback pass.
Acceptance
Decide whether the one-shot model's exposure is acceptable as-is or pick a
mechanism, and either document the bound or implement it. Add a test that
asserts a single one-shot invocation cannot lose its gateway session
mid-flight (or that the chosen bound holds).
Activity