Skip to content

Fix run_state adoption of glossary-sensitive stale outputs - #34

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

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

Conversation

@cursor

@cursor cursor Bot commented Jun 27, 2026

Copy link
Copy Markdown

Bug and impact

Untracked output_chunk*.md files were accepted as record-only even when their source chunk selected terms from the current glossary. A stale translated chunk could be recorded under the new glossary and then become permanently unchanged, silently preserving wrong terminology in final book outputs. Alias-only edits to an already-selected term were also ignored because aliases were omitted from the per-term hash.

Root cause

run_state.plan() treated every existing output without a run_state.json record as safe to adopt unless --retranslate-untracked was passed. glossary.term_hash() hashed only source/target/category even though aliases are injected into subagent prompts.

Fix

  • Require untracked chunks that select current glossary terms to be translated before recording state.
  • Keep glossary-insensitive untracked outputs eligible for record-only adoption.
  • Include sorted aliases in term hashes when aliases are present.
  • Update SKILL/README docs and add regression tests for both stale adoption and alias-only glossary changes.

Validation

  • Pre-fix repro showed chunk0001 record-only, then permanently unchanged after record-all and alias edits.
  • Post-fix repro shows chunk0001 in translation_chunk_ids, chunk0002 record-only, and alias edits retrigger chunk0001.
  • python3 -m unittest tests.test_run_state tests.test_glossary -v (68 tests OK)
  • python3 -m unittest discover -s tests -p 'test_*.py' -v (209 tests OK, 3 skipped)
  • python3 -m compileall scripts tests
  • Standard Alice mock full-pipeline smoke: 38 chunks merged; HTML/DOCX/PDF generated successfully; 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>
@cursor
cursor Bot deleted the cursor/critical-bug-investigation-996e 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