Skip to content

fix(create): preserve page context in events chat - #550

Merged
tannerlinsley merged 2 commits into
mainfrom
taren/factory-events-forwarded-context
Nov 3, 2026
Merged

tannerlinsley merged 2 commits into
mainfrom
taren/factory-events-forwarded-context

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Preserve the current speaker and talk when Remy sends them through the AI client's forwardedProps. Keep legacy top-level values working, including mixed payloads where only one slug is nested.

AI review notes:
Each slug is resolved independently, with valid nested values taking priority. Non-string values are ignored, and thread validation stays intact.
Eight route regression cases pass. The previous revision fails the two new mixed-payload cases.
All 10 package builds, 541 unit tests and eight Chrome e2e tests passed through the normal commit hook.
A generated events app outside the monorepo passed production build and type checking with this asset overlaid. The actual published AI client transport was exercised against the route with provider calls stubbed and networking disabled.
No dependencies, workflows or CLI startup imports change. Includes a patch changeset for @tanstack/create.

Summary by CodeRabbit

  • Bug Fixes
    • The events example chat now retains speaker and talk-page context when generating responses, helping keep replies relevant to the page being viewed.
    • Existing chat payloads that provide context in the top-level fields remain supported, and forwarded context takes precedence when both formats are present.
    • Invalid or missing page context is ignored, and requests with an empty thread ID are rejected without starting a chat.

@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bb8683f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@tanstack/create Patch
create-start-app Patch
create-tanstack-app Patch
create-tanstack Patch
create-tsrouter-app Patch
@tanstack/create-start Patch
@tanstack/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The events chat route now reads speaker and talk context from forwarded properties when available, with a top-level request-body fallback. Added tests cover context selection and missing-thread responses.

Changes: Events chat context

Layer / File(s) Summary
Select and validate chat context
packages/create/src/frameworks/react/examples/events/assets/src/routes/api.remy-chat.ts, packages/create/tests/events-chat-context.test.ts, .changeset/events-forwarded-context.md
The route selects string context values from forwardedProps when they are present, otherwise from top-level string values. Tests cover precedence, fallback, absent or non-string values, and missing-thread responses. A patch changeset records the change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • TanStack/cli#446: This PR uses the same chat handler’s thread ID validation contract and tests the empty-thread response.
Merge Risk: Minimal · up to bb868

Context forwarding is covered without an identified current-head regression; the change is ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving page context in the events chat.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/create/tests/events-chat-context.test.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/create/tests/events-chat-context.test.ts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 88f1a97c-3ebc-480e-8c35-7e12d135483f
Commits

Reviewing files that changed from the base of the PR and between ee1b20b and bb8683f.

Files selected for processing: 2
  • packages/create/src/frameworks/react/examples/events/assets/src/routes/api.remy-chat.ts
  • packages/create/tests/events-chat-context.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Additional comments: 1
packages/create/src/frameworks/react/examples/events/assets/src/routes/api.remy-chat.ts-31-34: 1

31-34: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Apply the body fallback to each slug.

If forwardedProps contains speakerSlug but the request body contains talkSlug, this selection discards the top-level talkSlug. The session context then disappears from the prompt. Select each slug from forwardedProps when present, and otherwise select that slug from body. Add a mixed-payload test. (raw.githubusercontent.com)

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 26215607-cc17-4975-9aa4-e22411489c9a
Commits

Reviewing files that changed from the base of the PR and between 270f9b0 and ee1b20b.

Files selected for processing: 3
  • .changeset/events-forwarded-context.md
  • packages/create/src/frameworks/react/examples/events/assets/src/routes/api.remy-chat.ts
  • packages/create/tests/events-chat-context.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@tannerlinsley
tannerlinsley marked this pull request as draft November 3, 2026 14:40
@tannerlinsley

Copy link
Copy Markdown
Member Author

Confirmed the mixed-payload gap. I’m keeping this as a draft until the corrected revision finishes its normal checks.

AI review notes:
The local revision falls back per slug, so a nested speaker and top-level talk, or the reverse, both retain context. The two new cases fail against the current PR head and pass with the revision.
All eight route cases and the generated app’s build/types passed. The unchanged full repository hook is still running; the corrected revision has not been pushed yet.

@tannerlinsley
tannerlinsley marked this pull request as ready for review November 3, 2026 15:26
@tannerlinsley

Copy link
Copy Markdown
Member Author

The mixed-payload case is fixed too, and this is ready for the normal checks.

AI review notes:
Revision bb8683f resolves each slug independently. Both mixed directions now have regression coverage, and both fail on the previous revision.
All 10 builds, 541 unit tests and eight Chrome e2e tests passed through the normal hook. The generated events app also passed production build and type checking with the corrected asset overlaid, offline with no provider calls.

@tannerlinsley
tannerlinsley merged commit 517c9ef into main Nov 3, 2026
7 checks passed
@tannerlinsley
tannerlinsley deleted the taren/factory-events-forwarded-context branch November 3, 2026 15:35
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
@tannerlinsley

Copy link
Copy Markdown
Member Author

The code has landed, but release verification isn’t complete yet.

AI review notes:
Version PR #551 merged at 58dc7ae. The normal publisher reported success, and six expected archives passed downloaded hash checks.
Fresh official metadata and the tarball URL still return 404 for @tanstack/create 0.71.14. The published CLI and aliases depend on that version, so fresh installation may fail until it is available. A fresh consumer has not been verified.
One retry of the unchanged normal release workflow is running: https://github.com/TanStack/cli/actions/runs/41673768768. Full archive, tag and public-consumer verification remains open.

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