Skip to content

Bind packages.invoke in standalone scheduled jobs - #1583

Merged
kody-bot merged 2 commits into
mainfrom
cursor/kody-platform-cannot-read-properties-of-null-6571
Aug 20, 2026
Merged

kody-bot merged 2 commits into
mainfrom
cursor/kody-platform-cannot-read-properties-of-null-6571

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Intent

Standalone scheduled jobs that wrap packages.invoke to enter another package's runtime should work the same way authenticated execute and inline workflows already do.

Summary

  • Nightly job Nightly forecast thermostat ranges failed with Cannot read properties of null (reading 'invoke') because standalone jobs left the optional kody:runtime packages helper unbound.
  • Package-owned jobs already bound packages via createPackageRuntimeInvokeTools. Standalone jobs now bind createExecutePackageInvokeTools, matching inline workflows that have no package context.
  • Updated usage, lifecycle, and contributing docs plus the unbound-helper next-steps copy so they list standalone jobs as a packages.invoke context.
  • Follow-up: oxfmt on the three files Static CI flagged.

Testing

  • npx vitest run --project node-unit packages/worker/src/jobs/service.node.test.ts — 19/19 passed, including the extended standalone (createExecutePackageInvokeTools) and package-owned (createPackageRuntimeInvokeTools) assertions.
  • Preview kody-pr-1583 on merge commit of c093e6e9: seed login succeeded; GET /account/jobs.json returned jobs: [] with alarm idle; GET /account/activity.json returned zero open errors. UI pass: Jobs empty state and Activity 7-day empty errors view both loaded. The account JSON API cannot create standalone jobs or packages, so the invoke-binding path is covered by the node-unit spies plus the production fingerprint.
  • Production fingerprint: job:Nightly forecast thermostat ranges:cannot-read-properties-of-null on run 9730cc5e-2d59-4094-b007-d251ca26d290.

Preview: https://kody-pr-1583.kody-a99.workers.dev

Preview jobs empty state
Preview activity empty errors

System changes

System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ 67f3d425 · Head: c093e6e9

Classification: extends — standalone job execution now binds packages.invoke using the existing execute invoke path.

Primitives touched

Primitive Group Impact
jobs assistant extends — standalone jobs bind execute-style packages.invoke
mcp-server surfaces composes — unbound-packages next-steps copy names scheduled jobs

Change flow

A standalone job that calls packages.invoke now receives the same execute-style helper inline workflows already bind.

sequenceDiagram
	actor Job as standalone job
	participant jobs as jobs
	participant packageInvocations as package-invocations
	participant capabilitiesExecute as capabilities-execute
	Job->>jobs: scheduled run with packages.invoke
	jobs->>packageInvocations: createExecutePackageInvokeTools when packageContext is absent
	packageInvocations->>capabilitiesExecute: bind packages helper on kody:runtime
	Job->>capabilitiesExecute: packages.invoke enters target package runtime
Loading

Before / after

before: standalone job → packageInvokeTools omitted → packages === null
after:  standalone job → createExecutePackageInvokeTools → packages.invoke
        package-owned job → createPackageRuntimeInvokeTools (unchanged)
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Standalone scheduled jobs can now invoke saved package exports and use package runtime tools.
    • Package invocation guidance now covers authenticated executions, scheduled jobs, and package runtimes.
  • Documentation

    • Updated package, execution, lifecycle, and contribution documentation to explain invocation contexts and when to use dynamic package invocation.
  • Tests

    • Added coverage verifying the appropriate package invocation tools are available in interactive executions and package runtimes.

Standalone jobs that wrap packages.invoke failed because the helper was only
bound for package-owned jobs. Use the same execute-style invoke tools that
inline workflows already use when there is no package context.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8143c47c-3f20-4dff-b4fc-d57868a74578

📥 Commits

Reviewing files that changed from the base of the PR and between 67f3d42 and 42b73e5.

📒 Files selected for processing (7)
  • docs/contributing/packages-and-manifests.md
  • docs/guides/package-lifecycle.md
  • docs/use/execute.md
  • docs/use/packages.md
  • packages/worker/src/jobs/service.node.test.ts
  • packages/worker/src/jobs/service.ts
  • packages/worker/src/mcp/executor.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Standalone scheduled jobs now receive package invocation tools. Worker execution selects tools by package context, tests verify the selection, and documentation describes standalone-job support for packages.invoke.

Changes

Standalone package invocation

Layer / File(s) Summary
Context-specific invocation tool wiring
packages/worker/src/jobs/service.ts, packages/worker/src/mcp/executor.ts
Job execution shares invocation context and selects execute-specific tools for standalone jobs or runtime tools for package-owned jobs.
Execution-context coverage
packages/worker/src/jobs/service.node.test.ts
Tests verify the expected invocation factory for interactive and repo-backed execution, including mock cleanup.
Invocation context documentation
docs/contributing/packages-and-manifests.md, docs/guides/package-lifecycle.md, docs/use/execute.md, docs/use/packages.md
Documentation includes standalone scheduled jobs as supported packages.invoke contexts and describes keyless package entry behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 42b73

This PR enables standalone scheduled jobs to use packages.invoke through the existing execute path and adds targeted coverage and documentation updates. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant StandaloneScheduledJob
  participant executePublishedJobArtifact
  participant executeInvokeToolFactory
  participant PackageRuntime
  StandaloneScheduledJob->>executePublishedJobArtifact: execute published artifact
  executePublishedJobArtifact->>executeInvokeToolFactory: create execute-time invocation tools
  executePublishedJobArtifact->>StandaloneScheduledJob: provide invocation tools
  StandaloneScheduledJob->>PackageRuntime: invoke saved package
Loading

Possibly related PRs

  • kentcdodds/kody#1045: Both update packages.invoke documentation and runtime guidance.
  • kentcdodds/kody#1046: This PR extends keyless invocation support by wiring tools into standalone jobs.
  • kentcdodds/kody#1479: Both select execute-specific or package-runtime invocation factories by execution context.

Suggested reviewers: kody-bot

🚥 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
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.
Title check ✅ Passed The title is concise and clearly describes the main change: enabling packages.invoke in standalone scheduled jobs.
Description check ✅ Passed The description covers intent, summary, testing, and system changes with relevant implementation and validation details.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/kody-platform-cannot-read-properties-of-null-6571

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.

@kentcdodds
kentcdodds marked this pull request as ready for review August 20, 2026 02:24
@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1583.kody-a99.workers.dev

Worker: kody-pr-1583
Runtime worker: kody-pr-1583-runtime (https://kody-pr-1583-runtime.kody-a99.workers.dev)
D1: kody-pr-1583-db
KV: kody-pr-1583-oauth-kv

Mocks:

Static CI failed oxfmt --check on the three files this PR already edited.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kody-bot
kody-bot merged commit 10b2275 into main Aug 20, 2026
12 checks passed
@kody-bot
kody-bot deleted the cursor/kody-platform-cannot-read-properties-of-null-6571 branch August 20, 2026 04:52
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.

3 participants