Skip to content

feat(desktop): configurable group chat round cap + model-aware limits + token budget guard - #97492

Closed
beplee wants to merge 4 commits into
NousResearch:mainfrom
beplee:feat/port-round-cap-to-bot-mode-modules
Closed

beplee wants to merge 4 commits into
NousResearch:mainfrom
beplee:feat/port-round-cap-to-bot-mode-modules

Conversation

@beplee

@beplee beplee commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • Add group-chat-config.ts: config.yaml-driven group_chat.* settings + free-model detection
  • Make GROUP_CHAT_MAX_ROUNDS config-aware: free models (:free suffix or free_models[] allowlist) get unlimited rounds up to HARD_CAP=20, paid models default to max_rounds: 3
  • Add token-budget guard: cumulative room-log tokens exceeding group_chat.token_budget (default 80k chars) force exitKind='capped' independent of round count — the real safety net for pathological cascades
  • Add getGroupChatConfig(), isFreeModel(), getEffectiveRoundCap(), getCurrentModelName() helpers
  • Add config.yaml schema in cli-config.yaml.example under group_chat:

Why

Hardcoded 3-round cap is too tight for free-model rooms (where API cost is zero) and too loose for paid-model rooms (where each round burns real money). A single config block drives everything automatically.

Config

group_chat:
  max_rounds: 3              # paid models
  max_rounds_free: null      # null = unlimited (HARD_CAP=20 backstop)
  token_budget: 80000        # hard ceiling per drive (chars, ~20k tokens)
  free_models:               # quality-tier allowlist
    - upstage/solar-pro4
    - meituan/longcat-2.0
    - tencent/hy3
  hard_cap: 20               # absolute ceiling even for free models

Safety

  • Token budget is the real backstop — fires regardless of model type or round count
  • HARD_CAP=20 prevents unbounded free-model cascades (20 rounds × 6 bots = 120 messages max)
  • Paid models always capped at max_rounds (default 3)
  • exitKind='capped' logged to activity feed for every termination path

Test plan

  • Paid model → 3-round cap fires
  • Free model (allowlist) → 20-round cap fires
  • Token budget exhaustion → mid-drive cap fires
  • Model switch mid-drive → cap re-evaluates
  • 6-bot free room → halts cleanly at token budget
  • Empty free_models + :free suffix → allowlist is sole gate (no bypass)

Refs: #96726

beplee added 2 commits August 29, 2026 05:42
… + token budget guard

- Add group-chat-config.ts: config.yaml-driven group_chat settings + free-model detection
- Make GROUP_CHAT_MAX_ROUNDS config-aware: free models get unlimited rounds (up to HARD_CAP=20), paid models default 3
- Add token-budget guard: cumulative room-log tokens exceeding group_chat.token_budget (default 80k chars) force exitKind='capped' independent of round count
- Detect free models via :free suffix or free_models[] allowlist
- Add config.yaml schema in cli-config.yaml.example under group_chat:

Refs: NousResearch#96726
- Add braces to single-line if statements (curly rule)
- Remove unused GROUP_CHAT_MAX_ROUNDS import
- Sort named imports alphabetically (perfectionist/sort-named-imports)

All 6 ESLint errors resolved. Full check passes (0 errors, warnings only).
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) area/config Config system, migrations, profiles sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 28, 2026
@beplee

beplee commented Sep 2, 2026

Copy link
Copy Markdown
Author

The shared config module reads cleanly and the token-budget ceiling is the right backstop.

Closing this PR — #98616 (feat(desktop): drive Bot Mode room limits from config.yaml) already solves the same problem with a smaller change, actual tests (77 lines in group-rounds.test.ts), and the group_chat: block in cli-config.yaml.example. Rather than merge two mechanisms, I'm pointing at that one as the shared seam.

Credit for the model-aware free-model rounding idea — I'll carry that as a follow-up on top of #98616's schema.

@beplee beplee closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants