Skip to content

Gateway-session idle pruning risk for long one-shot agent invocations (#3164 follow-up) #3247

Open

Description

@james-in-a-box

Background

#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).

Concern (raised in #3244 review, non-blocking)

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:

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

  1. added
    p2
    on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions