Repository navigation
fix(content): ask for one opportunity for a prompt, and offer the one it already has - #1797
Merged
gkhngyk merged 2 commits intoOct 29, 2026
Merged
Conversation
… it already has A prompt belongs to one prompt group, which gets one opportunity, so New with a prompt as its focus could never write more than one, while the dialog let you pick 3 and said it would use 3. With a prompt the count is now 1, with a note to use Another angle for a different take. When the run writes nothing because the prompt already has an open opportunity, the toast says so with Open existing, from the existingId the job already returned. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 29, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked
- With the Prompt focus the dialog caps the count at 1 (
cap = min(1, max)), More is off, and the submit check uses the same cap, so it can't send more than 1. The chosen count is kept in state, so leaving the Prompt focus brings it back. Withmax0 nothing can be sent, as before. - The server already treats a prompt request as targeted (
open.slice(0, count ?? 1)), and only a prompt request (or a page's, which "+ New" doesn't send) returnsexistingIdwith nothing written, so "This prompt already has an opportunity" can't show for a topic or Let Ansvisor choose run.existingIdwas already in the job result type. - Open existing calls
selectOpportunity, the same path as a row click, so the panel and?opportunity=match.selectOpportunityis defined abovepollJoband added to its dependencies. - The order of toasts keeps "limit reached" first;
newNothingandnewDoneare unchanged for the other cases. - Three new
en.jsonkeys, all used; onlyen.jsonexists. - Web only: no migration, no new route or server action, no embeds.
plan-row.test.ts(client imports never reach the server Supabase client) passes on the PR merged with main. - Merges cleanly with main.
Follow-ups (not blocking)
- The PR says the "+ New" section of
help/content/content-opportunities.mdis added on #1792, but #1792's article has no "+ New" section yet. Once both are in, add it there, including that a prompt asks for one.
Tests (PR merged with main): web vitest new-opportunities-dialog.test.tsx, content/page.test.tsx, plan-row.test.ts, subscription-guard-coverage.test.ts: 20 passed. tsc --noEmit clean; eslint and prettier clean on the touched files.
4 of 5 tasks
4 tasks done
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.
Summary
Content › Opportunities › New, with a prompt as the focus, let you pick 3 and said "Uses 3 of your N remaining", but a prompt belongs to one prompt group and a group gets one opportunity, so at most one could come. When the prompt's group already had an open opportunity, the result was "No new opportunities: every matching need already has one", with no way to find that one. Reported while testing on 2026-10-29: Let Ansvisor choose (3) gave 2 + 1 duplicate, a topic (3) gave 1, then a prompt (3) gave none.
What changes (web only)
new-opportunities-dialog.tsx: with the Prompt focus the count is 1 and More is off. The note beside it reads "One per prompt. For a different take, use Another angle on its opportunity.", and the usage line and Generate say 1.existingId(already in the job result since PROMPT-006), the toast says "This prompt already has an opportunity" with Open existing, which opens that opportunity's panel (and?opportunity=in the URL, like a row click).en.json:content.newExisting,content.openExisting,content.newDialog.promptOne.The server already claims only the slots it writes, so no quota was ever lost; only the dialog's numbers and the dead end change.
Related issue
None. Reported by the product owner while testing Content Opportunities.
Type of change
fix— Bug fixHow to test
new-opportunities-dialog.test.tsx(new): the prompt focus sendscount: 1, and the count comes back.content/page.test.tsx: a finished run withexistingIdshows the toast, and its action opens the panel and sets?opportunity=.Checklist
help/content/content-opportunities.mdis added on docs(help): add the Ansvisor Help knowledge base and its first 56 articles #1792.Checks on this branch (5276032): web lint 0 errors (7 warnings, none in these files), typecheck OK, 631 test files / 6,249 tests passed.
yarn buildfails on main's own break, unrelated to this change; #1796 fixes it.🤖 Generated with Claude Code