Skip to content

feat(geo): conversation sequences — multi-turn prompt tracking - #666

Open
mezotv wants to merge 1 commit into
feat/geo-ai-visibilityfrom
feat/geo-sequences
Open

feat(geo): conversation sequences — multi-turn prompt tracking#666
mezotv wants to merge 1 commit into
feat/geo-ai-visibilityfrom
feat/geo-sequences

Conversation

@mezotv

@mezotv mezotv commented Aug 10, 2026

Copy link
Copy Markdown
Member

Stacked on #657. Splits the conversation-sequences feature out of the main GEO PR into its own reviewable unit.

What's here (app layer):

  • ConversationsCard + builder/results dialogs on the GEO prompts page
  • lib/geo/sequences.ts (CRUD + results loading) and utils/geo-sequences.ts
  • geo.sequences* oRPC procedures, Zod schemas, hooks, error mapping
  • Scan-engine integration: enabled sequences run as multi-turn grounded conversations during each GEO scan, judged per turn

Deliberately left in the base PR (#657): the geo_prompt_sequences table (migration 0063 is already applied to staging/preview DBs — re-splitting applied migrations is not worth the risk) and the geoSequenceResults Tinybird pipe (deploys are declarative and additive).

Merge order: #657 first, then this.


Summary by cubic

Adds conversation sequences to GEO so teams can create, edit, enable, and track multi-turn buyer conversations, then view per-turn engine results. Sequences run during scans as grounded chats, with brand checks at each turn.

  • New Features
    • UI: ConversationsCard with builder and results dialogs on the GEO prompts page.
    • API & Hooks: CRUD and results via geo.sequences* oRPC procedures, Zod schemas, React hooks, and error mapping.
    • Scan Engine: Executes enabled sequences across grounded engines; judges each turn and ingests results.
    • Validation & Limits: GEO_MAX_SEQUENCES and GEO_SEQUENCE_MAX_TURNS enforced, plus prompt length checks and turn grouping utility.

Written for commit 97321fb. Summary will update on new commits.

Review in cubic

@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@comp-ai-code-review

comp-ai-code-review Bot commented Aug 10, 2026

Copy link
Copy Markdown

Comp AI code review failed. Comment /review to retry.

Image not found.

Commit 97321fb · Posted by Comp AI Code Reviews.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
notra Ready Ready Preview Aug 10, 2026 6:02pm
notra-agent Ready Ready Preview Aug 10, 2026 6:02pm
notra-console Ready Ready Preview Aug 10, 2026 6:02pm
notra-onboarding-agent Ready Ready Preview Aug 10, 2026 6:02pm
notra-web Ready Ready Preview Aug 10, 2026 6:02pm

Request Review

@github-actions

Copy link
Copy Markdown

React Doctor found 3 new issues in 2 files · 3 warnings · score 90 / 100 (Great) · 0 fixed · vs feat/geo-ai-visibility

3 warnings

src/components/geo/conversation-builder-dialog.tsx

  • ⚠️ L40 Chained array iterations js-combine-iterations
  • ⚠️ L99 Array index used as a key no-array-index-as-key

src/components/geo/conversation-results-dialog.tsx

  • ⚠️ L52 Manual memoization in compiler-managed code react-compiler-no-manual-memoization

Reviewed by React Doctor for commit 97321fb. See inline comments for fixes.

);

const pending = create.isPending || update.isPending;
const validSteps = steps

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

React Doctor · react-doctor/js-combine-iterations (warning)

This loops over your list twice because .map().filter() makes two passes, so do it in one pass with .reduce() or a for...of loop

Fix → Combine .map().filter() style chains into one pass with .reduce() or a for...of loop, so you only loop over the list once

Docs

{steps.map((step, index) => (
<div
className="flex items-start gap-2"
key={`turn-${index.toString()}`}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

React Doctor · react-doctor/no-array-index-as-key (warning)

Your users can see & submit the wrong data when this list reorders or filters, so use a stable id like key={item.id}, not the array index "index".

Fix → Use a stable id from the item, like key={item.id} or key={item.slug}. Index keys break when the list reorders or filters.

Docs

open ? sequence?.id : undefined
);

const turns = useMemo(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

React Doctor · react-doctor/react-compiler-no-manual-memoization (warning)

React Compiler can cache this value automatically. Verify that removing useMemo preserves behavior before simplifying it.

Fix → Profile compiler-managed code and remove useMemo, useCallback, or memo only when the manual cache no longer carries behavioral or performance intent.

Docs

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds project-level multi-turn GEO conversations, including CRUD dialogs, typed oRPC APIs, results grouping, and execution during grounded scans.

  • Adds conversation creation, editing, enablement, deletion, and result-viewing UI.
  • Adds sequence schemas, types, hooks, error mapping, persistence helpers, and Tinybird result loading.
  • Runs enabled sequences as ordered conversations across grounded engines and judges each turn for brand visibility.

Confidence Score: 3/5

The PR should not merge until sequence mutations enforce project scope and the enabled-sequence cap can no longer silently omit conversations from scans.

Update and delete can affect a sequence in another project within the same organization, and projects with more than ten enabled sequences show conversations as active even though the scan permanently skips the newer entries.

Files Needing Attention: apps/dashboard/src/lib/geo/sequences.ts, apps/dashboard/src/lib/geo/scan.ts

Important Files Changed

Filename Overview
apps/dashboard/src/lib/geo/sequences.ts Adds sequence CRUD and result loading, but update and delete fail to constrain mutations to the selected project.
apps/dashboard/src/lib/geo/scan.ts Adds multi-turn sequence execution, but silently truncates enabled sequences to the oldest ten without enforcing that limit elsewhere.
apps/dashboard/src/lib/orpc/routers/geo.ts Exposes the new sequence operations through authenticated GEO procedures with organization-level authorization.
apps/dashboard/src/components/geo/conversations-card.tsx Adds sequence management and results entry points, while displaying sequences beyond the scan cap as enabled.
apps/dashboard/src/components/geo/conversation-builder-dialog.tsx Adds validated creation and editing for names and up to five conversation turns.
apps/dashboard/src/components/geo/conversation-results-dialog.tsx Adds a grouped per-turn, per-engine results view with loading and empty states.
apps/dashboard/src/schemas/geo.ts Adds bounded create, update, delete, and results input schemas for sequences.

Sequence Diagram

sequenceDiagram
  participant User
  participant UI as Conversations UI
  participant RPC as GEO oRPC
  participant DB as Postgres
  participant Scan as GEO Scan
  participant Engine as Grounded Engine
  participant Judge as Brand Judge
  participant TB as Tinybird

  User->>UI: Create or enable sequence
  UI->>RPC: Sequence mutation
  RPC->>DB: Persist project sequence
  Scan->>DB: Load enabled sequences
  loop Each sequence and engine
    loop Each conversation turn
      Scan->>Engine: Send conversation history
      Engine-->>Scan: Grounded answer
      Scan->>Judge: Judge brand visibility
      Judge-->>Scan: Mention result
    end
  end
  Scan->>TB: Ingest per-turn results
  UI->>RPC: Load sequence results
  RPC->>TB: Query by project and sequence
  TB-->>UI: Grouped turn results
Loading

Reviews (1): Last reviewed commit: "feat(geo): conversation sequences — mult..." | Re-trigger Greptile

Comment on lines +92 to +96
eq(geoPromptSequences.organizationId, input.organizationId)
)
)
.returning()
);

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.

P1 Sequence mutations bypass project scope

When an update or delete request supplies the ID of a sequence from another project in the same organization, the predicate checks only sequenceId and organizationId, so it modifies or deletes that other project's conversation despite the request's selected projectId.

Knowledge Base Used: Dashboard App Core Structure

Comment on lines +380 to +381
orderBy: [asc(geoPromptSequences.createdAt)],
limit: GEO_MAX_SEQUENCES,

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.

P1 Scan silently truncates enabled sequences

When a project has more than ten enabled sequences, creation and listing still present every sequence as enabled, but this oldest-first limit excludes the eleventh and later entries from every scan, causing those conversations to receive no results.

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