Skip to content

Fix stale glossary-sensitive outputs in selective retranslation - #32

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-845e
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-845e

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

Bug and impact

Existing translated chunks without run_state.json records were treated as record_only by default, even when the current glossary selected terms for that chunk. The skill records record_only_chunk_ids before launching subagents, so a stale translation from an old glossary could be stamped as current and then skipped forever. Alias-only glossary edits also did not change per-term hashes, so already-selected chunks could miss prompt-affecting alias changes.

Root cause

run_state.plan() did not inspect selected glossary terms before adopting untracked outputs, and glossary.term_hash() only hashed source/target/category, omitting aliases that are injected into the prompt term table.

Fix

  • Re-translate untracked outputs when the current glossary selects any terms for that chunk, while still record-only adopting glossary-free untracked outputs for resumability.
  • Include sorted aliases in term_hash() when aliases are present, preserving hash compatibility for no-alias records.
  • Update tests and docs/SKILL guidance for the refined behavior.

Validation

  • Reproduced the pre-fix CLI bug: glossary-sensitive chunk0001 was record-only and became unchanged after record-all; alias-only change was unchanged.
  • Post-fix CLI repro: chunk0001 stays in translation_chunk_ids, only glossary-free chunk0002 is record-only; alias-only change triggers translation.
  • python3 -m unittest tests.test_run_state tests.test_glossary -v (68 tests)
  • python3 -m unittest discover -s tests -p 'test_*.py' -v (209 tests, 3 skipped)
  • python3 -m compileall scripts tests
  • Standard Alice mock full pipeline: 38 chunks merged; HTML/DOCX/PDF generated. EPUB failed only with the documented Ubuntu Calibre 7.6.0 bytes/str issue.
Open in Web View Automation 

Co-authored-by: Rainman <deusyu@users.noreply.github.com>
@deusyu
deusyu force-pushed the cursor/critical-bug-investigation-845e branch from 507c3eb to ae54c79 Compare June 26, 2026 02:15
@cursor
cursor Bot deleted the cursor/critical-bug-investigation-845e branch July 2, 2026 08:22
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