Skip to content

fix(generate_script): fallback to auto mode on invalid custom_script#9

Open
fancyboi999 wants to merge 1 commit intoFireRedTeam:mainfrom
fancyboi999:fancy/fix-generate-script-fallback
Open

fix(generate_script): fallback to auto mode on invalid custom_script#9
fancyboi999 wants to merge 1 commit intoFireRedTeam:mainfrom
fancyboi999:fancy/fix-generate-script-fallback

Conversation

@fancyboi999
Copy link

@fancyboi999 fancyboi999 commented Feb 11, 2026

Summary

  • fix invalid custom_script handling in generate_script
  • when custom_script format validation fails, fallback to normal auto-generation path instead of returning invalid payload
  • initialize and return script_title safely from parsed JSON to keep return path deterministic

Why

Previously, invalid custom_script input could be returned directly, which propagates malformed structure to downstream nodes. This creates avoidable runtime instability.

Changes

  • src/open_storyline/nodes/core_nodes/generate_script.py
    • valid custom_script: unchanged behavior (immediate return)
    • invalid custom_script: log and fallback to auto generation
    • return title through explicit script_title default

Validation

  • python3 -m py_compile src/open_storyline/nodes/core_nodes/generate_script.py
  • regression script coverage:
    • invalid custom_script -> fallback auto generation
    • valid custom_script -> no llm call
    • invalid llm json -> raises expected ValueError (no variable undefined issue)

Scope

  • code only, no docs included

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