Lossless Changelog
component

Centralize Final Draft Path Logic & Bump Prefix to 7

Consolidated all final draft file resolution into `src/final_draft.py` and bumped the canonical prefix from `6` to `7`. Previously, three agents each had their own inline glob logic to locate the final draft — now they all call shared utility functions.

Changelog - 2026-03-17_01

Centralize Final Draft Path Logic & Bump Prefix to 7

Consolidated all final draft file resolution into src/final_draft.py and bumped the canonical prefix from 6 to 7. Previously, three agents each had their own inline glob logic to locate the final draft — now they all call shared utility functions. Also increased the LangGraph recursion limit to prevent failures on longer pipelines.


Problem Statement

Multiple agents (citation_assembly, citation_validator, validator, main) each had their own copy of the "find the final draft file" glob pattern. When the naming prefix changed (e.g., 4-final-draft.md → 6-*.md), every call site had to be updated manually. This was fragile and led to inconsistencies.

Additionally, the default LangGraph recursion limit (25) was too low for the growing pipeline (28+ nodes), causing failures on runs with conditional retries.


What Changed

Modified: src/final_draft.py

  • Prefix bumped: FINAL_DRAFT_PREFIX changed from "6" to "7"

  • Backward compatibility: find_final_draft() now falls back to 6-*-v*.md pattern before trying legacy 4-final-draft.md

  • Lookup order: 7-*.md → 6-*-v*.md → 4-final-draft.md

Modified: src/agents/citation_assembly.py

  • Removed: Inline glob loop searching for 6-*.md with fallback directory name construction

  • Added: Imports get_final_draft_path() from src.final_draft — single function call replaces 8 lines

Modified: src/agents/citation_validator.py

  • Removed: Inline loop over ["6-*.md", "4-final-draft.md"] patterns

  • Added: Imports find_final_draft() from src.final_draft — single function call replaces 5 lines

Modified: src/agents/validator.py

  • Removed: Inline loop over ["6-*.md", "4-final-draft.md"] patterns

  • Added: Imports find_final_draft() from src.final_draft — single function call replaces 5 lines

Modified: src/main.py

  • Removed: Hardcoded f"6-{safe_name}-{version}.md" path construction

  • Added: Imports get_final_draft_path() and get_final_draft_filename() from src.final_draft

  • Final draft path and version recording now use canonical utilities

Modified: src/workflow.py

  • Added: config={"recursion_limit": 50} to app.invoke() call

  • Prevents GraphRecursionError on pipelines with 28+ nodes and conditional edges


Files Changed

FileChange
src/final_draft.pyPrefix 6 → 7, added 6-* fallback in find_final_draft()
src/agents/citation_assembly.pyReplaced inline glob with get_final_draft_path() import
src/agents/citation_validator.pyReplaced inline glob with find_final_draft() import
src/agents/validator.pyReplaced inline glob with find_final_draft() import
src/main.pyReplaced hardcoded path with get_final_draft_path() / get_final_draft_filename()
src/workflow.pyAdded recursion_limit: 50 to workflow invocation

Migration Notes

  • Non-breaking: The fallback chain (7-*.md → 6-*.md → 4-final-draft.md) ensures existing output directories are still readable.

  • New runs will produce 7-{Deal}-{Version}.md as the final draft filename.

  • No workflow graph changes: Agent sequence is unchanged; only the invocation config was updated.