Standard quotes now ask all missing inputs together
Dealops 2 conversational standard quoting no longer stops at the first gate; it assumes safe stand-ins, surfaces pricebook choice as a structured question, and returns one de-duplicated question list.
What it fixes
Standard quoting used to ask in stages: pricebook first, then contract dates, then line quantity/price, then terms. This PR returns the full actionable set in one reply.
Core behavior
prepareStandardQuote now runs selection and assembly on partial input using stand-ins, while deferring checks that would make stand-in dates look real.
Pricebook model
Pricebook is no longer a hard gate. The pipeline assumes a default or only-fitting pricebook when safe, or emits a structured kind: 'pricebook' required input.
Review signal
Tests expand from 228 to 234 passing in the targeted suites, plus new coverage for merged questions, pricebook answers, and partial-pipeline pricing.
Pricebook resolution
Standard quote pipeline
Required input answers
Conversation agent
Tests / knowledge
1. Why this exists
Before: gated turns
conversationStepreturnedpricebook_neededbefore quote preparation ran.prepareStandardQuoteexited when start date, duration, or currency was missing.resolveQuotePricesskipped all pricing when any unrelated issue existed.
After: one pass, many questions
- The pipeline keeps running after non-fatal missing inputs.
- Pricebook choice joins the same
requiredInputslist as dates, quantities, prices, and terms. - Planner questions and structured pipeline questions are merged without repeats.
Intent from the PR description: this implements DEA-8379 plan section 5, “Ask everything at once,” for standard conversational quoting.
2. What changes
Pipeline shape
Resolve pricebook
Use requested, only entitled, default, or only-fitting book; otherwise add a pricebook question.
Apply answers
Validate draft and editable term answers regardless of missing contract fields.
Selection + assembly
Run with stand-in start, term, and currency so line-level questions can be found.
Pricing
Run partial pricing only when currency is settled and periods are safe; skip lines with their own issues.
Date-sensitive validation
Wait for complete contract before period, structure, engine, and schema checks.
Pricebook decision table
| Situation | Pipeline behavior | Rep-facing result |
|---|---|---|
| Rep named an entitled pricebook | Use it directly. | No assumption banner; quote can become ready. |
| Exactly one entitled pricebook | Use it without asking. | Matches existing gather behavior. |
| No named book; default offers everything | Use default and return assumedPricebook.reason = 'default'. |
Reply states the default book and says the rep can change it. |
| No named book; only one book fits requested products | Use that book and return reason = 'only_fit'. |
Reply states it is the only pricebook offering everything asked for. |
| Several fit, but default does not | Add pricebookId issue with selectable options; check other answers against a fitting working book. |
Pricebook appears as one structured question beside other missing inputs. |
| Named book is unavailable | Add an invalid pricebookId issue. |
Rep must choose again or clear if none are available. |
Meaningful files
apps/server/src/dealops2/standardQuoting/pipeline.ts
Main change: pricebook resolver, provisional contract assembly, partial pricing, and safer validation ordering.
apps/server/src/dealops2/standardQuoting/inputAnswers.ts
Adds support for
resolution.kind = 'pricebook' and returns applied pricebookId.
apps/server/src/dealops2/standardQuoting/selection.ts
Exports
termProductActions and ignores saved default rows that the working pricebook cannot offer.
apps/server/src/dealops2/standardQuoting/conversationStep.ts
Removes the old
pricebook_needed pre-gate and passes assumed pricebook text into replies/facts.
apps/server/src/dealops2/conversationAgent/interaction.ts
De-duplicates pending questions, preserving structured pipeline questions over planner text.
apps/server/src/dealops2/conversationAgent/graph.ts
Tracks whether a form answered pricebook this turn so form values beat model guesses.
3. How it works
A. Pricebook fit calculation
A pricebook “fits” if it offers every product the quote actually needs: explicitly named products, required selections, and products added by a chosen option or named-product dependency.
- Plain catalog defaults do not steer the pricebook.
- Saved default rows that the working pricebook lacks are dropped before dependency cleanup.
- Products no entitled pricebook offers get their own selection issue instead of forcing a pricebook.
B. Provisional contract
Missing start, duration, or currency no longer stops line assembly. The builder adds the missing-field issue, then uses safe stand-ins to expose quantity, price, and term questions.
StartEarliest known line/period date, else next month start.
TermConfigured term, else 12 months.
CurrencyConfigured default, else USD.
C. Partial pricing
Pricing can run with existing issues, but only to discover more questions. It skips lines with their own issues, discards priced values, and filters configuration-kind pricing issues.
D. Question merge
collectPendingQuestions normalizes question text and removes duplicates. If the planner and pipeline ask the same thing, the structured requiredInput wins.
Old control flow
if (pricebookMissing) return pricebook_needed;
if (!start || !duration || !currency) return needs_input;
if (issues.length) skipPricing();
return firstBatchOnly;
New control flow
pricebook = resolvePricebook(...); // may add issue
assembled = buildPricingQuoteInput(...standIns);
priced = resolveQuotePrices(...partialSafe);
return needs_input(allIssues) || ready(input);
Form answers and state
Pricebook answer lifecycle
QuoteInputResolutionadds{ kind: 'pricebook'; pricebookIds: string[] }.applyQuoteInputAnswersaccepts option value or label and returnspricebookId.answerStepwrites that ID into graph state and setsformPricebookAnswered.withoutModelFormValuesprevents the model’s draft/start/pricebook read from overwriting form-submitted values.
4. What it doesn’t change
Non-goals / preserved behavior
- The
QuoteRequiredInputpublic shape is unchanged. - Optional-assumption permission still cannot bypass required pricebook choices, opportunity confirmation, access checks, or hard configuration blockers.
- Unsupported opportunity type still stops early; the rest of the standard quote pipeline does not apply there.
- Pricing values from partial runs are not saved or dispatched; they are only used to discover missing price questions.
- Date-sensitive structure, period, engine, and schema validations still require a complete contract.
- No REST or client routing changes; this is server-side Dealops 2 conversation/standard-quoting behavior.
5. Tests, risks, rollback, open questions
New unit coverage
234
Passing targeted suites, up from 228 on main.
- Missing quantity, price, and start date returned together.
- Pricebook question appears beside configuration issues.
- Default assumption alone does not hide invalid named pricebooks.
- Stand-in start date creates no false conflicts.
Conversation coverage
interaction.test.ts: merged semantic + required-input questions without repeats.decisions.test.ts: form values beat model form reads.answerStep.test.ts: pricebook answer saves and stale pricebook clears.
External / e2e
Adds an external scenario where the rep names no pricebook and only one fitting catalog is assumed, then stated back in the reply.
Risks to review:
- Partial pricing safety. The PR catches and logs partial-pricing failures, then keeps already-found questions. Review whether warning volume is acceptable.
- Fit semantics. Pricebook choice depends on “needed product” classification. Pay close attention to catalog defaults, saved defaults, dependencies, and option-added products.
- Reply wording. Assumed pricebook text is intentionally word-for-word prompt input; changes affect rep trust and form behavior.
Not run locally: external e2e suites
quoteRuleElicitation and standardConversationQuote, plus the Pylon live eval against the ticket A baseline. Leave those to CI before merge.
Rollback shape
Reverting this PR restores the old staged-question behavior. The riskiest coupled pieces are pipeline.ts, inputAnswers.ts, conversationStep.ts, and graph/form handling for formPricebookAnswered; they should roll back together.