Saved-reset prompt pre-selects "Yes": one Enter irreversibly spends a Codex/Claude reset and silently enables auto-redeem
Summary
The "Spend a saved Codex/Claude rate-limit reset?" prompt pre-selects Yes. A single Enter — or any automated keypress into a terminal driving omp — irreversibly redeems a saved reset and persists codexResets.autoRedeem: yes (or claudeResets.autoRedeem: yes), so every later blocked turn spends further resets without asking.
This is very likely the root cause of #11200 ("I do not recall granting persistent consent … no audit trail showing when, how, or by whom this value became yes").
Where
packages/coding-agent/src/session/agent-session.ts, #confirmAutoRedeem:
const choice = await runner.getUIContext().select(question, [
{ label: "Yes", description: `Redeem now and remember yes for future eligible ${providerLabel} resets.` },
{ label: "No", description: `Do not auto-redeem saved ${providerLabel} resets.` },
]);
if (choice === "Yes") {
cfgCodexResetsAutoRedeem.set(this.settings, "yes"); // persisted
return true; // spends
}select opens with the first option highlighted, so the default action is the irreversible one, and the only "yes" path also silently turns on permanent auto-redeem.
Repro
codexResets.autoRedeem: unset(the default), interactive TUI, an OAuth Codex account at its weekly limit with ≥1 saved reset.- Send a prompt →
usage_limit_reached→ the prompt appears with❯ Yespre-selected. - Press Enter (or have a terminal driver / test harness send
\r). - A reset is redeemed and
config.ymlnow containscodexResets.autoRedeem: "yes".
We hit this from an automated PTY test harness: a keystroke meant to dismiss the dialog was delivered as Enter, and a reset was spent roughly 12 h before the weekly window would have reset on its own. Resets cannot be refunded.
Expected
- The pre-selected default of an irreversible, credit-spending prompt must be the non-spending choice.
- Spending once should not silently opt the user into permanent auto-redeem; that needs its own explicit choice.
Proposed fix (implemented in our fork, happy to PR it)
[
{ label: "No", description: `Keep the saved reset and stop asking (${settingsKey}: no).` },
{ label: "Yes, once", description: `Spend this saved reset now; ask again next time.` },
{ label: "Always", description: `Spend now and auto-redeem future eligible resets (${settingsKey}: yes).` },
]"Yes, once"→ return true, no setting change."Always"→ persistyes, return true."No"(the default) → persistno, return false.
Regression test: drive #confirmAutoRedeem through an extensionRunner stub whose select returns the first offered label and assert nothing is redeemed (fails on the current order: first label is "Yes"), plus tests that "Yes, once" spends without persisting and only "Always" persists yes.
Related: #11200, #6825.
omp 18.3.1 (fork of 18.3.1), linux-arm64 / macOS / Windows.
Source: can1357/oh-my-pi