Skip to content

Conversation

omkardongre
Copy link

@omkardongre omkardongre commented Aug 14, 2025

  • 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.ts asserting params.ctx.run.concurrencyKey is passed through.
  • Docs: Ran the docs locally and verified the Context page renders the new concurrencyKey field under the run object as documented.

Changelog

Expose concurrencyKey on task run context (ctx.run.concurrencyKey)


Screenshots

N/A

Copy link

changeset-bot bot commented Aug 14, 2025

🦋 Changeset detected

Latest commit: 024e097

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

Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

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.

❤️ Share
🪧 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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in 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 ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts (1)

1697-1755: execution payload: concurrencyKey surfaced at the right level — fix remaining queue.concurrencyKey usages

I scanned the repo. No uses of execution.concurrencyKey were found, but there are lingering references to queue.concurrencyKey that must be updated.

Files to fix:

  • internal-packages/run-engine/src/run-queue/index.ts:54 — defines CONCURRENCY_KEY: "runqueue.concurrencyKey". Verify whether this string/key should be renamed or kept (it may be a message attribute and intentionally unchanged).
  • apps/webapp/app/routes/.../route.tsx:656 — UI uses run.queue.concurrencyKey. Update this to read the new location (e.g. run.execution.concurrencyKey or run.concurrencyKey depending on the run object shape).

Action: replace consumer accesses of run.queue.concurrencyKey with the new execution-level field and review the run-engine constant for whether the key name needs migration.

apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)

570-575: Confirm run payload shape — keep queue.concurrencyKey for now and add top-level concurrencyKey

Found consumers of queue.concurrencyKey in the repo, so removing it now would be breaking. Recommend adding/keeping a top-level concurrencyKey while leaving queue.concurrencyKey in place and migrating callers to prefer the top-level field.

Files to inspect/update:

  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (line ~656) — displays: Concurrency key: {run.queue.concurrencyKey ? run.queue.concurrencyKey : "–"}
  • internal-packages/run-engine/src/run-queue/index.ts (line 54) — defines CONCURRENCY_KEY: "runqueue.concurrencyKey"
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts (lines ~570-575) — already includes top-level concurrencyKey: concurrencyKey: run.concurrencyKey ?? undefined

Recommended, backward-compatible path:

  • Ensure presenters include a top-level concurrencyKey (if not already).
  • Keep queue.concurrencyKey in the payload for now.
  • Update UI/consumers to prefer run.concurrencyKey and fall back to run.queue.concurrencyKey. Example change:
    Concurrency key: {run.concurrencyKey ?? run.queue.concurrencyKey ?? "–"}
  • Deprecate and remove queue.concurrencyKey in a future release after consumers have migrated.
🧹 Nitpick comments (4)
apps/webapp/app/routes/resources.runs.$runParam.ts (2)

196-196: Normalize optional to undefined to match schema expectations

Elsewhere in this PR, concurrencyKey is emitted as string | undefined (not null). Align this context payload to avoid serializing null into the JSON string.

-    concurrencyKey: run.concurrencyKey,
+    concurrencyKey: run.concurrencyKey ?? undefined,

244-247: Optional: keep payloads consistent by avoiding nulls for optional fields

For consistency with other presenters/services in this PR, avoid returning null for optional fields in the loader payload. Use undefined when not set so downstream zod schemas/types don’t need to special-case null.

     queue: {
       name: run.queue,
       isCustomQueue: !run.queue.startsWith("task/"),
-      concurrencyKey: run.concurrencyKey,
+      concurrencyKey: run.concurrencyKey ?? undefined,
     },
packages/core/test/taskExecutor.test.ts (1)

1844-1862: Good coverage: verifies ctx.concurrencyKey passthrough

The test effectively asserts propagation into RunFn params. Small nit: you can simplify the call and avoid passing explicit undefined parameters.

-    const result = await executeTask(task, { test: "data" }, undefined, undefined);
+    const result = await executeTask(task, { test: "data" });

Optional follow-up: add a complementary test ensuring ctx.concurrencyKey is undefined when the execution payload omits it, to guard against regressions that might surface null instead of undefined.

Example test to add (outside this hunk):

test("ctx.concurrencyKey is undefined when not provided", async () => {
  let receivedConcurrencyKey: string | undefined;

  const task = {
    id: "test-task",
    fns: {
      run: async (_: any, params: RunFnParams<any>) => {
        receivedConcurrencyKey = params.ctx.concurrencyKey;
        return { ok: true };
      },
    },
  };

  const result = await executeTask(task, {});
  expect(result.result.ok).toBe(true);
  expect(receivedConcurrencyKey).toBeUndefined();
});
packages/core/src/v3/schemas/common.ts (1)

331-341: TaskRunExecution: concurrencyKey addition looks correct and backward-compatible

Adding concurrencyKey as an optional top-level string aligns with the PR objective and preserves backward compatibility (still using passthrough on attempt/task).

If helpful, consider documenting the field’s semantics (e.g., “Set when a run was triggered with a concurrencyKey; undefined otherwise”) as a code comment to aid SDK consumers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f767654 and 0172cca.

📒 Files selected for processing (9)
  • .changeset/eight-keys-impress.md (1 hunks)
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1 hunks)
  • apps/webapp/app/routes/resources.runs.$runParam.ts (1 hunks)
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts (2 hunks)
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts (1 hunks)
  • docs/context.mdx (1 hunks)
  • internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts (4 hunks)
  • packages/core/src/v3/schemas/common.ts (4 hunks)
  • packages/core/test/taskExecutor.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • packages/core/test/taskExecutor.test.ts
  • packages/core/src/v3/schemas/common.ts
  • apps/webapp/app/routes/resources.runs.$runParam.ts
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts
**/*.test.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Our tests are all vitest

Files:

  • packages/core/test/taskExecutor.test.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • packages/core/test/taskExecutor.test.ts
  • packages/core/src/v3/schemas/common.ts
  • apps/webapp/app/routes/resources.runs.$runParam.ts
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.
When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Files:

  • apps/webapp/app/routes/resources.runs.$runParam.ts
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
🧬 Code Graph Analysis (4)
packages/core/test/taskExecutor.test.ts (2)
packages/core/src/v3/workers/taskExecutor.ts (11)
  • payload (362-414)
  • payload (416-452)
  • payload (680-780)
  • payload (782-855)
  • payload (857-930)
  • payload (932-942)
  • payload (944-1008)
  • payload (1010-1018)
  • payload (1020-1090)
  • payload (1302-1375)
  • result (1253-1300)
packages/core/src/v3/types/tasks.ts (1)
  • RunFnParams (88-95)
apps/webapp/app/routes/resources.runs.$runParam.ts (1)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (3)
  • run (521-527)
  • run (529-595)
  • run (597-599)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)
apps/webapp/app/services/runsReplicationService.server.ts (2)
  • run (772-827)
  • run (829-837)
internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts (2)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (3)
  • run (521-527)
  • run (529-595)
  • run (597-599)
apps/webapp/app/services/runsReplicationService.server.ts (2)
  • run (772-827)
  • run (829-837)
🔇 Additional comments (11)
.changeset/eight-keys-impress.md (1)

1-5: Changeset looks correct and scoped

Patch bump for @trigger.dev/core with a concise public API note. Matches the PR scope (no behavior changes, context shape addition).

apps/webapp/app/v3/services/createTaskRunAttempt.server.ts (1)

228-229: LGTM: concurrencyKey is correctly propagated and normalized

Adding concurrencyKey: taskRun.concurrencyKey ?? undefined to the execution payload matches the updated schema and avoids leaking nulls. This keeps the API shape consistent across services.

packages/core/test/taskExecutor.test.ts (1)

1938-1939: LGTM: execution payload includes concurrencyKey for test harness

Setting concurrencyKey: "user-123" on the execution ensures the TaskExecutor receives and maps it to ctx. Matches the updated TaskRunExecution type.

packages/core/src/v3/schemas/common.ts (3)

385-400: V3TaskRunExecution: concurrencyKey inclusion is consistent with V3 payloads

Consistent with the V3 execution shape, and properly optional. This keeps the queue clean and exposes concurrencyKey at the correct level.


404-415: TaskRunContext: concurrencyKey on ctx is exactly what we need

Exposing ctx.concurrencyKey fulfills the PR’s primary objective. Nice job keeping it optional and at the top level of the context.


427-445: V3TaskRunContext: concurrencyKey added in parity with non-V3 context

Parity across V3 and non-V3 context schemas looks good; optional string matches the rest of the PR changes.

apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts (1)

1621-1644: Selecting concurrencyKey in AttemptForExecutionGetPayload is necessary and sufficient

Including concurrencyKey in the taskRun selection ensures it’s available wherever execution payloads are derived. Good catch including it in the base selection used by multiple paths.

internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts (4)

172-221: resolveTaskRunContext: selecting run.concurrencyKey is necessary for ctx propagation

Selecting concurrencyKey in the run query is required to populate ctx.concurrencyKey later. Good placement.


257-293: resolveTaskRunContext: concurrencyKey exposed on the returned context — correct

Setting concurrencyKey: run.concurrencyKey ?? undefined at the top level of the context satisfies the ctx contract.


395-451: startRunAttempt: selecting concurrencyKey in the update result prevents undefined later

Including concurrencyKey in the post-update select ensures execution payloads can include it reliably. Good defensive selection.


553-621: Execution payload: concurrencyKey passed through with backward compatible type

Adding concurrencyKey to the BackwardsCompatibleTaskRunExecution instance leverages the Omit<TaskRunExecution, ...> type correctly; the field comes from the underlying TaskRunExecution shape. Aligns with the PR scope.

docs/context.mdx Outdated
Comment on lines 128 to 132
<ResponseField name="concurrencyKey" type="string" optional>
If set, the run is queued under this key. Runs with the same key execute sequentially.
See <a href="/queue-concurrency">Queue concurrency</a> and <a href="/triggering#concurrencykey">Triggering: concurrencyKey</a>.
</ResponseField>

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Docs addition is accurate; please verify anchors

The description is clear and placed correctly as a top-level context field. Please confirm the referenced anchors exist and match current slugs.


🌐 Web query:

Do the docs pages `/queue-concurrency` and `/triggering#concurrencykey` exist with the exact slugs/anchors referenced here?

💡 Result:

Short answer — yes and sort-of:

  • /docs/queue-concurrency exists. (See the "Concurrency & Queues" docs page.) (trigger.dev)
  • /docs/triggering exists and it documents a concurrencyKey option (the page includes a "concurrencyKey" subsection). (trigger.dev)

About the exact fragment /triggering#concurrencykey:

  • The triggering page contains the concurrencyKey subsection, so linking to the triggering page with a fragment for that heading will generally work in browsers. However, I could not find an explicit HTML id="concurrencykey" string in the page source returned — heading IDs are generated by the site generator and may be hyphenated or use different casing (for example "concurrency-key" or "concurrency-keys-and-per-tenant-queuing"). If you need a link that is guaranteed to land exactly on the "concurrencyKey" content, use the Queue/Concurrency page (/docs/queue-concurrency) which has the "Concurrency keys and per-tenant queuing" section. (trigger.dev)

If you want, I can fetch the raw HTML and look for the exact id attribute (or test the fragment URL directly) and confirm the precise anchor string. Which would you prefer?

Citations:


Docs addition is accurate; update Triggering anchor

Both pages exist, but the Triggering page's generated heading ID is likely hyphenated (e.g., concurrency-key), so /triggering#concurrencykey may not jump to the section.

  • File: docs/context.mdx — lines 128-132

Suggested update:

<ResponseField name="concurrencyKey" type="string" optional>
  If set, the run is queued under this key. Runs with the same key execute sequentially.
  See <a href="/queue-concurrency">Queue concurrency</a> and <a href="/triggering#concurrency-key">Triggering: concurrencyKey</a>.
</ResponseField>
🤖 Prompt for AI Agents
In docs/context.mdx around lines 128 to 132, the anchor link to the Triggering
page uses "/triggering#concurrencykey" which likely doesn't match the generated
heading ID; update the anchor to the hyphenated form
"/triggering#concurrency-key" so the link correctly jumps to the concurrencyKey
section; ensure the rest of the text remains unchanged.

@ericallam
Copy link
Member

@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
Copy link
Author

@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

@omkardongre omkardongre force-pushed the concurrency-key-in-ctx branch from 0172cca to a9e2c95 Compare August 17, 2025 23:32
- 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
@omkardongre
Copy link
Author

@ericallam Moved concurrencyKey to ctx.run.concurrencyKey
Verified locally (logs + Run details > Context) and tests pass.

@omkardongre omkardongre force-pushed the concurrency-key-in-ctx branch from a9e2c95 to 024e097 Compare August 26, 2025 20:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)

195-258: Consider also surfacing concurrencyKey at the top level of the run payload (optional)

The run object returned by getRun() currently exposes queue.concurrencyKey and includes concurrencyKey inside the stringified context, but not as a top-level field. If the UI or APIs benefit from direct access (e.g., filtering/searching without parsing context), consider adding a top-level concurrencyKey as well. This would mirror how other layers surface it in execution payloads.

If you decide to add it, here’s a minimal patch:

       idempotencyKey: run.idempotencyKey,
       idempotencyKeyExpiresAt: run.idempotencyKeyExpiresAt,
+      concurrencyKey: run.concurrencyKey ?? undefined,
       schedule: await this.resolveSchedule(run.scheduleId ?? undefined),
       queue: {
         name: run.queue,
         isCustomQueue: !run.queue.startsWith("task/"),
         concurrencyKey: run.concurrencyKey,
       },

Follow-up checks to consider:

  • Confirm no conflicting consumers expect concurrencyKey exclusively under queue or only inside context.run.
  • Add/adjust a lightweight presenter-level test (or a route test) to assert that run.concurrencyKey is present when the DB row has it set.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a9e2c95 and 024e097.

📒 Files selected for processing (9)
  • .changeset/eight-keys-impress.md (1 hunks)
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1 hunks)
  • apps/webapp/app/routes/resources.runs.$runParam.ts (1 hunks)
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts (2 hunks)
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts (1 hunks)
  • docs/context.mdx (1 hunks)
  • internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts (4 hunks)
  • packages/core/src/v3/schemas/common.ts (2 hunks)
  • packages/core/test/taskExecutor.test.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • .changeset/eight-keys-impress.md
  • packages/core/src/v3/schemas/common.ts
  • apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
  • apps/webapp/app/routes/resources.runs.$runParam.ts
  • packages/core/test/taskExecutor.test.ts
  • apps/webapp/app/v3/services/createTaskRunAttempt.server.ts
  • internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts
  • docs/context.mdx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.
When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Files:

  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
🧬 Code graph analysis (1)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)
apps/webapp/app/services/runsReplicationService.server.ts (2)
  • run (772-827)
  • run (829-837)
🔇 Additional comments (3)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (3)

556-570: Good: concurrencyKey is correctly exposed under ctx.run for V3

Placing concurrencyKey at context.run.concurrencyKey aligns with the guidance to keep it scoped to the run object. Using ?? undefined avoids leaking empty strings into the context JSON. Looks good.


292-400: LGTM: Prisma select includes concurrencyKey

concurrencyKey: true is selected, ensuring availability for both the queue section and the V3 context builder below. No issues spotted.


521-527: V4 context surfaces concurrencyKey as expected

The V4 code in runAttemptSystem.resolveTaskRunContext explicitly maps run.concurrencyKey into the returned TaskRunContext (concurrencyKey: run.concurrencyKey ?? undefined). No changes are required.

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.

[TRI-5835] Add the concurrencyKey to the run ctx
2 participants