Expose concurrencyKey in task run context
- Schemas: add optional concurrencyKey to TaskRun and V3TaskRun types
- Engine: include concurrencyKey in run context building
- Services: pass concurrencyKey in execution payload as part of run object
- Presenters/Routes: include concurrencyKey in run context returned to UI
- Tests: verify concurrencyKey is exposed as ctx.run.concurrencyKey
- Docs: document concurrencyKey in docs/context.mdx
- Add changeset
- No concurrency behavior changes
Closes #2250
✅ Checklist
- ✅ I have followed every step in the contributing guide
- ✅ The PR title follows the convention.
- ✅ I ran and tested the code works
Testing
- Manual: Using references/v3-catalog, triggered a task with a concurrencyKey and verified logs for
params.ctx.run.concurrencyKey. - UI: In Run details > Context, confirmed the key appears under
run.concurrencyKey(inside the context.run object). - Unit: Added a test in
packages/core/test/taskExecutor.test.tsassertingparams.ctx.run.concurrencyKeyis passed through. - Docs: Ran the docs locally and verified the Context page renders the new
concurrencyKeyfield under the run object as documented.
Changelog
Expose concurrencyKey on task run context (ctx.run.concurrencyKey)
Screenshots
N/A
🦋 Changeset detected
Latest commit: 024e09760d9f3f82fcf50b5c4ffc6b4b967d1f60
The changes in this PR will be included in the next version bump.
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
Walkthrough
Adds an optional concurrencyKey?: string field across schemas, runtime contexts, payloads, docs, and tests. packages/core Zod schemas (TaskRun, V3TaskRun) gain concurrencyKey. run-engine resolves and propagates run.concurrencyKey into TaskRunContext and execution payloads (initial and after start). Webapp layers surface concurrencyKey in payloads (SpanPresenter moves it as a top-level run field; loaders, shared queue consumer, and createTaskRunAttempt include it on execution.run). docs/context.mdx documents context.run.concurrencyKey. A unit test ensures TaskExecutor exposes concurrencyKey in task ctx.
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
[!TIP]
🔌 Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@omkardongre this looks great! But I think it doesn't make sense as a top level property on ctx, instead it should go on ctx.run.concurrencyKey
@omkardongre this looks great! But I think it doesn't make sense as a top level property on ctx, instead it should go on ctx.run.concurrencyKey
Thanks for the feedback, I will update it accordingly
@ericallam Moved concurrencyKey to ctx.run.concurrencyKey Verified locally (logs + Run details > Context) and tests pass.