Skip to content

hardening(gateway): define global resource budgets and graceful drain deadlines #1617

Open

Description

@BYK

Motivation

Lore already has several stream-specific limits, but resource control should be auditable across the whole process. Agent Gateway bounds bodies, pools, caches, windows, handshakes, queues, and shutdown. Lore needs a single inventory and coherent process-wide budget model.

Scope

  • Inventory all request/response byte limits, retained stream state, caches, sessions, concurrent distillations/curations, workers, queues, and timers.
  • Add missing global caps and explicit admission behavior.
  • Define graceful drain plus a hard termination deadline.
  • Ensure limits compose across chained recall continuations.

Acceptance criteria

  • Every potentially unbounded collection or retained byte stream has a documented owner and limit.
  • Limit errors are protocol-correct and do not leak hidden recall data.
  • Concurrent sessions cannot each independently exceed the intended process budget.
  • Shutdown stops admission, drains active work to a deadline, flushes required state, then terminates.
  • Stress tests cover slow clients, large bodies, recall chains, worker saturation, and cache pressure.
  • Resource-limit metrics identify the exhausted budget.

Focused implementation slices for #1708

The September performance incident is split into independently shippable work. Keep this issue as the broader resource-budget inventory; avoid implementing the same fixes twice.

Use #1733 to verify the combined result. Other global limits and graceful-drain scope in this issue remain open; completing one slice does not close this whole issue.

Separate recall-budget workstream

This belongs to the broader resource-budget inventory and proceeds independently of #1708's latency investigation and implementation plan.

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions