Skip to content

use ActionCtx versions of runQuery/runMutation for compatibility#277

Open
ianmacartney wants to merge 3 commits into
mainfrom
ian/action-ctx-compat
Open

use ActionCtx versions of runQuery/runMutation for compatibility#277
ianmacartney wants to merge 3 commits into
mainfrom
ian/action-ctx-compat

Conversation

@ianmacartney
Copy link
Copy Markdown
Member

@ianmacartney ianmacartney commented Jun 2, 2026

In the future the ctx.runQuery of a QueryCtx / MutationCtx may differ from ActionCtx by adding extra options (e.g. snapshot query, transaction limits). For now, the ActonCtx is the more generic version, so if the function accepts that, the user can pass any of QueryCtx/MutationCtx/ActionCtx and it should work.

This is only really an issue for Workflow, where it presents as a ctx that has ActionCtx-like runQuery/runMutation/runAction, but does not have auth/storage, so doesn't match the ActionCtx here.

This change allows workflow's step (ctx) to be passed to agent functions. A follow-up (#279) could explicitly handle WorkflowCtx and pass { inline: true } for various places where it makes sense, to explicitly optimize for workflows

Copy link
Copy Markdown
Member Author

ianmacartney commented Jun 2, 2026

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/agent@277

commit: db307b1

@ianmacartney ianmacartney marked this pull request as ready for review June 2, 2026 01:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR performs a systematic migration of embedding model naming across the example agent code and updates infrastructure dependencies. The core change renames textEmbeddingModel to embeddingModel in the model export layer, agent configuration, RAG setups, and tool implementations. Additionally, client-side context types are refactored to derive from GenericActionCtx instead of query/mutation-specific context types. Development dependencies for Convex packages are bumped to newer versions.

Possibly related PRs

  • get-convex/agent#216: Adds embeddingModel support and deprecates textEmbeddingModel in the AI SDK, which is the foundational change that this PR's example code updates align with.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: updating to use ActionCtx versions of runQuery/runMutation for compatibility purposes.
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.
Description check ✅ Passed The pull request description accurately explains the rationale and scope of changes, including the motivation for using ActionCtx and the impact on Workflow compatibility.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ian/action-ctx-compat

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.

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