Skip to content

fix(loops,ui,data): resolve adversarial loop-review audit findings (DL-1, P-3, P-4, P-8, P-9, P-11) - #134

Merged
spuentesp merged 1 commit into
masterfrom
fix/review-audit-findings
Nov 6, 2026
Merged

spuentesp merged 1 commit into
masterfrom
fix/review-audit-findings

Conversation

@spuentesp

Copy link
Copy Markdown
Owner

Fixes uncovered during the adversarial review & live verification of the merged loop-review PRs (#120–#133):

  • F1 / F11 (Risu / ConversationLoop turn-100 & orphan turn recovery): Allow end_conversation to resume a 100-turn conversation via allow_at_limit=True when close_session failed on turn 100; skip active conversations already at >= 100 player turns in find_client_conversation; strip and persist trailing unanswered player turns on resume and sync turns on failed step(); resolve character_id from client_session on monitor_session_id-only OpenAI calls.
  • F2 (roll_under advantage/disadvantage inversion): Invert keep direction when roll_under=True (advantage -> 2d20kl1, disadvantage -> 2d20kh1) in _format_dice_spec and Resolver._execute_roll.
  • F3 (Dice-pool doubling & threshold parsing): Pass dynamic modifier bonus (modifier - base_modifier) into _pool_proposal_fields and _execute_roll so vampire.json attributes (calc_modifier -> stat_value) do not double pool_size; parse pool thresholds safely and exclude additive 2d6+stat PbtA / 4dF Fate from count-successes pool execution.
  • F4 / F8 / F12 (SceneLoop combat & working-state persistence): Defer _run_combat while awaiting a player roll (propose_roll or forced_narrative_pushback), populate pending_roll on forced_narrative_pushback, and pass only_resource_deltas=True with case-insensitive HP matching and max_value initialization when persisting combat HP deltas.
  • F5 / F9 (WebSocket parity & error recovery): Keep WebSocket open (continue instead of break) on llm_provider_error, include restored dice_request, guard json.loads and dice_result.value conversion, and handle phase == 'scene_ended'.
  • F6 (SillyTavern lorebook disable round-trip): Add disable to _KNOWN_ST_FIELDS, exclude disable/enabled from st_extensions merge on export so toggling is_active is never overwritten, and add include_inactive query param on GET /lorebook/entries.
  • F7 (PostgresClient concurrency & close()): Serialize same-loop connect() with a per-loop asyncio.Lock and close the running loop's pool in close().

…L-1, P-3, P-4, P-8, P-9, P-11)

- Allow end_conversation to resume 100-turn conversations via allow_at_limit=True, skip maxed conversations in find_client_conversation, and strip/sync orphan trailing player turns on failed LLM calls (F1, F11)
- Invert roll-under advantage/disadvantage keep direction (2d20kl1/2d20kh1) in _format_dice_spec and Resolver._execute_roll (F2)
- Avoid doubling dice-pool size when calc_modifier returns stat_value (vampire.json) and parse count-successes pool thresholds without concatenating multi-band PbtA strings (F3)
- Defer SceneLoop._run_combat while awaiting a player roll on propose_roll or forced_narrative_pushback, populate pending_roll on pushback, and pass only_resource_deltas=True with case-insensitive HP matching on combat persistence (F4, F8, F12)
- Keep WebSocket active on llm_provider_error, include restored dice_request, guard JSON/int parsing, and handle scene_ended phase (F5, F9)
- Exclude disable/enabled from st_extensions overwrite on SillyTavern lorebook export and expose include_inactive on GET /lorebook/entries (F6)
- Guard PostgresClient.connect with a per-loop asyncio.Lock and close the active loop's pool in close() (F7)
@spuentesp
spuentesp merged commit d7bd469 into master Nov 6, 2026
7 of 10 checks passed
@spuentesp
spuentesp deleted the fix/review-audit-findings branch November 6, 2026 17:21
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