The session cap: three gaps left after braid#502 and braid#509 #535

Closed
opened 2026-11-13 15:07:32 -05:00 by cmoriarty · 1 comment
Owner

What happens

Braid holds agent steps to the sessions a backend serves (braid#498) and a step's helpers to its places (braid#502, braid#509). Three cases still pass it:

  • A step alone may have one helper in the background, and the scheduler does not count that helper when it admits another agent step.
  • Two steps in the run's main worktree (review lenses) share one gate, so they can be two steps and one helper: three sessions on a backend that serves two.
  • The ceiling is read from the profile in use and counts every agent step, so a run on another profile shares it.

None has been seen to cost anything yet.

Fix

Count a step's live background helpers in the scheduler's in-flight number, and keep the ceiling per backend, not per server.

Done when

A test shows no more sessions at work than the backend serves in each of the three cases.

**What happens** Braid holds agent steps to the sessions a backend serves (braid#498) and a step's helpers to its places (braid#502, braid#509). Three cases still pass it: - A step alone may have one helper in the background, and the scheduler does not count that helper when it admits another agent step. - Two steps in the run's main worktree (review lenses) share one gate, so they can be two steps and one helper: three sessions on a backend that serves two. - The ceiling is read from the profile in use and counts every agent step, so a run on another profile shares it. None has been seen to cost anything yet. **Fix** Count a step's live background helpers in the scheduler's in-flight number, and keep the ceiling per backend, not per server. **Done when** A test shows no more sessions at work than the backend serves in each of the three cases.
Author
Owner

All three gaps are closed. The ceiling is read per run, from the backend that run was started on. Agent steps and the places granted to their helpers are counted together. A helper started in the background asks osfd for a place (POST /api/runs/{run}/helper-place) and gives it back when it ends, and a helper its step waits for works in the step's place. If osfd does not answer within 2 s, the guard falls back to its old gate.

Evidence: a scheduler test where a helper in the background holds the next agent step and a second helper is refused, a per-run ceiling test, a route test, and a node test of the guard against a fake osfd. The helper sims pass.

Shipped in pull request 550 (merge 3bed64d), change console-fixes-and-session-cap, archived in pull request 551.

All three gaps are closed. The ceiling is read per run, from the backend that run was started on. Agent steps and the places granted to their helpers are counted together. A helper started in the background asks osfd for a place (`POST /api/runs/{run}/helper-place`) and gives it back when it ends, and a helper its step waits for works in the step's place. If osfd does not answer within 2 s, the guard falls back to its old gate. Evidence: a scheduler test where a helper in the background holds the next agent step and a second helper is refused, a per-run ceiling test, a route test, and a node test of the guard against a fake osfd. The helper sims pass. Shipped in pull request 550 (merge `3bed64d`), change `console-fixes-and-session-cap`, archived in pull request 551.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/braid#535
No description provided.