Repository navigation
Name a Codex script by the tools it calls, not by those its strings name - #82
Merged
Merged
Conversation
# Conflicts: # CHANGELOG.md
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.
Codex's reader names an
execscript by the tools it calls, asexec: apply_patch, exec_command. It found them by everytools.in the script's text, strings included. So a script that only searches,await tools.exec_command({cmd: "rg -n tools.apply_patch src"}), was namedexec: exec_command, apply_patch, as if it also patched files.sessions read,read_sessionand the handoff show that name, and #77 makes the handoff'sreads_onlydecide by it, so with #77 such a script would still count as work.The name now takes only calls: each
tools.<name>(outside the script's strings. A string is one in"or`, to its closing quote, past\-escaped ones. That covers the shapes in the tests and the fixture (commands and patches in"strings) and patches in template literals, whichagents::patchedalready expects. Not': outside a string, a'may be an apostrophe in a comment, and taking it for a string would hide every call after it. So a tool's call written inside a'string, as'tools.apply_patch(', is still named, as before. The decision is written beside the code.The test
agents::codex::tests::a_script_is_named_by_the_tools_it_calls_not_those_its_strings_namenames three scripts: the one above, a patch in a template literal that adds a line callingtools.view_image(, and a command whose string holds an escaped\"tools.view_image(\"followed by a realtools.apply_patch(call. On origin/main it fails:It passes with the fix. The existing test
a_conversation_keeps_the_persons_words_and_names_what_a_script_didand the Codex snapshots (sessions-read-codex,sessions-read-failed) pass unchanged: no snapshot changed.ingest::READERSstays as it is: the name is built only when a transcript is read, on demand, and transcripts aren't stored. CHANGELOG.md gets an entry under 0.1.5.Checked:
cargo fmt --check,cargo clippy --all-targets --locked -- -D warnings,cargo test --locked,TZ=America/Chicago cargo test --lockedandRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --lockedall pass. Not run: the Swift tests, shellcheck, actionlint and cargo deny, since nothing they cover changed; the handoff cases, since the handoff's code didn't change. Not checked: how often real Codex scripts use'strings or comments; I didn't look at real sessions.