Skip to content

docs+config(worker): rename per-type WORKER_*_MAX_SLOTS to *_RESERVED_SLOTS (#2963) - #3016

Open
nicoloboschi wants to merge 1 commit into
mainfrom
feat-worker-per-type-slot-limits
Open

docs+config(worker): rename per-type WORKER_*_MAX_SLOTS to *_RESERVED_SLOTS (#2963)#3016
nicoloboschi wants to merge 1 commit into
mainfrom
feat-worker-per-type-slot-limits

Conversation

@nicoloboschi

@nicoloboschi nicoloboschi commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Problem (#2963)

HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS reads like a per-type ceiling but is actually a reservation floor (a guaranteed minimum) — a type overflows the shared pool up to WORKER_MAX_SLOTS, so the name says the opposite of the behavior. The reporter hit exactly this: consolidation ran 6-concurrent with MAX_SLOTS=1, and it took a production latency investigation to discover the log line was working as designed.

(History for context: the var was a genuine max at the slim split, became a strict-partition reservation in #1006, then #1199 added shared-pool overflow — which is where the name became a misnomer.)

Change (issue's "part 1" — the cheap, high-value half)

Rename the per-type env vars to say what they do:

  • <TYPE>_RESERVED_SLOTS — the reservation floor (guaranteed minimum).
  • <TYPE>_MAX_SLOTS — kept as a deprecated alias that logs a warning (setting both is an error), so no existing deployment changes behavior.

TYPE ∈ {consolidation, retain, file_convert_retain, refresh_mental_model, graph_maintenance, import_documents}. Defaults unchanged (consolidation reserved=2).

Docs (current + version-0.8) now state plainly that a reservation is a floor, not a cap — a type's real ceiling is WORKER_MAX_SLOTS.

Scope

Deliberately rename-only. The issue's part 2 (an actual per-type concurrency ceiling) is a larger, behavior-changing follow-up that requires claim-time enforcement across both PG and Oracle; left out on purpose. The issue itself notes part 1 alone "would have saved us the investigation." Happy to do the ceiling as a separate PR if operators need it.

Tests

  • New <TYPE>_RESERVED_SLOTS parses into the reservation floor.
  • Deprecated <TYPE>_MAX_SLOTS maps to the floor and logs a warning.
  • Setting both the new var and the deprecated alias is rejected.

Full test_worker.py + test_config_validation.py green; lint clean.

Closes #2963. Supersedes #2987 (docs-only).

…_SLOTS (#2963)

The per-operation `HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS` env vars set a
reservation *floor* (a guaranteed minimum), not a ceiling — despite the name a
type overflows the shared pool up to WORKER_MAX_SLOTS. The reporter hit exactly
this: consolidation ran 6-concurrent with "MAX_SLOTS=1".

Rename them to `<TYPE>_RESERVED_SLOTS`, which says what they do. The old
`<TYPE>_MAX_SLOTS` stays as a deprecated alias that logs a warning (setting both
is an error), so no existing deployment changes behavior. Defaults unchanged
(consolidation reserved=2).

Docs (current + version-0.8) updated to state plainly that a reservation is a
floor, not a cap — a type's real ceiling is WORKER_MAX_SLOTS. Tests cover the
new env var, the deprecated-alias mapping + warning, and the both-set error.

This is the issue's "part 1" — the cheap, high-value half. A genuine per-type
concurrency ceiling is a separate follow-up if operators need one.
@nicoloboschi
nicoloboschi force-pushed the feat-worker-per-type-slot-limits branch from b4fe912 to c257003 Compare July 28, 2026 15:28
@nicoloboschi nicoloboschi changed the title feat(worker): per-type concurrency ceiling + rename reserved slots (#2963) docs+config(worker): rename per-type WORKER_*_MAX_SLOTS to *_RESERVED_SLOTS (#2963) Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS is a minimum, not a maximum

1 participant