Skip to content

feat(backlog-manager): maximize throughput by filling all available capacity slots#1176

Merged
aaight merged 2 commits intodevfrom
feature/backlog-manager-maximize-throughput
Apr 23, 2026
Merged

feat(backlog-manager): maximize throughput by filling all available capacity slots#1176
aaight merged 2 commits intodevfrom
feature/backlog-manager-maximize-throughput

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 23, 2026

Summary

Fixes the backlog-manager agent so it fills ALL remaining capacity slots rather than conservatively moving only one item at a time.

Previously, with maxInFlightItems=2 and two independent backlog items, the agent would move only one to TODO. This PR strengthens the prompt language to eliminate the ambiguity.

  • Strengthened system prompt (backlog-manager.eta): rewrites the CAPACITY LIMIT section and Step 3/4 to explicitly instruct the agent to move the maximum number of eligible items, adds a dedicated MAXIMIZE THROUGHPUT rule for maxInFlightItems > 1
  • Strengthened YAML task prompt (backlog-manager.yaml): task Step 2 now says "select ALL eligible unblocked items to fill remaining capacity completely — always move the maximum number possible"
  • availableSlots added to PipelineCapacityResult: computed in all return paths (backlog-empty = limit, at-capacity = 0, below-capacity = limit − inFlightCount), exposed in all log payloads at call sites in pr-merged.ts and agent-execution.ts
  • Tests updated: 26 backlog-check tests now assert availableSlots; 3 new prompt tests verify the strengthened language; worker-entry.test.ts gets a beforeEach fix for CASCADE process environment inheritance

Test plan

  • tests/unit/triggers/shared/backlog-check.test.ts — 26 tests all pass, including new availableSlots assertions for every reason code
  • tests/unit/agents/prompts.test.ts — 109 tests pass; 3 new tests verify the maximize-throughput language
  • tests/unit/worker-entry.test.ts — 21 tests pass (fixed pre-existing failure caused by JOB_* env vars inherited from CASCADE worker process)
  • Lint: biome check . — no issues
  • Type check: tsc --noEmit — zero errors

Trello card

https://trello.com/c/69ea85be987570b9ab179ebc

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Cascade Bot and others added 2 commits April 23, 2026 21:05
…CADE process inheritance

When running inside a CASCADE worker container, JOB_ID, JOB_TYPE, and JOB_DATA
are set in the process environment. Tests in `main() - environment variable
validation` must clear these before each test so the "all env vars absent"
case actually sees an empty environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/triggers/shared/agent-execution.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

Summary

LGTM - The prompt strengthening provides clear, disambiguated instructions to the agent to ensure maximum throughput, and the addition of availableSlots to the capacity check makes the state clearer in logs.

The test coverage is thorough and perfectly matches the new logic. The fix in worker-entry.test.ts to clear JOB_* env vars is a nice addition that will prevent CI/local environment flakiness.

🕵️ opencode · google/gemini-3.1-pro-preview · run details

@aaight aaight merged commit e9f85e2 into dev Apr 23, 2026
9 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