Skip to content

feat(agent): add standalone session turn budget proxy - #4171

Closed
lafrancef wants to merge 1 commit into
mainfrom
flafrance/standalone-turn-proxy
Closed

lafrancef wants to merge 1 commit into
mainfrom
flafrance/standalone-turn-proxy

Conversation

@lafrancef

Copy link
Copy Markdown
Contributor

Add a standalone per-session proxy that caps policy model POST attempts and returns a typed terminal budget stop, giving adapters a shared runtime for turn-constrained rollouts.

Use TurnConstraintSession to bind the policy client to session.base_url, then persist session.metadata after exit. The usage guide covers configuration, routing, partial-result verification and receipt persistence.

  • Enforce atomic admission, forward at most N requests, and return HTTP 400 / session_budget_exhausted for subsequent attempts. Retries and auxiliary calls through the endpoint consume budget; a natural finish on request N is not exhaustion.
  • Forward Chat Completions and Responses streams, preserve upstream capture prefixes, support large histories and retain reminder placement at the start of system transcripts.
  • Own listener cleanup and active-request cancellation, disable hidden upstream retries, and retain requested/resolved settings, explicit counters, runtime version and stop reason on normal and exceptional exits.

Existing harness behavior stays unchanged until an adapter explicitly binds this primitive. Adapter integrations must preserve partial outputs for normal verification and keep infrastructure failures distinct from intentional budget stops.

Rollout evidence: N/A for this standalone library change; no agent or verifier is wired to the proxy by this PR. Local HTTP fixtures exercise both streaming APIs, concurrent admission, independent sessions, retry accounting, capture routing and teardown. Harness-level model qualification belongs with each subsequent binding.

No separate issue is needed for this self-contained runtime addition.

@lafrancef lafrancef added feature New capabilities, enhancements, or enablement work area:core Shared APIs, servers, telemetry, health, and registries needs-review PR is ready for code review and waiting on a reviewer labels Oct 7, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 added the complexity:medium Single-domain change with interacting parts or a moderate review surface label Oct 7, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 8, 2026
@lafrancef
lafrancef marked this pull request as draft October 8, 2026 15:22
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 8, 2026
@lafrancef lafrancef closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared APIs, servers, telemetry, health, and registries complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants