Skip to content

test: align send-budget default assertion with shipped 20x/200 cap#138

Closed
jithin23-kv wants to merge 1 commit into
KeyValueSoftwareSystems:masterfrom
jithin23-kv:test/align-send-budget-default
Closed

test: align send-budget default assertion with shipped 20x/200 cap#138
jithin23-kv wants to merge 1 commit into
KeyValueSoftwareSystems:masterfrom
jithin23-kv:test/align-send-budget-default

Conversation

@jithin23-kv

@jithin23-kv jithin23-kv commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

runners/cli/tests/fork.test.ts was failing on master, so the CLI test suite was red (28/29). CI did not surface this because the test job only runs the core and sdk workspaces — the CLI suite is never executed (flagged in the OSS-readiness review, §Testing).

Root cause

The test asserted BudgetGuard send-budget defaults of 300 (50× budgetUsd) and 400 (no budget), but the shipped code in core/src/autonomous/lib/budget.ts:64 uses 20× budgetUsd (else 200):

this.maxTotalSends =
  opts.maxTotalSends ?? (opts.budgetUsd ? Math.ceil(opts.budgetUsd * 20) : 200);

So budgetUsd: 6 → 120 (not 300) and no-budget → 200 (not 400).

Change

Test-only. Updated the two assertions and the test name to match the shipped 20×/200 behaviour (the lower, safer spend ceiling — confirmed as intended). No production code touched.

How verified

  • npm test --workspace=@keyvaluesystems/agent-opfor-cli → green (was failing)
  • npm run typecheck · npm run lint · npm run format:check → all pass
  • Pre-commit hook (typecheck/lint/format/catalog/validate-skills/gitleaks) passed; committed without --no-verify.

Risk

None — single test file, asserts existing behaviour.

Follow-ups (separate PRs)

  • Run the CLI + MCP workspaces in CI so this class of regression is caught.
  • If the intended cap was actually 50×/400, flip budget.ts instead and revert this — but the shipped value is 20×/200.

Summary by CodeRabbit

  • Bug Fixes
    • Adjusted default send limits for budget-based runs to be more conservative.
    • When a budget is set, the app now scales the total send limit lower than before; when no budget is set, it uses a fixed default limit.

The fork.test.ts case asserted maxTotalSends defaults of 300 (50x budgetUsd)
and 400 (no budget), but BudgetGuard (core/src/autonomous/lib/budget.ts:64)
ships 20x / 200. The suite was red on master; CI did not catch it because the
CLI workspace tests are not run in CI. Update the assertions to match the
shipped behaviour (120 and 200) so the suite passes.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ada7202c-9736-4203-b223-946e92d377c8

📥 Commits

Reviewing files that changed from the base of the PR and between 55596b3 and 3b10aac.

📒 Files selected for processing (1)
  • runners/cli/tests/fork.test.ts

Walkthrough

The BudgetGuard test in fork.test.ts updates expected default values for maxTotalSends: from 300 to 120 when budgetUsd is provided, and from 400 to 200 when unset. The test title is updated to match the new scaling formula.

Changes

BudgetGuard default scaling test

Layer / File(s) Summary
BudgetGuard maxTotalSends assertions
runners/cli/tests/fork.test.ts
Expected maxTotalSends defaults reduced: 300→120 (with budgetUsd) and 400→200 (without), with updated test title reflecting 20× budgetUsd scaling.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the test-only budget default alignment.
Description check ✅ Passed The PR includes the main template content—problem, fix, changes, verification, risk, and follow-ups—though Issue and Screenshots are not explicitly filled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jithin23-kv jithin23-kv deleted the test/align-send-budget-default branch June 30, 2026 09:50
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.

1 participant