fix(del): pass --force to codex delete so it runs headless#7
Merged
Conversation
The picker runs `codex delete <id>` via exec from a non-interactive context (no TTY). Recent codex-cli refuses there with "cannot confirm session deletion without an interactive terminal; rerun with --force", which our best-effort `_ = cmd.Run()` swallowed — so the rollout file got removed but codex's index row (threads table in state_*.sqlite) was left behind, accumulating a dead entry per deleted codex session. Add --force so the native prune actually runs. File removal still backs it up if the command is missing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Deleting a codex session from the picker removed the rollout
.jsonlfile but left codex's index row behind (thethreadsrow in~/.codex/state_*.sqlite), so every deleted codex session leaked a dead entry that still shows up incodex resume.Root cause
The picker runs
codex delete <id>viaexec.Commandfrom a non-interactive context (no TTY). Recentcodex-clirefuses there:Our native step is best-effort (
_ = cmd.Run()), so this failure was swallowed — the file got removed by the fallback, masking that the index prune never ran.Fix
Pass
--forceso the native prune actually runs headless. File removal still backs it up if the command is missing.Verification
codex-cli 0.142.5: plaincodex delete <uuid>→ refuses without TTY;codex delete --force <uuid>→Deleted session <uuid>.and thethreadsrow is gone.go build ./... && go vet ./... && go test ./...all pass;deltest updated to expect the--forcearg.🤖 Generated with Claude Code