Skip to content

Conversation

dhinakaranst
Copy link

Checklist
I have followed every step in the contributing guide
The PR title follows the convention
I ran and tested that the docs page renders locally
Changelog
docs: add description and example to Runs “Retrieve run” page
image

Before: page showed no content beyond title
After: page displays description, TS example, and OpenAPI details

Copy link

changeset-bot bot commented Sep 11, 2025

⚠️ No Changeset found

Latest commit: 61fe900

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/dhinakaranst/trigger.dev/new/docs/fix-retrieve-run-empty?filename=.changeset/nine-gorillas-drive.md&value=---%0A%22docs%22%3A%20patch%0A---%0A%0Adocs(runs)%3A%20add%20description%20and%20example%20to%20retrieve%20endpoint%20(closes%20%E2%80%A6%0A)

Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Walkthrough

Adds docs for the Retrieve Run endpoint in docs/management/runs/retrieve.mdx. The page describes retrieving a run by runId and states the response includes status, payload, output, and attempts. It includes a TypeScript example calling runs.retrieve("run_1234"), conditionally handling a success result, printing status/payload/output, and iterating run.attempts to log errors for failed attempts. No code or API changes outside documentation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Scope: Single docs file added
  • Nature: Textual content and one example snippet
  • Heterogeneity: Homogeneous documentation changes
  • Logic density: None (no runtime logic changes)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92c5211 and 61fe900.

📒 Files selected for processing (1)
  • docs/management/runs/retrieve.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/management/runs/retrieve.mdx

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description includes a changelog entry, a screenshot, and notes that the docs rendered locally, but it does not follow the repository's required template: it is missing the top-line "Closes #" entry, the "## ✅ Checklist" formatted with markdown checkboxes and the contributing guide link, and a dedicated "Testing" section that lists the exact verification steps. Checklist items are present as plain text rather than the template checkboxes and the template headings are not used consistently, so required template structure is not met. Update the PR description to match the repository template exactly: add the leading "Closes #" line with the issue number, add the "## ✅ Checklist" section using the markdown checkboxes (including the contributing guide link and the "I ran and tested the code works" checkbox), add a "Testing" section that documents the exact steps you ran to verify the docs locally, and place the changelog and screenshot under their respective template headings. Mark the appropriate checkboxes and include any relevant commands or notes used during local testing.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "docs(runs): add description and example to retrieve endpoint (closes …)" is concise and accurately summarizes the primary change (adding description and example to the Runs retrieve endpoint) and follows the repo prefix convention. However, it contains an ellipsis in the "(closes …)" parenthetical instead of a concrete issue reference, which reduces traceability.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
docs/management/runs/retrieve.mdx (1)

6-6: Clarify response fields and auth prerequisites.

Recommend explicitly noting authentication (API key or management client) and enumerating key fields (e.g., id, status, payload, output, attempts, createdAt/completedAt) to set expectations.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5db583b and 92c5211.

📒 Files selected for processing (1)
  • docs/management/runs/retrieve.mdx (1 hunks)
🔇 Additional comments (2)
docs/management/runs/retrieve.mdx (2)

8-26: Import confirmed — runs is a top-level export.
packages/trigger-sdk/src/v3/runs.ts exports export const runs = { ... retrieve: retrieveRun }; packages/trigger-sdk/src/v3/shared.ts calls runs.retrieve(...). The example import { runs } from "@trigger.dev/sdk" is correct.


3-3: Verify OpenAPI frontmatter path/param name

Confirm the repo's OpenAPI v3 spec uses the same path parameter name as the frontmatter in docs/management/runs/retrieve.mdx (line 3: openapi: "v3-openapi GET /api/v3/runs/{runId}"); update the doc or the spec so the placeholder names match (e.g., {runId} vs {id}).

Comment on lines 11 to 15
const result = await runs.retrieve("run_1234");

if (result.isSuccess) {
console.log("Run was successful with output", result.output);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix example: likely incorrect API shape (no isSuccess on run), add error handling, and avoid duplicate logs.

In the SDK, runs.retrieve typically returns a Run object with a status field (e.g., "SUCCESS" | "FAILED"), not a { isSuccess, output } wrapper. Also, you log output twice and don’t handle 404/network errors. Proposed fix:

-import { runs } from "@trigger.dev/sdk";
-
-const result = await runs.retrieve("run_1234");
-
-if (result.isSuccess) {
-  console.log("Run was successful with output", result.output);
-}
-
-console.log("Run status:", result.status);
-console.log("Payload:", result.payload);
-console.log("Output:", result.output);
-
-for (const attempt of result.attempts) {
-  if (attempt.status === "FAILED") {
-    console.log("Attempt failed with error:", attempt.error);
-  }
-}
+import { runs } from "@trigger.dev/sdk";
+
+const runId = "run_1234";
+try {
+  const run = await runs.retrieve(runId);
+
+  if (run.status === "SUCCESS") {
+    console.log("Run was successful with output:", run.output);
+  }
+
+  console.log("Run status:", run.status);
+  console.log("Payload:", run.payload);
+  console.log("Output:", run.output);
+
+  for (const attempt of run.attempts ?? []) {
+    if (attempt.status === "FAILED") {
+      console.log("Attempt failed with error:", attempt.error?.message ?? attempt.error);
+    }
+  }
+} catch (err) {
+  console.error("Failed to retrieve run", runId, err);
+}

Also applies to: 17-25

🤖 Prompt for AI Agents
In docs/management/runs/retrieve.mdx around lines 11 to 15 (and similarly lines
17–25), the example assumes runs.retrieve returns { isSuccess, output } and logs
output twice; instead update the snippet to use the Run object's status field
(e.g., status === "SUCCESS"), add proper error handling (wrap the call in
try/catch and handle network/404 errors), and remove duplicate console.log calls
so successful runs log the output once and failed/404 cases log an appropriate
error or status message.

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