You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
paper_orchestrator strips opening triple-backtick fence but not the language tag #149
lines[0] is ```latex and lines[1:-1] correctly skips it. Good.
But for:
```
\section{Introduction}
...
(no closing fence — the model ran out of tokens), the else branch joins lines[1:], which is fine.
The bug is the first code path when there's no closing fence: lines[-1].strip() == "```" is False, so we take "\n".join(lines[1:]), which discards line 0 — but we've already stripped the language tag. The actual text the model meant to emit (starting at \section{Introduction}) is preserved. So far so good.
The real issue is what happens inside the section content: if the model is overzealous and wraps individual algorithm blocks in nested triple-backticks (a documented behaviour for minimax with high temperature), this naive strip-leading-fence does nothing to the embedded fences, which then end up verbatim in the LaTeX source — and pdflatex chokes on them.
Repro of the failure mode:
\section{Method}
Our method works as follows:
\begin{algorithm}[H]
...
\end{algorithm}
The two ``` lines get written verbatim into sections/method.tex via write_paper_file(paper_id, f"sections/{section['id']}.tex", content) (line 538). pdflatex reports ! Undefined control sequence at the backtick line, the compile fails, and the user gets the simplified fpdf PDF fallback — which is fine for preview but breaks the "Stable release baseline: Paper generation path" claim in the README (line 364).
Suggested fix: a re.sub(r"```(?:[a-zA-Z]+)?\n?", "", content) pass that strips all fences, not just the outermost ones, before writing the section file.
Activity