Skip to content

fix(task): optionally consume prompt files - #730

Open
fscfede-beep wants to merge 1 commit into
openai:mainfrom
fscfede-beep:fix/consume-prompt-file-622
Open

fix(task): optionally consume prompt files#730
fscfede-beep wants to merge 1 commit into
openai:mainfrom
fscfede-beep:fix/consume-prompt-file-622

Conversation

@fscfede-beep

Copy link
Copy Markdown

Summary

Fixes #622 by adding an opt-in --prompt-file-consume flag to task.

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-file behavior is unchanged.

Semantics

The ordering is deliberately:

READ -> DELETE -> DISPATCH

  • if the read fails, no deletion is attempted;
  • if the unlink fails, task dispatch does not proceed;
  • without --prompt-file-consume, the prompt file remains caller-owned as before;
  • --prompt-file-consume without --prompt-file fails 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:

  1. consume mode deletes the prompt file after a successful read and the exact prompt still reaches turn/start;
  2. ordinary --prompt-file preserves the file;
  3. consume mode without --prompt-file is 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

  • focused prompt-file runtime tests: 3/3 pass
  • non-runtime suites (bump-version, commands, git, process, render, state): 28/28 pass
  • node --check plugins/codex/scripts/codex-companion.mjs: pass
  • npx tsc -p tsconfig.app-server.json: pass
  • npm run check-version: pass
  • git diff --check: pass
  • high-confidence secret/private-marker scan of the diff: pass

I 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 untouched upstream/main worktree. I therefore am not claiming a full-suite pass from this Windows host.

Scope

Two files only:

  • plugins/codex/scripts/codex-companion.mjs
  • tests/runtime.test.mjs

No version bump or unrelated lifecycle changes.

@fscfede-beep
fscfede-beep requested a review from a team September 4, 2026 17:20

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task --prompt-file: the prompt path is discarded after reading, so no plugin cleanup can ever remove the caller's file

2 participants