[Bug] Tool approval accepts Enter while the validator is still running, with no loading indicator
Description
While a tool's validator is still running, the tool approval dialog already shows the Yes/No options with "Yes, execute this tool" selected. During that time there is no "Loading preview..." message and no preview, so the dialog looks fully ready. Pressing Enter approves the tool before anything about the call has been checked or shown.
This is the same root problem as #1407 (approval accepted before the preview loads), but it covers an earlier gap. Gating the selector only on isLoadingPreview would not fix it, because that flag is only set after the validator finishes.
Related: #1407, closed PR #1416
Environment
- OS: macOS 26.5.2
- Node version: v25.4.0
- Nanocoder version: 1.31.0 (run from source). The affected code is unchanged on
mainat 06c89ed. - Provider: any (reproduced with the real
ToolConfirmationcomponent and a delayed validator) - Model: any
Steps to Reproduce
- To make the validator wait visible, add a temporary delay in
source/components/tool-confirmation.tsxjust beforeconst validationResult = await validator(parsedArgs);(line 106):await new Promise(r => setTimeout(r, 5000)); - Run Nanocoder from source in a scratch folder, in normal mode.
- Ask for a harmless tool call that requires approval, for example "create a file hello.txt containing hi".
- When the approval dialog appears, press Enter immediately.
Expected Behavior
Yes/No should not accept input until the whole check is done: schema check, validator, then the formatter preview. Esc and "No" should keep working the whole time, so the user can still cancel.
Actual Behavior
- Enter approves the tool right away, while the validator is still running.
- The dialog shows no loading state at all during this time, so the user has no hint that the check isn't finished.
- The preview shows up only afterwards, once the approval has already been sent.
- The same thing happens later in the flow, while "Loading preview..." is on screen (as described in #1407).
Likely cause:
- In
source/components/tool-confirmation.tsx:73-148, the validator runs at line 106, butsetIsLoadingPreview(true)only happens at line 127, once the formatter starts. - The Yes/No selector is gated only on
!hasFormatterError(line 219), so it's interactive from the first render.
Logs/Screenshots
The screenshots come from a small harness that renders the real ToolConfirmation with a promise-delayed validator or formatter. It records the onConfirm result and never runs a tool handler. ready=false means the delay hadn't finished when Enter was accepted.
Validator still running, no loading message, already approved (RESULT: APPROVED; ready=false):

Preview still loading, already approved:

Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate (related to #1407, but covers the validator wait that #1407 doesn't)
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
Issue triage: possible duplicate of #1407
@puri-adityakumar — this looks like it covers the same ground as #1407 (open): [Bug] Tool approval Yes/No selector is interactive before the formatter preview has loaded, allowing blind approval.
This is the same underlying defect as #1407: the Yes/No selector in the tool approval dialog stays interactive while the validation/preview pipeline is still running, because the gating only checks !hasFormatterError. #1407 covers the formatter-preview stage, and you are flagging the earlier validator stage, but both stem from the same missing 'is anything still pending?' gate and would be fixed together.
If this is wrong, reply here saying why and a maintainer will take it from there. Otherwise it will be closed in 14 days.
Automated issue triage. It flags; it never closes on first sight. A maintainer can remove the label to dismiss this.
hey @addyCooks can you assign this to me..
Hey @addyCooks, you found #1407. This one looks close, but it's a different step: #1407 is while "Loading preview..." shows, and this is earlier, while the validator runs with no loading message at all. The isLoadingPreview-only fix from #1416 wouldn't cover it.
Since both are open and unassigned, I'd like to fix them together in one PR. could you assign both to me?
Thanks @puri-adityakumar, confirmed on main (7530ff79): the validator runs at tool-confirmation.tsx:106, setIsLoadingPreview(true) only at :127, and the Yes/No selector (:219) is gated only on !hasFormatterError. So it's live from first render with no loading message.
Not a duplicate of #1407 (that's the preview stage, this is the validator before it), so both stay open. No open PR exists for either (#1416 was closed unmerged).
Assigned #1814 to you. For #1407, please comment there asking for it and I'll assign it, so one PR can cover both.
Expected: no Yes/No input until validator and preview finish; Esc and "No" keep working. Add tests to the existing tool-confirmation.spec.tsx and don't commit badges/*.svg (both were problems in #1416).
@Vishesh-Verma-07 @AniketR10, thanks for offering. Both issues touch the same lines of one file, so one PR avoids conflicts. Please pick another open issue.
Thanks : )
@addyCooks this issue has been resolved. You can close it.
Fixed in #1864 (merged 2026-11-05), together with #1407. The approval dialog now shows "Checking tool call..." while the validator runs and "Loading preview..." while the preview loads, and it does not offer Yes/No until both have finished. Esc cancels throughout the checks.