CloudAgentNext - Apply balance-skip eligibility to command sendMessage follow-ups#4477
Conversation
…w-ups sendMessage only routed prompt payloads through the free/BYOK balance-skip client, so command follow-ups (slash commands) on free or BYOK sessions still hit the worker $1 balance gate and 402'd for the zero-balance users the feature targets. Resolve the session's stored model for command turns via getSession and route them through the same computeCloudAgentNextBalanceCheckEligibility check as prompts. Fall back to the balance-checked client when no session model is available. Direct-to-sandbox operations (terminals, answers, interrupt) remain outside sendMessage and unchanged.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe command-turn Files Reviewed (4 files)
Previous Review Summary (commit 7e11036)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 7e11036)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe new Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Reviewed by claude-sonnet-5 · Input: 36 · Output: 6.3K · Cached: 1M Review guidance: REVIEW.md from base branch |
…ssion fails Degrade to the PR's existing safe default instead of failing the sendMessage mutation with an unmapped error when the worker can't return a command turn's session model. Added a regression test in each router for the getSession-rejects fallback.
Summary
sendMessageonly routedpromptpayloads through the free/BYOK balance-skip client, socommandfollow-ups (slash commands like/review) on free or BYOK sessions still hit the worker$1balance gate and402'd for the zero-balance users the feature targets.Both the personal and organization
sendMessagerouters now apply the samecomputeCloudAgentNextBalanceCheckEligibility→createCloudAgentNextClientForModelpath to both payload types:promptturns use the per-messagepayload.model(unchanged).commandturns carry no model, so the session's stored model is resolved viagetSessionand used for eligibility.Direct-to-sandbox operations (terminals, answers, interrupt) are outside
sendMessageand unchanged.Verification
pnpm --filter web teston the two router test files → 47/47 pass (6 new command-path tests added: free → skip, paid → enforce, no-model → fallback).pnpm --filter web typecheck→ clean.pnpm format→ clean.oxlinton changed files → 0 warnings/errors.