Skip to content

feat(journeys): AI chat journey editor#8869

Draft
edmonday wants to merge 10 commits intomainfrom
26-03-CC-feat-ai-chat-journey-editor
Draft

feat(journeys): AI chat journey editor#8869
edmonday wants to merge 10 commits intomainfrom
26-03-CC-feat-ai-chat-journey-editor

Conversation

@edmonday
Copy link
Contributor

Summary

  • New journeyAiEdit GraphQL mutation — calls Gemini 2.5 Flash with a discriminated union schema, returning either a proposed journey update or a text-only suggestion
  • New AI editor page at /journeys/[id]/ai — chat-first interface separate from the complex visual editor
  • AiEditorFlowMap — SVG flow graph of all cards with click-to-select and AI highlight states (loading pulse, proposal badge)
  • AiEditorCardPreview — renders selected card in a phone-frame mockup
  • AiChat — useReducer state machine managing messages, generationId staleness checks, and apply/dismiss lifecycle
  • Entry points added: "Edit with AI" in journey card menu, "Switch to AI Editor" icon button in editor toolbar

Key decisions

  • Mutation not subscription — single generateObject() call is sufficient for preview-then-confirm UX; no WebSocket races
  • generationId — each send increments the generation counter; old proposals automatically become stale and hide the Apply button
  • No EditorProvider — the AI editor manages its own simpler state; no coupling to the visual editor's complex state
  • JourneySimple lazy-loaded — flow map/preview populate after first apply (backend always has full context via getSimpleJourney); no need for a new journeySimpleGet query

Testing

  • Build passes: pnpm nx build api-journeys-modern (pre-existing errors are unrelated Prisma codegen issues)
  • TypeScript: no new errors in journeyAiEdit/ or AiEditor/ files
  • Manual verification checklist per plan: navigate to /journeys/[id]/ai, type a message, verify loading indicator and proposal card, click Apply

Post-Deploy Monitoring & Validation

  • What to monitor/search
    • Logs: journeyAiEdit audit — emitted on every mutation call with userId, journeyId, hadProposal
    • Logs: journeyAiEdit: NoObjectGeneratedError / journeyAiEdit: generateObject error for AI failures
    • Metrics: Gemini API latency and error rate
  • Validation checks
    • grep "journeyAiEdit audit" <log-stream> — should appear on every chat send
    • grep "NoObjectGeneratedError" <log-stream> — should be rare
  • Expected healthy behavior
    • Audit log emitted per message, hadProposal: true for edit requests, hadProposal: false for question-only responses
    • p95 latency under 15s (Gemini 2.5 Flash with 30s timeout)
  • Failure signal / rollback trigger
    • Sustained NoObjectGeneratedError rate > 10%: check Gemini model ID / API key
    • journeyAiEdit mutation returning errors: roll back schema.ts import registration
  • Validation window & owner
    • Window: 24h post-deploy
    • Owner: on-call

Before / After Screenshots

No UI screenshots — this is a new page at /journeys/[id]/ai; existing pages are unchanged except for new menu item and toolbar icon.


Compound Engineering v2.42.0
🤖 Generated with Claude Sonnet 4.6 (200K context) via Claude Code

New dedicated AI editor at /journeys/[id]/ai with chat interface for
plain-language journey editing. Backend journeyAiEdit mutation uses
Gemini 2.5 Flash with discriminated union schema to return either a
proposed journey update or a text-only suggestion.

Frontend includes AiChat panel, AiEditorFlowMap for card navigation,
AiEditorCardPreview, and entry points in the journey card menu and
editor toolbar.

🤖 Generated with Claude Sonnet 4.6 via Claude Code (https://claude.com/claude-code) + Compound Engineering v2.42.0

Co-Authored-By: Claude Sonnet 4.6 (200K context) <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3221fd2f-dcd5-47b0-b67b-3c206a63f1ff

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 26-03-CC-feat-ai-chat-journey-editor
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Fails
🚫 Please ensure your PR title matches commitlint convention.
🚫 Please assign someone to merge this PR.
🚫 Please request a reviewer for this PR.
Warnings
⚠️ ❗ Big PR (1993 changes)

(change count - 1993): Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review.

(pr title - feat(journeys): AI chat journey editor):

subject must not be sentence-case, start-case, pascal-case, upper-case

Generated by 🚫 dangerJS against bf44197

@nx-cloud
Copy link

nx-cloud bot commented Mar 17, 2026

View your CI Pipeline Execution ↗ for commit bf44197

Command Status Duration Result
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 10s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 55s View ↗
nx run-many --target=vercel-alias --projects=watch ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=re... ✅ Succeeded 2s View ↗
nx run-many --target=deploy --projects=watch ✅ Succeeded 2m 3s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 6s View ↗
Additional runs (16) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-03-18 02:24:14 UTC

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 17, 2026 23:34 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Wed Mar 18 15:23:38 NZDT 2026

Run api-journeys-modern:generate-graphql to export JourneyAiEditInput,
JourneyAiEditResult, and journeyAiEdit mutation to the subgraph schema.
Run api-gateway:generate-graphql to compose updated supergraph schema.
Run journeys-admin:codegen to generate TypeScript types for the new
mutation and query.

Co-Authored-By: Claude Sonnet 4.6 (200K context) <noreply@anthropic.com>
@github-actions github-actions bot temporarily deployed to Preview - watch March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 18, 2026 00:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 18, 2026 00:11 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
short-links ✅ Ready short-links preview Wed Mar 18 15:22:20 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
player ✅ Ready player preview Wed Mar 18 15:20:56 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Wed Mar 18 15:21:19 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Wed Mar 18 15:22:20 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Wed Mar 18 15:22:45 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Wed Mar 18 15:22:36 NZDT 2026

edmonday and others added 6 commits March 18, 2026 00:19
… add journey load on mount

- AiEditorCardPreview now uses useJourney() + transformer() + FramePortal + BlockRenderer
  to render actual card content instead of simplified HTML representation
- AiEditorFlowMap rewritten to use React Flow for the journey flow map
- ai.tsx loads JourneySimple on mount via journeySimpleGet query so the flow map
  is visible immediately without needing to interact with AI first
- Added JourneyProvider wrapper around preview area with useJourneyQuery (full blocks)
  so card preview can render real block content
- Refetch full journey after AI changes are applied

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot temporarily deployed to Preview - journeys March 18, 2026 02:10 Inactive
@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 18, 2026 02:10 Pending
@github-actions github-actions bot temporarily deployed to Preview - watch March 18, 2026 02:10 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 18, 2026 02:10 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 18, 2026 02:10 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 18, 2026 02:10 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 18, 2026 02:10 Inactive
@github-actions github-actions bot requested a deployment to Preview - videos-admin March 18, 2026 02:15 Pending
@github-actions github-actions bot requested a deployment to Preview - journeys March 18, 2026 02:15 Pending
@github-actions github-actions bot requested a deployment to Preview - watch-modern March 18, 2026 02:15 Pending
@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 18, 2026 02:15 Pending
@github-actions github-actions bot requested a deployment to Preview - short-links March 18, 2026 02:15 Pending
@github-actions github-actions bot requested a deployment to Preview - resources March 18, 2026 02:15 Pending
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch-modern March 18, 2026 02:19 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 18, 2026 02:19 Inactive
@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch-modern ✅ Ready watch-modern preview Wed Mar 18 15:20:55 NZDT 2026

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