Skip to content

Fix saved package publish artifact rebuild memory pressure - #440

Merged
kentcdodds merged 7 commits into
mainfrom
cursor/kody-package-publish-memory-bfb2
May 12, 2026
Merged

kentcdodds merged 7 commits into
mainfrom
cursor/kody-package-publish-memory-bfb2

Conversation

@kentcdodds

@kentcdodds kentcdodds commented May 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Root cause

Large saved package publishes were doing too much work inside one RepoSession Durable Object invocation. The hot path ran checks, kept full sourceFiles snapshots reachable, wrote whole-source KV snapshots, refreshed package projection, and rebuilt every published bundle artifact in the same isolate. repo_run_commands also returned the full sourceFiles map from runRepoChecks through the DO RPC object before MCP output normalization discarded it. For large/multi-entrypoint packages such as ai-chat and email-received-subscriber, that stacked whole source trees, typecheck/bundle state, serialized snapshots, and bundle artifact module maps in one memory lifetime.

Memory hotspots found

  • runRepoChecks collects a full Record<string, string> source tree and builds a second worker-bundler snapshot from it.
  • RepoSession.runChecks was spreading that full check result back to callers, so sourceFiles could be serialized over RPC even though public schemas do not expose it.
  • publishSession collected the full workspace again after checks.
  • finalizePublishedEntitySource advanced source metadata and then called refreshSavedPackageProjection, which loaded source again and rebuilt every package bundle artifact in the same DO publish invocation.
  • External publish retry could observe an already-advanced commit and return already_published without repairing stale/missing bundle artifacts.

Chosen design

  • Strip sourceFiles before persisting/check-returning RepoSession check results, so large source trees are not serialized to MCP callers.
  • Add reusable package artifact target planning (collectPublishedPackageArtifactTargets) and single-target persistence (persistPublishedPackageArtifactTarget).
  • Let package projection refresh skip bundle rebuilding and load only the manifest when publish callers request rebuildArtifacts: false.
  • Make the MCP publish paths (repo_run_commands(... publish: true) and package_publish_external_push) publish/finalize source metadata first, then rebuild saved-package artifacts one target at a time through separate RepoSession RPC invocations.
  • Keep legacy inline rebuild behavior as the default for other callers (for example artifact reconcile jobs) unless they explicitly opt out.
  • For package_publish_external_push, remove the early already_published shortcut: the capability now clones/prepares the workspace and rebuilds artifacts even when D1 already points at the current Artifacts HEAD. This gives operators a safe repair path for stale/missing bundles.

Tests run

  • npx vitest run --project node-unit packages/worker/src/mcp/capabilities/packages/publish-external-push.node.test.ts packages/worker/src/mcp/capabilities/repo/repo-workflow.node.test.ts packages/worker/src/repo/repo-session-do.node.test.ts packages/worker/src/repo/external-publish.node.test.ts && npm run typecheck
  • npm run validate (format, lint, typecheck, unit tests, Playwright E2E, MCP E2E all completed successfully)

Operational steps after deploy

Re-run package_publish_external_push for the blocked packages, starting with email-received-subscriber (2710d748-686c-4cfa-8425-6b34f7d204a3) and ai-chat. It is now useful even if Artifacts HEAD already equals published_commit, because the already-published path rebuilds current bundle artifacts one target at a time. Then republish affected dependents (discord-gateway, discord-general-chat, social-intelligence, and other stale static dependents reported by the response) as needed so their static kody:@ snapshots capture the refreshed dependency commits.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Published package artifacts are rebuilt automatically after publish; can be opted out to skip rebuilds.
    • Added on-demand rebuild endpoint for published package artifacts and sequential rebuild processing.
  • Refactor

    • Centralized artifact target collection and per-target build/persist flow for more consistent artifact generation.
  • Tests

    • Expanded test coverage for publish + rebuild flows, retry behavior, error handling, and projection refresh without files.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@cursor[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 1 second before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 77c19375-026d-4362-b5f8-4b868c3dc991

📥 Commits

Reviewing files that changed from the base of the PR and between a577f5e and 53fd771.

📒 Files selected for processing (1)
  • packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts
📝 Walkthrough

Walkthrough

Adds a build-target abstraction and RPC endpoints to list/rebuild published bundle artifact targets, implements a repo-session rebuild helper that sequentially rebuilds targets, and integrates post-publish artifact rebuilds into external-push, publish-session, and run-commands flows; tests and package-registry loading were updated for optional rebuild skipping.

Changes

Published Package Artifact Rebuild Infrastructure

Layer / File(s) Summary
Build Target Abstraction
packages/worker/src/package-runtime/published-bundle-artifacts.ts
Adds PublishedPackageArtifactBuildTarget type, collectPublishedPackageArtifactTargets() and persistPublishedPackageArtifactTarget() helpers; refactors rebuildPublishedPackageArtifacts() to iterate targets and delegate persistence to the new helper.
RPC Contract Extensions
packages/worker/src/repo/repo-session-rpc.ts
Extends RepoSessionRpc with listPublishedPackageArtifactTargets() and rebuildPublishedPackageArtifact() methods; adds optional rebuildPackageArtifacts flag to publishSession and publishFromExternalRef payloads.
Durable Object Implementation
packages/worker/src/repo/repo-session-do.ts
Implements the new RPC methods in RepoSessionBase, adds helpers to resolve publish source and compute targets, updates runChecks result shape separation, and propagates rebuildPackageArtifacts through publish flows.
Conditional Artifact Rebuild
packages/worker/src/package-registry/service.ts
refreshSavedPackageProjection() gains optional rebuildArtifacts?: boolean; supports manifest-only loading when false and only triggers artifact rebuilds when files were loaded.
Orchestration Helper
packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts
New capability rebuildPublishedPackageArtifactsViaRepoSession() that creates a repo-session RPC client, lists targets, and rebuilds each target sequentially, rethrowing errors with contextual message.
External Publish Flow
packages/worker/src/repo/external-publish.ts
FinalizePublishedSourceInput and publishFromExternalRef accept optional rebuildPackageArtifacts?: boolean and forward it into refreshSavedPackageProjection/finalization.
Publish Handler: External Push
packages/worker/src/mcp/capabilities/packages/publish-external-push.ts
Calls publishFromExternalRef(..., rebuildPackageArtifacts:false) and, on both published and already_published results (requiring published_commit), invokes the rebuild helper to sequentially rebuild published bundle targets.
Publish Handler: Direct Publish
packages/worker/src/mcp/capabilities/repo/repo-publish-session.ts
Loads sessionInfo, calls publishSession(..., rebuildPackageArtifacts:false), and triggers rebuildPublishedPackageArtifactsViaRepoSession() on success when the session entity is a package.
Publish Handler: Run Commands
packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts
Forces runCommands to publish:false, computes publish decision from checks, calls publishSession() on passing checks, and invokes rebuild helper when publish succeeds for package sessions; response shaping adjusted accordingly.
Test Coverage: External Push & Repo Workflow
packages/worker/src/mcp/capabilities/packages/publish-external-push.node.test.ts, packages/worker/src/mcp/capabilities/repo/repo-workflow.node.test.ts
Adds mocks for list/rebuild RPCs; updates expectations for rebuildPackageArtifacts flags; adds tests for sequential per-target rebuilds, missing published_commit error, retry behavior, direct publish rebuild failure, and run-commands publish expectations.
Test Coverage: Registry & Runtime
packages/worker/src/package-registry/service.node.test.ts, packages/worker/src/package-runtime/published-bundle-artifacts.node.test.ts
Adds manifest-only loading test when rebuildArtifacts:false and removes inline files from updated rebuildPublishedPackageArtifacts test inputs.

Sequence Diagram(s)

sequenceDiagram
  participant Handler as Publish Handler
  participant RepoRPC as RepoSessionRpc
  participant DO as RepoSessionDO
  participant Registry as Package Registry
  participant KV as KV Store

  Handler->>RepoRPC: publishFromExternalRef(..., rebuildPackageArtifacts:false)
  RepoRPC->>DO: delegate publishFromExternalRef
  DO-->>RepoRPC: status published|already_published + published_commit

  Handler->>RepoRPC: listPublishedPackageArtifactTargets({sessionId?, sourceId, userId})
  RepoRPC->>DO: delegate listPublishedPackageArtifactTargets
  DO-->>RepoRPC: targets[]

  loop for each target
    Handler->>RepoRPC: rebuildPublishedPackageArtifact({target, publishedCommit, baseUrl?, sessionId?})
    RepoRPC->>DO: delegate rebuildPublishedPackageArtifact
    DO->>KV: persistPublishedPackageArtifactTarget(...)
    KV-->>DO: kvKey
    DO-->>RepoRPC: {ok:true, target, kvKey}
    RepoRPC-->>Handler: {ok:true, target, kvKey}
  end

  Handler->>Handler: return result with rebuilt artifacts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • kentcdodds/kody#253: Modifies repo publish flows and related session/publish behavior; likely overlaps with publish/retry logic.
  • kentcdodds/kody#251: Related changes to published bundle-artifacts and repo-session RPCs affecting artifact rebuild/persist flows.
  • kentcdodds/kody#363: Both PRs touch bundling abstractions and importable-module bundle kinds/builders used by rebuild paths.

Poem

🐰 Hopped through code to stitch each crate,

Targets gathered, rebuilt one-by-one, elate,
Post-publish bundles fresh and neat,
Sequential hops made everything complete,
A rabbit's cheer for artifacts saved great!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 specifically summarizes the main change: addressing memory pressure during package artifact rebuilds by refactoring how artifacts are handled during publication.
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.

✏️ 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 cursor/kody-package-publish-memory-bfb2

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.

@kentcdodds
kentcdodds marked this pull request as ready for review May 11, 2026 23:33
@github-actions

github-actions Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-440.kentcdodds.workers.dev

Worker: kody-pr-440
D1: kody-pr-440-db
KV: kody-pr-440-oauth-kv

Mocks:

Comment thread packages/worker/src/repo/repo-session-do.ts Outdated
Comment thread packages/worker/src/mcp/capabilities/packages/publish-external-push.ts Outdated

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts (1)

90-108: 💤 Low value

Consider refactoring nested ternary for readability.

The three-level nested ternary logic (lines 90-108) works correctly but is cognitively complex. Consider extracting this into a helper function or using if-else blocks for better maintainability.

♻️ Example refactor with if-else blocks
-const publish =
-  args.publish === true
-    ? result.checks.status === 'failed'
-      ? {
-          status: 'blocked_by_checks' as const,
-          message: 'Publishing skipped because repo checks failed.',
-          failedChecks: result.checks.failedChecks,
-          runId: result.checks.runId,
-          treeHash: result.checks.treeHash,
-          checkedAt: result.checks.checkedAt,
-        }
-      : result.checks.status === 'passed'
-        ? await sessionRpc.publishSession({
-            sessionId: validatedSession.id,
-            userId: user.userId,
-            rebuildPackageArtifacts: false,
-          })
-        : { status: 'not_requested' as const }
-    : result.publish
+let publish
+if (args.publish === true) {
+  if (result.checks.status === 'failed') {
+    publish = {
+      status: 'blocked_by_checks' as const,
+      message: 'Publishing skipped because repo checks failed.',
+      failedChecks: result.checks.failedChecks,
+      runId: result.checks.runId,
+      treeHash: result.checks.treeHash,
+      checkedAt: result.checks.checkedAt,
+    }
+  } else if (result.checks.status === 'passed') {
+    publish = await sessionRpc.publishSession({
+      sessionId: validatedSession.id,
+      userId: user.userId,
+      rebuildPackageArtifacts: false,
+    })
+  } else {
+    publish = { status: 'not_requested' as const }
+  }
+} else {
+  publish = result.publish
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts` around lines
90 - 108, The nested ternary assigning publish is hard to read—replace it with a
small helper or if/else block that computes publish based on args.publish and
result.checks.status; for example create a function (e.g., computePublishPayload
or determinePublishStatus) that takes args.publish, result.checks and
validatedSession/user and returns either the blocked_by_checks object (including
failedChecks, runId, treeHash, checkedAt), calls sessionRpc.publishSession when
status === 'passed', or returns { status: 'not_requested' } when checks are
neither passed nor failed, and fallback to result.publish when args.publish !==
true; update the const publish = ... line to call that helper so the logic
around args.publish, result.checks.status, and sessionRpc.publishSession is
clear and linear.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts`:
- Around line 109-123: The call to
rebuildPublishedPackageArtifactsViaRepoSession lacks error handling which can
leave artifacts stale; wrap the invocation inside a try-catch in the
repo-run-commands capability (the block where args.publish === true &&
publish.status === 'ok' && validatedSession.entity_type === 'package') and
handle failures by either (a) logging the error with context (include
validatedSession.id, publish.publishedCommit, and user.userId) and returning a
partial success response/flag indicating artifacts need manual repair, or (b)
re-throwing a new error that annotates "publish succeeded but artifact rebuild
failed" so upstream callers can distinguish the two outcomes; ensure the catch
uses processLogger (or existing logger in ctx) and preserves the original error
details when re-throwing or returning the partial status.

---

Nitpick comments:
In `@packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts`:
- Around line 90-108: The nested ternary assigning publish is hard to
read—replace it with a small helper or if/else block that computes publish based
on args.publish and result.checks.status; for example create a function (e.g.,
computePublishPayload or determinePublishStatus) that takes args.publish,
result.checks and validatedSession/user and returns either the blocked_by_checks
object (including failedChecks, runId, treeHash, checkedAt), calls
sessionRpc.publishSession when status === 'passed', or returns { status:
'not_requested' } when checks are neither passed nor failed, and fallback to
result.publish when args.publish !== true; update the const publish = ... line
to call that helper so the logic around args.publish, result.checks.status, and
sessionRpc.publishSession is clear and linear.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1da5d0a0-5e0a-4dd0-be7d-4c03e676243b

📥 Commits

Reviewing files that changed from the base of the PR and between e06dfc4 and 381128f.

📒 Files selected for processing (11)
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.node.test.ts
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.ts
  • packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts
  • packages/worker/src/mcp/capabilities/repo/repo-publish-session.ts
  • packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts
  • packages/worker/src/mcp/capabilities/repo/repo-workflow.node.test.ts
  • packages/worker/src/package-registry/service.ts
  • packages/worker/src/package-runtime/published-bundle-artifacts.ts
  • packages/worker/src/repo/external-publish.ts
  • packages/worker/src/repo/repo-session-do.ts
  • packages/worker/src/repo/repo-session-rpc.ts

Comment on lines +109 to +123
if (
args.publish === true &&
publish.status === 'ok' &&
validatedSession.entity_type === 'package'
) {
await rebuildPublishedPackageArtifactsViaRepoSession({
env: ctx.env,
rpcSessionId: validatedSession.id,
sessionId: validatedSession.id,
sourceId: validatedSession.source_id,
userId: user.userId,
publishedCommit: publish.publishedCommit,
baseUrl: ctx.callerContext.baseUrl,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add error handling for artifact rebuild failures.

The call to rebuildPublishedPackageArtifactsViaRepoSession has no try-catch. If artifact rebuilding fails, the capability returns a success response but artifacts remain stale or missing. This creates inconsistent state where D1 points at the new commit but KV bundles are out of sync.

Consider wrapping the rebuild in a try-catch and either:

  1. Log the error and return a partial success status indicating artifacts need manual repair, or
  2. Re-throw with context so the caller knows the publish succeeded but artifact rebuild failed.
🛡️ Proposed error handling
 if (
   args.publish === true &&
   publish.status === 'ok' &&
   validatedSession.entity_type === 'package'
 ) {
+  try {
     await rebuildPublishedPackageArtifactsViaRepoSession({
       env: ctx.env,
       rpcSessionId: validatedSession.id,
       sessionId: validatedSession.id,
       sourceId: validatedSession.source_id,
       userId: user.userId,
       publishedCommit: publish.publishedCommit,
       baseUrl: ctx.callerContext.baseUrl,
     })
+  } catch (error) {
+    console.error('Failed to rebuild published package artifacts:', error)
+    throw new Error(
+      `Published commit ${publish.publishedCommit} but artifact rebuild failed. Artifacts may need manual repair.`,
+      { cause: error }
+    )
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts` around lines
109 - 123, The call to rebuildPublishedPackageArtifactsViaRepoSession lacks
error handling which can leave artifacts stale; wrap the invocation inside a
try-catch in the repo-run-commands capability (the block where args.publish ===
true && publish.status === 'ok' && validatedSession.entity_type === 'package')
and handle failures by either (a) logging the error with context (include
validatedSession.id, publish.publishedCommit, and user.userId) and returning a
partial success response/flag indicating artifacts need manual repair, or (b)
re-throwing a new error that annotates "publish succeeded but artifact rebuild
failed" so upstream callers can distinguish the two outcomes; ensure the catch
uses processLogger (or existing logger in ctx) and preserves the original error
details when re-throwing or returning the partial status.

Comment thread packages/worker/src/package-registry/service.ts Outdated
Comment thread packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts Outdated
Comment thread packages/worker/src/package-runtime/published-bundle-artifacts.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bfc4dd3. Configure here.

cursoragent and others added 6 commits May 12, 2026 00:45
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor
cursor Bot force-pushed the cursor/kody-package-publish-memory-bfb2 branch from e60b579 to a577f5e Compare May 12, 2026 00:48

@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.

🧹 Nitpick comments (1)
packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts (1)

19-31: ⚡ Quick win

Reuse the session RPC client instead of creating a new one per iteration.

Lines 20-22 create a fresh repoSessionRpc client for each artifact target, but the session client initialized on line 13 can be reused, reducing overhead.

♻️ Proposed refactor to reuse the session client
 	for (const target of targets) {
-		await repoSessionRpc(
-			input.env,
-			input.rpcSessionId,
-		).rebuildPublishedPackageArtifact({
+		await session.rebuildPublishedPackageArtifact({
 			sessionId: input.repoSessionId,
 			sourceId: input.sourceId,
 			userId: input.userId,
 			publishedCommit: input.publishedCommit,
 			target,
 			baseUrl: input.baseUrl,
 		})
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts` around
lines 19 - 31, The loop currently calls repoSessionRpc(input.env,
input.rpcSessionId) for each target, creating a new client per iteration;
instead reuse the existing session client (the variable named session
initialized earlier) by calling session.rebuildPublishedPackageArtifact(...)
inside the loop with the same payload (sessionId: input.repoSessionId, sourceId:
input.sourceId, userId: input.userId, publishedCommit: input.publishedCommit,
target, baseUrl: input.baseUrl), so remove the per-iteration repoSessionRpc(...)
call and use session to avoid repeated client creation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts`:
- Around line 19-31: The loop currently calls repoSessionRpc(input.env,
input.rpcSessionId) for each target, creating a new client per iteration;
instead reuse the existing session client (the variable named session
initialized earlier) by calling session.rebuildPublishedPackageArtifact(...)
inside the loop with the same payload (sessionId: input.repoSessionId, sourceId:
input.sourceId, userId: input.userId, publishedCommit: input.publishedCommit,
target, baseUrl: input.baseUrl), so remove the per-iteration repoSessionRpc(...)
call and use session to avoid repeated client creation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 220ed3b2-1b81-4652-bdb7-fd1de4ed507a

📥 Commits

Reviewing files that changed from the base of the PR and between 381128f and a577f5e.

📒 Files selected for processing (13)
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.node.test.ts
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.ts
  • packages/worker/src/mcp/capabilities/repo/package-artifact-rebuild.ts
  • packages/worker/src/mcp/capabilities/repo/repo-publish-session.ts
  • packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts
  • packages/worker/src/mcp/capabilities/repo/repo-workflow.node.test.ts
  • packages/worker/src/package-registry/service.node.test.ts
  • packages/worker/src/package-registry/service.ts
  • packages/worker/src/package-runtime/published-bundle-artifacts.node.test.ts
  • packages/worker/src/package-runtime/published-bundle-artifacts.ts
  • packages/worker/src/repo/external-publish.ts
  • packages/worker/src/repo/repo-session-do.ts
  • packages/worker/src/repo/repo-session-rpc.ts
💤 Files with no reviewable changes (1)
  • packages/worker/src/package-runtime/published-bundle-artifacts.node.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/worker/src/mcp/capabilities/repo/repo-publish-session.ts
  • packages/worker/src/repo/repo-session-rpc.ts
  • packages/worker/src/package-runtime/published-bundle-artifacts.ts
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.ts
  • packages/worker/src/mcp/capabilities/repo/repo-run-commands.ts
  • packages/worker/src/mcp/capabilities/packages/publish-external-push.node.test.ts
  • packages/worker/src/repo/repo-session-do.ts

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds merged commit a81aa43 into main May 12, 2026
5 checks passed
@kentcdodds
kentcdodds deleted the cursor/kody-package-publish-memory-bfb2 branch May 12, 2026 01:32
@coderabbitai coderabbitai Bot mentioned this pull request Jul 13, 2026
4 of 5 tasks
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.

2 participants