Skip to content

GovernorContainer: process-global governors keyed by run_id with TTL cleanup #28

Description

@susheem-k

Summary

Today: new Governor per handler call. Shared spend already lives in SQLite; request-local Governors avoid shared in-memory windows but push construction onto the user and duplicate wiring.

Area: Governor lifecycle, concurrency, cleanup

Desired behavior

  • Top-level GovernorContainer (name TBD) is process-global / singleton-friendly.
  • Internally holds per-run_id Governor (or run state) instances.
  • pre_call / observe route by run_id from ambient attribution.
  • Periodic cleanup of completed / halted / TTL-expired runs’ local state.
  • Cloning from prototype (§10) when a run is first seen.

Acceptance sketch

  • Agent code does not build_governor per request; it talks to the container (or ambient scope does).
  • Concurrent runs in one process do not share step windows.

Reference: docs/notes/2026-07-23-design-fix-notes.md §11

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions