@@ -878,9 +878,23 @@ def run_translations(state: WorkflowState) -> WorkflowState:
878878 print (f" ✓ Loaded { len (translated_outputs )} translation(s)" )
879879 for key in translated_outputs .keys ():
880880 print (f" - { key } " )
881+ return state
881882 else :
882- print (" ⚠ Could not load translation outputs" )
883- return state
883+ print (" ⚠ Could not load translation outputs from previous run" )
884+ print (" ℹ️ Will continue to translation phase to generate translations" )
885+ # Don't return - continue to translation phase
886+ else :
887+ # Debug not enabled, try to load anyway
888+ translated_outputs = load_translation_outputs_from_run (prev_run )
889+ if translated_outputs :
890+ state ["translated_outputs" ] = translated_outputs
891+ print (f" ✓ Loaded { len (translated_outputs )} translation(s)" )
892+ for key in translated_outputs .keys ():
893+ print (f" - { key } " )
894+ return state
895+ else :
896+ print (" ⚠ Could not load translation outputs from previous run" )
897+ print (" ℹ️ Will continue to translation phase to generate translations" )
884898
885899 # If not in reuse list but output exists, ask user
886900 elif prev_run .has_stage_output ("translation" ) and "translation" not in reuse_stages :
@@ -1041,9 +1055,25 @@ def run_post_processing(state: WorkflowState) -> WorkflowState:
10411055 else :
10421056 print (" ⚠ No translated outputs found - zh-TW will not be post-processed!" )
10431057 print (" ℹ️ Make sure translation phase completed successfully" )
1058+ # In resume mode, check if we should have translations
1059+ if resume_config :
1060+ print (" 🔍 Resume mode: Checking if translations should be loaded..." )
1061+ reuse_stages = resume_config .get ("reuse_stages" , {})
1062+ if reuse_stages .get ("translation" ):
1063+ print (" ⚠ Translation marked for reuse but not found in state!" )
1064+ print (" ℹ️ Try re-running translation phase or check previous run" )
10441065
10451066 print (f" Total outputs to process: { len (all_outputs )} " )
10461067
1068+ # Critical check: If we have writer outputs but no translations, warn
1069+ if writer_keys and not translated_keys :
1070+ print ("\n ⚠️ WARNING: English outputs exist but no translations found!" )
1071+ print (" This means zh-TW files will NOT be generated." )
1072+ print (" Possible causes:" )
1073+ print (" 1. Translation phase was skipped or failed" )
1074+ print (" 2. Translation phase was not executed" )
1075+ print (" 3. In resume mode: translations not loaded from previous run" )
1076+
10471077 # Check if resuming and ask user whether to run post-processing
10481078 resume_config = state .get ("_resume_config" , {})
10491079 reuse_stages = resume_config .get ("reuse_stages" , {}) if resume_config else {}
@@ -1056,11 +1086,28 @@ def run_post_processing(state: WorkflowState) -> WorkflowState:
10561086 if prev_run .has_stage_output ("post_processing" ):
10571087 cached_outputs = load_post_processing_outputs_from_run (prev_run )
10581088 if cached_outputs :
1059- should_reuse = ask_reuse_stage ("post_processing" , prev_run )
1060- if should_reuse :
1061- print (" ⏭️ Reusing post-processing output from previous run" )
1062- state ["final_outputs" ] = cached_outputs
1063- return state
1089+ # Check if cached outputs include all current outputs (including translations)
1090+ current_outputs = set (all_outputs .keys ())
1091+ cached_keys = set (cached_outputs .keys ())
1092+
1093+ # Debug: Show what's in cache vs what we need
1094+ print (f"\n 📦 Cached post-processing outputs: { sorted (cached_keys )} " )
1095+ print (f" 📋 Current outputs to process: { sorted (current_outputs )} " )
1096+
1097+ missing = current_outputs - cached_keys
1098+ if missing :
1099+ print (f" ⚠ Missing outputs in cache: { sorted (missing )} " )
1100+ print (f" ℹ️ Will re-run post-processing to include missing outputs" )
1101+ # Don't reuse, continue to post-processing
1102+ else :
1103+ should_reuse = ask_reuse_stage ("post_processing" , prev_run )
1104+ if should_reuse :
1105+ print (" ⏭️ Reusing post-processing output from previous run" )
1106+ # Merge cached with any new outputs (shouldn't happen, but safe)
1107+ final_cached = cached_outputs .copy ()
1108+ final_cached .update (all_outputs ) # Add any new outputs
1109+ state ["final_outputs" ] = final_cached
1110+ return state
10641111 else :
10651112 print (" ⚠ Post-processing outputs not found in previous run; re-running post-processing" )
10661113
0 commit comments