bbsbot
2026-03-22
Bust exit logic, combat_surrender login fixes, cyclomatic complexity reduction, control-stream codec
122 files · 13,527+ · 9,739-
Bust detection: exit on bust threshold and infinite move cycles
3 files changed
game_loop.pyAdded bust threshold detection — raises BustExitError after BUST_STREAK_THRESHOLD + BUST_EXIT_TURNS (50 total) zero-delta turns with credits below thresholdloop_guards.pyAdded infinite move cycle detection logicloop_handlers.pyUpdated loop handlers for bust exit path
- When a bot accumulates a zero-delta streak (no credits gained) exceeding BUST_STREAK_THRESHOLD + BUST_EXIT_TURNS (50 total turns) with credits below the bust threshold, the game loop raises BustExitError, marks the account as bust in the store, and exits. The SwarmManager respawns a fresh agent for the account.
instantiate
behavioral
2 files
game_loop.pyloop_guards.py
Enable bust_respawn by default in SwarmManager
1 file changed
ops.pybust_respawn now defaults to True in SwarmManager
- bust_respawn enabled by default so busted accounts are automatically respawned with a fresh agent without manual intervention.
baseline
behavioral
1 file
ops.py
combat_surrender handling in login phases 1 and 3
2 files changed
phases.pyAdded combat_surrender detection in phase 1 — when the 'Surrender your previous session? (Y/N)' prompt appears during initial login (TWGS session takeover), answers Yphases_p3.pyNew module: phase 3 prompt-id fallback helpers extracted from phases.py to satisfy file-size limits; includes combat_surrender handling for phase 3
- TWGS shows ‘Surrender your previous session? (Y/N)’ during login when the account is still connected. This was previously handled only in phase 3; now also handled in phase 1 where it occurs during the initial session takeover flow.
remediate
behavioral
2 files
phases.pyphases_p3.py
Split update.py: extract TW2002-specific update logic
3 files changed
update_tw2002.pyNew module (389 lines): TW2002-specific bot update logic extracted from update.py to satisfy 600-line LOC limitupdate.pyReduced by extracting TW2002 code; delegates to update_tw2002.pystatus.pyStatus consolidation
Control-stream codec in WebSocket dashboard and worker bridge
3 files changed
dashboard.jsImplemented control-stream codec for WebSocket message framing in the browser dashboardsession.pyUpdated session to use control-stream codecgeneric_io.pyUpdated IO layer for codec integration
- Dashboard WebSocket and worker bridge now use the control-stream binary codec for framing, aligning bbsbot with the undef-terminal protocol. TermBridge._send_snapshot overridden to use session.snapshot().
instantiate
behavioral
2 files
dashboard.jssession.py
Cyclomatic complexity reduction to rank B
40 files changed
orchestration.pyMajor refactoring to reduce complexitylayers.pyComplexity reductionsequence.pyComplexity reductionparsing_logic.pyComplexity reductionbot_navigation.pyComplexity reductionrecovery.pyComplexity reductionloop_handlers.pyComplexity reductionloop_guards.pyComplexity reductiondecision_maker.pyComplexity reductioncontrol_basic.pyComplexity reductionheuristics.pyComplexity reductionfast_check.pyComplexity reductionrenderer.pyComplexity reductiontrigger.pyComplexity reductionadvisor.pyComplexity reductionanomaly_detectors.pyComplexity reductionloop_state.pyComplexity reductionloop_action_selection.pyComplexity reductionloop_menu_recovery.pyComplexity reductionguard_logic.pyComplexity reductionprompt_handlers.pyComplexity reductionscreen.pyComplexity reductionstate_bridge.pyComplexity reductioncargo_ledger.pyComplexity reductionexecutor_trade.pyComplexity reductionexecutor_warp.pyComplexity reductionguard_core.pyComplexity reductionguard_decision.pyComplexity reductionstrategy_core.pyComplexity reductionstrategy_goals.pyComplexity reductionstrategy_interventions.pyComplexity reductiongoals.pyComplexity reductionprompts.pyComplexity reductionparser.pyComplexity reductionvalidator.pyComplexity reductionfeedback_loop.pyComplexity reductionstrategy_core.pyComplexity reductionopportunity_finder.pyComplexity reductionexploration.pyComplexity reductionbase.pyComplexity reduction
- Full codebase pass to reduce cyclomatic complexity to rank B across all modules. Pre-existing ruff lint violations fixed as part of the same pass. Large functions extracted into helpers; nested conditions flattened; repeated patterns consolidated.
decouple
internal
3 files
orchestration.pylayers.pysequence.py
Compile rules helper and worker/session fixes
30 files changed
__init__.pyExtracted _compile_rules() helper with re.error handling; docstring addedsession_manager.pyAdded release_by_agent() alias in AccountPoolStoreaccount_pool_store.pyrelease_by_agent alias; consistency fixescli_swarm.pyAdded --agent-id as alias for --bot-id in worker CLImanaged_bot_runtime.pyUpdated managed bot runtimesession_manager.pyTrimmed by refactoring repeated patternsresume.pyResume handling updatesconnection.pyConnection handling updatescharacter.pyCharacter state updatesutils.pyLogin utility updatesmcp_context.pyMCP context updatescontrol_manager.pyMCP control manager updatestools_core.pyMCP tools core updatesmcp_tools_goals.pyGoals tool updatesmcp_tools_intervention.pyIntervention tool updatesmcp_tools_session.pySession tool updatesmanager_plugin.pyManager plugin updatesmcp_context.pyMCP context updatesknowledge.pyKnowledge base updatestradewars.pyAddon updatesdebug_screens.pyDebug screen updatesautotune.pyAutotune updatescombat.pyCombat handling updatesconstants.pyAdded constants__init__.pyPackage updatesutils.pyTrade utility updates__init__.pyGame module updatessettings_diff.pySettings diff updatestedit_manager.pyTEdit manager updatesgenerate_diagrams.pyDiagram generation script updates
Dashboard fix: CONNECTING status and dot recovery
1 file changed
dashboard.jsNew bots now show CONNECTING status before first update; spinner dot now recovers after update errors
- Dashboard renders CONNECTING for newly registered bots instead of blank/undefined status. The status dot is reset after any update error so it doesn’t stay in an error state permanently.
remediate
behavioral
1 file
dashboard.js
Test coverage additions
7 files changed
test_bbs_session_targeting.py13 new MCP session targeting teststest_account_pool_store.py7 new account pool store teststest_session_manager.py50-line updates to session manager teststest_engine.py30-line learning engine teststest_loop_guards.pyUpdated loop guard teststest_no_interaction_backoff.py48-line backoff testsuv.lockLockfile update
- Added tests for concurrent reuse race (verifies exactly one transport connect), MCP session targeting, account pool store release_by_agent, invalid regex patterns in _compile_rules, and summary credentials.
qualify
internal
3 files
test_bbs_session_targeting.pytest_account_pool_store.pytest_session_manager.py