Repository navigation
Let Codex look at the typeset PDF - #10
Merged
Merged
Conversation
New Codex tasks get a view_pdf tool. Codex asks for the pages where source lines are typeset, or for printed page numbers, in its worktree or in the accepted text. The review engine compiles them like a review round and draws the pages as PNG files, which Codex opens with its own view_image tool. The tool returns file paths rather than images: in testing, Codex's code mode printed returned images as base64 text, about 25k tokens for one page, against about 1.5k for a page opened by path. The engine compiles only the chapters that the edits and the asked-for places need when the paper allows partial builds, so the review after the turn reuses the build, and it reports compiler errors to the agent when the worktree does not compile. Papilot answers the call itself, without asking the author, and the conversation shows each look as "Viewed the PDF". The instructions ask Codex to use the tool when the look of the pages matters and not for wording alone. The tool is a dynamic tool of the app-server's experimental API, so Papilot now initializes Codex with experimentalApi. A Codex that refuses the tool starts its threads without it. Resumed threads keep the tool; tasks started before this change do not get it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New Codex tasks get a
view_pdftool, so the agent can see the typeset pages instead of editing LaTeX blind. Codex decides when to use it; the instructions ask for it when the look of the pages matters (line breaks, spacing, figures, tables, displayed formulas) and not for wording alone.main/chapters/intro.tex:42) or for printed page numbers when the PDF supplies page-label metadata, in its worktree or in the accepted text (accepted: true), up to 4 pages per call.POST /api/tasks/:name/viewsnapshots the worktree, compiles it like a review round (partial builds when the paper allows them, so the review after the turn reuses the build), finds pages withsynctex view, and draws them as PNG files under the engine's state folder. Compiler errors go back to the agent as the tool result.view_image. Returning images directly made Codex's code mode print the base64 as text (about 25k tokens for one page in testing); by path, one page costs about 1.5k tokens.Things to review
capabilities.experimentalApi, anddynamicToolsis passed onthread/startonly. If Codex rejects the tool, the thread starts without it and later threads skip it.task.viewPdf).views/<task>in the engine state for 6 hours, then the next view of that task removes them.Testing