Skip to content

fix(capacity): drop hardcoded cap of 10 in set_max_parallel_tasks - #4567

Merged
vybe merged 3 commits into
Abilityai:devfrom
pcbeingused333:fix/4564-capacity-db-bound
Nov 17, 2026
Merged

vybe merged 3 commits into
Abilityai:devfrom
pcbeingused333:fix/4564-capacity-db-bound

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4564

Description

PUT /api/agents/{name}/capacity returned 500 ("Failed to update capacity") for any value from 11 up to the admin-set fleet ceiling. #506 moved the router's upper bound to the ceiling, but set_max_parallel_tasks in db/agent_settings/resources.py still returned False for max_tasks > 10, which the router turns into a 500.

The DB layer now keeps only the lower bound (< 1); the router remains the single place that validates against the ceiling. The router is the only caller.

Related Issue

Fixes #4564

Journey Impact

Journey Impact: none: bug fix in capacity validation; no journey promise changes

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • I have tested this locally
  • New tests added (if applicable)
  • All existing tests pass
  • Every new test executes the changed path

New: tests/unit/test_4564_capacity_db_bound.py (registered in tests/registry.json): 16 is stored and read back, 1 and 10 still work, 0 and negatives are still rejected, an unknown agent returns False. test_506_max_parallel_ceiling.py still passes; the full suite was not run. Before the change test_value_above_old_cap_is_stored fails (set_max_parallel_tasks("agent-1", 16) returns False).

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • I have added appropriate logging for new functionality

This PR was prepared with AI assistance (Claude Code).

The router validates against the fleet ceiling (Abilityai#506) but the DB layer still
rejected values above 10, so PUT /capacity returned 500 for 11..ceiling.

Fixes Abilityai#4564

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
@vybe

vybe commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-17): on the train as is. Validated at 8412b87f4; the router's 1..ceiling check and the clamp in capacity_manager.acquire remain the bounds once the db-layer cap goes. Two notes, not blocking: the body's "the router is the only caller" is not quite right (a second caller exists and passes 1, so it is unaffected), and no test drives the router hand-off the issue suggested (ceiling 32, PUT 16, expect 200 and effective 16) — a good follow-up test.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20261117-1746 (#4626)

@vybe
vybe merged commit 53e383b into Abilityai:dev Nov 17, 2026
25 checks passed
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.

2 participants