fix(task): optionally consume prompt files - #730
Open
fscfede-beep wants to merge 1 commit into
Open
Conversation
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
READ -> DELETE -> DISPATCH is the correct ownership order for an opt-in consume mode: a failed read preserves the caller's file, a failed unlink prevents execution, and successful dispatch cannot leave the supposedly consumed prompt behind. Keeping ordinary --prompt-file unchanged avoids surprising existing callers. The three regressions pin all of those branches cleanly.
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.
Summary
Fixes #622 by adding an opt-in
--prompt-file-consumeflag totask.When the flag is used with
--prompt-file, the companion now reads the prompt, unlinks the caller-provided file, and only then proceeds to task dispatch. Without the flag, existing--prompt-filebehavior is unchanged.Semantics
The ordering is deliberately:
READ -> DELETE -> DISPATCH--prompt-file-consume, the prompt file remains caller-owned as before;--prompt-file-consumewithout--prompt-filefails with a clear error.This implements the smallest opt-in fix proposed in #622 and does not mix in prompt digest verification or SessionEnd lifecycle changes.
Regression coverage
Added three runtime tests:
turn/start;--prompt-filepreserves the file;--prompt-fileis rejected.RED against
upstream/main(db52e28f4d9ded852ab3942cea316258ae4ef346): 1 pass / 2 fail, with the file remaining and the invalid flag combination exiting 0.GREEN with this patch: 3/3 pass.
Validation
bump-version,commands,git,process,render,state): 28/28 passnode --check plugins/codex/scripts/codex-companion.mjs: passnpx tsc -p tsconfig.app-server.json: passnpm run check-version: passgit diff --check: passI also attempted the full Windows suite. It does not terminate cleanly because the current test harness leaves app-server broker/fake-Codex processes behind; the first visible failure,
createBrokerEndpoint uses Unix sockets on non-Windows platforms, reproduces identically on an untouchedupstream/mainworktree. I therefore am not claiming a full-suite pass from this Windows host.Scope
Two files only:
plugins/codex/scripts/codex-companion.mjstests/runtime.test.mjsNo version bump or unrelated lifecycle changes.