Skip to content

Make idle provider-session reaping timeout configurable #3063

Description

@rdanhau

Summary

BB currently releases restorable provider sessions after a fixed 30-minute idle period. Please make this timeout configurable.

The current behavior is useful for fast thread resumption, but it can retain a significant amount of memory when several threads are idle—especially on smaller VPSs, laptops, or other machines with limited RAM.

Current behavior

  • Idle provider sessions are retained for approximately 30 minutes.
  • A periodic cleanup sweep then releases eligible sessions.
  • The timeout does not currently appear to be exposed as a user-configurable BB setting.
  • bb thread stop <thread-id> can be used for manual immediate release, but this requires managing threads individually.

Motivation

Different hosts have different resource constraints and usage patterns.

For example:

  • A larger workstation may reasonably prefer a longer timeout for faster resumption.
  • A small VPS with limited memory may prefer to release idle sessions after 5 or 10 minutes.
  • A user running many parallel threads may prefer a shorter timeout to avoid retaining multiple idle provider processes.
  • A user with abundant memory may prefer to keep the current 30-minute behavior.

ACP provider processes can consume hundreds of megabytes per session, depending on the provider and its helper processes. Retaining several idle sessions can therefore create avoidable memory pressure on smaller machines.

Prompt-cache lifetime is another relevant consideration. Cache behavior varies by provider and configuration, but several major providers document short default or in-memory cache windows. For example:

  • Anthropic documents a default 5-minute prompt-cache lifetime.
  • OpenAI documents in-memory cache entries typically remaining active for around 5–10 minutes of inactivity, while other cache modes can use longer retention.
  • xAI documents automatic prompt caching but notes that cache retention is not guaranteed.

This means that after a user has been inactive for 5–10 minutes, retaining a provider process for another 20–25 minutes may provide limited cache-resumption benefit while continuing to consume memory. The ideal timeout should therefore be user-controlled rather than assumed to be the same for every host and provider.

References:

Proposed behavior

Expose the idle-session timeout as a configurable setting, while keeping 30 minutes as the default for backwards compatibility.

Possible examples:

5m
10m
30m
1h
never

The setting could be global, per host, or otherwise scoped according to BB's existing configuration model.

The existing cleanup sweep could remain unchanged; it would simply use the configured idle threshold. Manual release through bb thread stop should continue to work.

Expected trade-off

A shorter timeout would reduce idle memory usage but may add a few seconds of startup/session-restoration latency when returning to an inactive thread. This is a useful trade-off for users to control explicitly.

Related issue

This is related to #1604, which addressed idle-session reclamation for non-Codex providers. This request is specifically about making the reclamation timeout configurable.

Acceptance criteria

  • The idle provider-session timeout is configurable.
  • The default remains 30 minutes.
  • The supported value format and scope are documented.
  • The configured timeout applies to eligible restorable provider sessions.
  • Manual session release continues to work.
  • The UI or CLI exposes the effective setting clearly.

Activity

  1. added
    host
    providers
    on Sep 4, 2026
  2. bb-slop-cop commented on Sep 4, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classified as:

    • Type: Feature
    • Priority: Medium
    • Effort: High
    • Labels: host, providers

    This requests new configurable behavior rather than reporting unexpected behavior, so bug reproduction and fix steps were skipped.

  3. toolittlecakes commented on Oct 20, 2026

    @toolittlecakes
    Contributor

    We ran into this too while testing a Telegram course bot backed by BB 0.45 and OpenCode on a small VPS.

    In our six-session test, all six provider processes stayed resident after their tasks completed, averaging roughly 470 MiB RSS each. RSS includes shared pages, so this is not an exact measure of their combined memory cost, but the retained processes create substantial memory pressure. Limiting active-thread concurrency does not bound the number of idle processes retained between turns.

    We could not find a supported setting for the 30-minute idle timeout / 5-minute cleanup interval. bb thread stop allows manual release, but it has no atomic “only if idle” condition: checking status and then stopping can race with a new incoming message.

    +1 for making the idle timeout configurable, ideally per host, while preserving the existing guards against releasing active/background work and allowing the same saved session to resume later. We'd really appreciate this improvement for memory-constrained deployments.

  4. added a commit that references this issue on Oct 20, 2026
    4ccae19
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

    hostproviders

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions