Skip to content

Add interview-first sparkle-pills chat chaining and deterministic plan response - #2431

Open
groupthinking with Codex wants to merge 6 commits into
mainfrom
codex/agent-login-system
Open

groupthinking with Codex wants to merge 6 commits into
mainfrom
codex/agent-login-system

Conversation

@Codex

@Codex Codex AI commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Canonical issue

Linked by system automation.

Outcome

This PR adds an interview-first path for “sparkle pills” requests so the system asks clarifying questions before proposing a workflow. When required answers are provided on the unbound API path, it returns a deterministic, action-oriented plan without invoking model providers. Current Studio clients send a Video Pack binding, so they remain on grounded chat and cannot reach that planner. The full product flow is still under review.

Scope

  • Included:
  • Sparkle intent gate: detects sparkle-pill requests in chat input and routes them through a dedicated chaining contract.
  • Interview-first response: returns requiresInterview: true plus targeted clarifying questions when required fields are missing.
  • Deterministic plan response: returns provider: "sparkle-pills-planner" and a structured operational plan once interview fields are complete.
  • Contract documentation: adds CHAINING.md with request/response schema and runtime behavior.
  • Focused API coverage: adds tests for both interview-first and completed-interview plan paths.
  • Example snippet:
{
  "query": "Build me a system for using sparkle pills",
  "sparkleInterview": {
    "useCase": "Manage weekday focus sessions",
    "trigger": "Start each weekday at 08:30",
    "tools": ["Google Calendar", "Slack"],
    "constraints": "No notifications after 21:00",
    "successSignal": "5 sessions completed per week"
  }
}
  • Explicitly excluded:
  • Changes to non-sparkle chat routing behavior.
  • Any new external integrations, deployment workflows, or dependency updates.

Risk

  • Risk level: medium while the pack-bound Studio flow remains incomplete
  • Failure mode:
    Sparkle detection could match unintended prompts. The current pack-bound Studio flow does not reach the deterministic planner, and a plan without Video Pack grounding would not meet the product contract.
  • Rollback:
    Revert the sparkle branch in apps/web/src/app/api/chat/route.ts and remove apps/web/src/lib/sparkle-pills.ts.

Verification

Head SHA: 35cff33a416af0eb1351f50dc4d7e550a6a1a88e (includes current main to restore the security scan input).

  • npm@10.8.0 ci --ignore-scripts, focused route and Studio interview tests (7 passed), ESLint on changed files, type check, web production build, and git diff --check passed.
  • Required CI on this head: 28 passed, 3 skipped, 0 failed. The refreshed Trivy scan passed.
  • Review threads resolved: three remain open; the first-turn answer finding is resolved.
  • End-to-end pack-bound planning and source/use-case decision.

Production evidence

No live production Studio end-to-end proof. The deterministic planner is currently reachable only for API requests without a Video Pack binding; current Studio clients send a binding.

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval

Security dependency evidence

  • Advisory: Not applicable (no advisory-driven dependency change)
  • Package and versions: Not applicable
  • Validation: Not applicable
  • Rollback: Not applicable

@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Oct 28, 2026 11:05am UTC

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
@Codex Codex AI changed the title [WIP] Build a system for using sparkle pills Add interview-first sparkle-pills chat chaining and deterministic plan response Oct 15, 2026
@Codex
Codex AI requested a review from groupthinking October 15, 2026 07:04
@Codex Codex AI linked an issue Oct 15, 2026 that may be closed by this pull request
1 task done
@groupthinking
groupthinking marked this pull request as ready for review October 15, 2026 08:37
Copilot AI balanced review requested due to automatic review settings October 15, 2026 08:37
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🔍 PR Validation

⚠️ PR title should follow conventional commits format
⚠️ Large PR detected (874 lines changed)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Client integration is incomplete, planning ignores video grounding, and required tools can be silently discarded.

3 open findings
What changed in this PR

Adds an interview-first sparkle-pills branch to UVAI’s chat API, returning a deterministic plan without model calls once required answers are supplied.

Changes:

  • Detect sparkle intent and request interview answers.
  • Generate plans from completed interviews.
  • Document the API contract and add focused route tests.
File Description
CHAINING.md Documents interview and plan payloads.
apps/​web/​src/​lib/​sparkle-pills.ts Implements detection, answer parsing, and planning.
apps/​web/​src/​app/​api/​chat/​route.ts Routes sparkle requests to the new handler.
apps/​web/​src/​app/​api/​__tests__/​chat-sparkle-pills-route.test.ts Covers interview and completed-plan responses.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/web/src/app/api/chat/route.ts Outdated
Comment on lines +140 to +143
const sparkleResponse = resolveSparklePillsResponse({
query: typeof query === 'string' ? query : String(query),
sparkleInterview: body.sparkleInterview,
});
Comment thread apps/web/src/app/api/chat/route.ts Outdated
Comment on lines +144 to +145
if (sparkleResponse) {
return NextResponse.json(sparkleResponse);
Comment thread apps/web/src/lib/sparkle-pills.ts Outdated

@groupthinking groupthinking left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at head fc4d7047: the three unresolved inline findings are substantive. The planner bypasses verified Video Pack grounding, the existing chat clients do not render or continue the interview, and the parser silently drops tools after the eighth. Please preserve pack-bound behavior, make the full two-turn flow usable, and reject or retain oversized inputs explicitly with tests.

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
@Codex

Codex AI commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Review at head fc4d7047: the three unresolved inline findings are substantive. The planner bypasses verified Video Pack grounding, the existing chat clients do not render or continue the interview, ...

Implemented in 78360bd: pack-bound requests now stay on canonical grounded chat (including fail-closed missing-pack behavior), both Studio and hosted chat now render and continue the sparkle interview with sparkleIntent + sparkleInterview on follow-up turns, and oversized tool lists are retained (no silent truncation). Added focused route/parser/client tests for these paths.

: [];
const query = body.query || body.message || '';

if (!packBinding) {

@vercel vercel Bot Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if (!packBinding) guard in POST /api/chat makes the sparkle-pills interview-first flow unreachable from every production client, since all three clients always send a video_id that yields a non-null pack binding — leaving the sparkle interview UI in StudioIdeChat.tsx and emit-app-builder-sandbox.ts dead in production.

Fix on Vercel

Comment thread apps/web/src/components/studio/StudioIdeChat.tsx
@github-actions github-actions Bot added documentation Improvements or additions to documentation javascript Pull requests that update javascript code tests labels Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 16
Failed
Deployment https://v0-uvai-layv7ew24-garv1.vercel.app
Test Output
every request without persisting it�[32m 1�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mhomepage returns 200 with HTML�[32m 294�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mfeatures page contains template/workflow markup�[32m 270�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mfeatures page surfaces at least 5 workflow/template indicators�[33m 301�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mVideo Pack Pipeline�[2m > �[22mPOST /api/video/pack accepts a YouTube URL without hanging�[33m 2096�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mVideo Pack Pipeline�[2m > �[22mGET /api/video/pack resolves to a ready pack with evidence lineage�[33m 870�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 184�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns 400 quickly, not a hang�[32m 180�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mPOST /api/video/pack with no body returns 400�[32m 173�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[32m 264�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[32m 200�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[33m 377�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mretired /api/pipeline routes are gone (no pipeline served)�[32m 89�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 291�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 195�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m16 passed�[39m�[22m�[90m (16)�[39m
�[2m   Start at �[22m 10:59:08
�[2m   Duration �[22m 7.68s�[2m (transform 55ms, setup 0ms, import 70ms, tests 7.47s, environment 0ms)�[22m


@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 16
Failed
Deployment https://v0-uvai-jtdbrkczp-garv1.vercel.app
Test Output
n every request without persisting it�[32m 1�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mhomepage returns 200 with HTML�[32m 184�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mfeatures page contains template/workflow markup�[32m 192�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mTemplate Gallery�[2m > �[22mfeatures page surfaces at least 5 workflow/template indicators�[32m 156�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mVideo Pack Pipeline�[2m > �[22mPOST /api/video/pack accepts a YouTube URL without hanging�[33m 2067�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mVideo Pack Pipeline�[2m > �[22mGET /api/video/pack resolves to a ready pack with evidence lineage�[33m 852�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 109�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns 400 quickly, not a hang�[32m 92�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mPOST /api/video/pack with no body returns 400�[32m 93�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[32m 198�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[32m 128�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[32m 296�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mretired /api/pipeline routes are gone (no pipeline served)�[32m 58�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 106�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 125�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m16 passed�[39m�[22m�[90m (16)�[39m
�[2m   Start at �[22m 11:05:43
�[2m   Duration �[22m 6.42s�[2m (transform 53ms, setup 0ms, import 68ms, tests 6.23s, environment 0ms)�[22m


@groupthinking groupthinking left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at exact head 35cff33a416af0eb1351f50dc4d7e550a6a1a88e: the canonical issue #2428 links the GitHub Next Sparkle Pills article, whose core behavior is filling *(...) template slots while deterministic code preserves the surrounding text verbatim. This PR instead asks for automation triggers and tools, then returns an intake -> validate -> run actions workflow plan. Its API and tests do not take a template, parse or fill slots, validate slot values, or prove literal text is preserved. The Studio chat remains pack-bound and does not reach this planner. Please align the interview and implementation with the article and the user-selected template use case, including tests for unchanged literal text and missing or invalid slot values. The specific use case is still pending from Hayden, so do not substitute a guessed example as the product requirement. The current passing CI verifies the alternate workflow behavior; this PR remains changes requested and should stay open.

This branch was successfully deployed

1 active deployment
Preview — 35cff33a Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation javascript Pull requests that update javascript code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Agent]

3 participants