Repository navigation
feat: add LastMessage to read --output-last-message back - #168
Merged
Merged
Conversation
CodexWrapper.LastMessage.run/3 runs Exec, ExecResume, ExecFork or Review
with an owned 0600 temp file for --output-last-message, reads it after the
process exits, and removes it on success, failure or raise. An explicit
output_last_message/2 path is used as given and left to the caller.
Exit 0 with a missing or empty file returns {:no_last_message, result};
a non-zero exit returns {:process_failed, text, result}. A native run with
codex-cli 0.165.0 shows a failed turn exits 1 without writing the file.
Closes #153.
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.
Closes #153.
Changes
CodexWrapper.LastMessage.run/3(command, config, opts) forExec,ExecResume,ExecForkandReview. With no explicit path it creates a temp file with mode 0600 inSystem.tmp_dir!/0, sets--output-last-message, runs the command through itsexecute/3(so observation options pass through), reads the file and removes it in anafterblock. This followsCodexWrapper.Structured.output_last_message/2path is used as given; the wrapper reads it but does not create or remove it.{:ok, text, result}: exit 0, non-empty file{:error, {:no_last_message, result}}: exit 0, missing or empty file{:error, {:process_failed, text, result}}: non-zero exit, with""when nothing was written{:error, {:last_message_read, reason, result}}: other read failures{:error, {:last_message_file, reason}}: temp file creation failedtest/fixtures/fake_codex_last_message) that writes the-opath: all four commands, explicit path, missing and empty output, non-zero exit, file mode, cleanup after error and raise, option forwarding, read errors.docs/last-message-native-0.165.0.mdrecords the native failed-turn run: codex-cli 0.165.0 with an unsupported model exits 1 and does not create the-ofile, so an owned file stays empty and the text is"".Checks
On the host:
mix deps.unlock --check-unused,mix hex.audit,mix compile --warnings-as-errors,mix format --check-formatted,mix credo --strict,mix dialyzer,mix test(616 passed, 4 excluded),mix docs --warnings-as-errors.The change was made by a Codex agent (codex-cli 0.165.0,
workspace_write) in a gen_agent_server instance, in two turns: the implementation, then a revision that replaced a network-blocked probe record with the host's native run. The procedure and run record are in genagent/gen_agent_server#134.