Skip to content

Clear a stale Prompt required error once the prompt has text - #175

Merged
MehranMarxian merged 1 commit into
mainfrom
fix/wallet-clears-prompt-error
Nov 5, 2026
Merged

MehranMarxian merged 1 commit into
mainfrom
fix/wallet-clears-prompt-error

Conversation

@MehranMarxian

@MehranMarxian MehranMarxian commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Fixes finding (4) from the 2026-11-05 G4 smoke run (docs/uxp-smoke-checklist.md, Results table): a "Prompt required" error stayed on Text to Image after a prompt was loaded from the Wallet.

What changed and why

When you press Generate with an empty prompt, the handler sets two things: the status bar reads "Prompt required." with the red Error pill, and the error line says "Enter a prompt before generating." Nothing cleared them until the next Generate. So Wallet › Use put a full prompt in the field while the error underneath still said there was none. Typing a prompt left the same stale error; the Wallet just made it more obvious, because Load takes you to another screen and back.

  • New src/ui/promptRequiredReset.ts. It adds a listener on each tool's prompt field. On input, if the status still reads exactly "Prompt required." and the field now has text, it hides the error line and sets the bar back to "Ready." (the same text and tone the panel shows at startup). The decision lives in a small pure helper, isPromptRequiredErrorStale.
  • Why it listens on the field instead of changing the Wallet: every way a prompt arrives already fires input: typing, Wallet Load (useEntry dispatches it), the agent bridge (notifyFieldChanged) and prompt-memory undo. One listener covers all four, and promptWallet.ts doesn't change.
  • Other errors are never touched. The reset only runs while the status text is exactly the prompt-required one, so "Generation failed.", "ComfyUI is offline." and the rest stay up when you type.
  • It covers all seven tools that stop with that status: Text to Image, Image to Image, Sketch to Image, Inpaint (through its readiness gate), Outpaint, Style Reference and Multi-Reference. Live Painting, Unflatten and Prompt from Layer have Wallet dots but no prompt-required stop.
  • App.ts: +2 lines, 6 edited. It imports the module and calls bindPromptRequiredReset(elements) right after bindPromptWallet. The six inline "Prompt required." strings now use the exported PROMPT_REQUIRED_STATUS, so the code that writes the status and the code that checks it can't drift apart.
  • The binder is wrapped in try/catch, like bindPromptWallet, so a throw can't stop the rest of renderApp from binding.

There are no changes to styles.css, appMarkup.ts or any Photoshop call.

Tests

tests/ui/promptRequiredReset.test.ts (jsdom, real panel markup, 15 tests):

  • the helper, including UXP's null for an empty field and whitespace-only prompts;
  • the real binder clears the error on input, keeps it while the field is still blank, leaves other errors alone, and only clears the tool whose field changed;
  • finding 4 end to end: real bindPromptWallet and real binder, Generate with no prompt, Load › Use. The bar reads "Ready.", the pill is not Error, the error line is hidden, and diagnostics say "Prompt loaded from Wallet.";
  • registration guards: App.ts no longer contains the literal "Prompt required."; every set…Status(elements, PROMPT_REQUIRED_STATUS, "error") in App.ts belongs to a registered tool; Inpaint's readiness label equals the constant; each tool's prompt field is paired with its own status bar.

Mutation check: when I made the helper return false, 4 of the 15 tests failed (the helper case, the typing case, the per-tool case and the Wallet end-to-end case). Restoring it made them pass again.

What was verified

> npm run typecheck
> tsc --noEmit
(no errors)

> npm run lint
> eslint .
(no errors)

> npm test
 Test Files  142 passed (142)
      Tests  1402 passed (1402)

> npm run build
✓ built in 1.08s
Copied UXP assets to dist.

In Photoshop 2025 (Windows 11), by Claude through computer-use, on this branch's dist/ loaded with UXP Developer Tool. No document was open; the empty-prompt check runs before anything is captured.

  1. Home › Text to Image, prompt empty, Generate. The bar showed "Prompt required." with the Error pill, and the red line said "Enter a prompt before generating." (finding reproduced).
  2. Purple Wallet dot › "Choose a prompt for Text to Image." › Use on the first saved prompt.
  3. Back on Text to Image: the prompt was in the field, the bar read "Ready." with the Ready pill, the red line was gone, and the line under the bar said "Prompt loaded from Wallet."

This also shows that UXP passes the Wallet's dispatched input event on to the new listener, which jsdom can't prove.

What could NOT be verified

  • Typing a prompt by hand to clear the error in Photoshop. It's covered in jsdom only, because typing through computer-use is unreliable in panel fields.
  • The other six tools in Photoshop. They use the same listener and their own setters, and that's covered in jsdom only.
  • macOS, and Photoshop 2024.

Open question

The fix also clears the error when you type a prompt, not only when you load one, because that's the same stale-error bug. If you'd rather it only cleared on Wallet Load, say so and I'll narrow it.

What Mehran should check in Photoshop

To test this branch: GitHub Desktop › Current Branch › fix/wallet-clears-prompt-error, then npm run build, then UXP Developer Tool › OpenLayer › Reload. Do it on the Home screen or in a new document.

  1. Home › Text to Image. Clear the prompt, press Generate. See: "Prompt required." / Error and "Enter a prompt before generating."
  2. Press the purple dot under Prompt › Use on any saved prompt. See: you're back on Text to Image with the prompt filled in, the bar says Ready., and the red line is gone.
  3. Clear the prompt again, press Generate to raise the error, then type one word. See: the error disappears as you type.
  4. Optional: repeat step 1 then step 3 on Outpaint (no negative prompt field) to see a second tool clear.

Smoke checklist blocks to re-check (docs/uxp-smoke-checklist.md)

  • Block 0: the panel starts (0.1 to 0.5)
  • 1.4: clear the prompt and Generate, a message that a prompt is needed, nothing sent
  • 4.4: Prompt Wallet save, open, use, the prompt comes back

🤖 Generated with Claude Code

Pressing Generate with an empty prompt sets the status bar to "Prompt
required." with the Error pill and shows "Enter a prompt before
generating." under it. Nothing took either down until the next Generate,
so loading a prompt from the Wallet left a full prompt field sitting
above an error saying there was none (G4 smoke run 2026-11-05, finding 4).
Typing had the same problem.

A small input listener on each tool's prompt field now resets the bar to
"Ready." and hides the error line when the status still reads "Prompt
required." and the field has text. Every way a prompt arrives already
fires "input" (typing, Wallet Load, the agent bridge, prompt-memory
undo), so the Wallet itself does not change. It never touches any other
error: the status text has to be exactly the prompt-required one.

It covers the seven tools that stop with that status, Inpaint included
(through its readiness gate). App.ts now writes the status through one
exported constant, and a test fails if a tool starts writing it without
being registered for the reset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MehranMarxian
MehranMarxian merged commit 95dcccd into main Nov 5, 2026
1 check passed
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.

1 participant