Skip to content

[Authz 6/6] Add internal endpoint for schedule execution w/ Trueforge Service Key - #627

Merged
chiragjn merged 20 commits into
mainfrom
cj-authz-schedule-execute-1
Sep 11, 2026
Merged

[Authz 6/6] Add internal endpoint for schedule execution w/ Trueforge Service Key#627
chiragjn merged 20 commits into
mainfrom
cj-authz-schedule-execute-1

Conversation

@chiragjn

@chiragjn chiragjn commented Sep 8, 2026

Copy link
Copy Markdown
Member

Note

Medium Risk
Touches scheduled execution, a new service-key-protected internal route, and TrueFoundry agent token vending for background turns—operational misconfiguration of TRUEFORGE_API_KEY could block schedules.

Overview
Scheduled runs no longer go through multi-step public SDK calls from the controller. The dispatch loop now POSTs once to POST /api/internal/schedules/runs/execute with TRUEFORGE_API_KEY, passing only schedule_run_id. The server loads the run, schedule, and agent, impersonates the schedule creator via requestContextFromCreatedBySubject, and starts the turn in-process (same path as manual run-now).

TrueFoundry mode: schedule turns resolve models/MCP with agent-scoped vended tokens (saved agent + creator subject); turn skills use a dedicated TrueFoundryAdminSkillStore (service API key). Interactive session turns still use the caller token where applicable.

Adds TRUEFORGE_API_KEY (required when STANDALONE=false, default trueforge-standalone locally), createApiKeyAuthMiddleware, schedule store getRunById, OpenAPI/SDK client.internal.schedules.executeRun, and env/docs updates for controller → server HTTP handoff.

Reviewed by Cursor Bugbot for commit 77fc508. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 77fc508

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@truefoundry/trueforge-sdk Patch
@truefoundry/trueforge Minor
@truefoundry/trueforge-ui Patch

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

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/config.ts
Comment thread packages/trueforge/src/main.ts Outdated
@chiragjn
chiragjn force-pushed the cj-authz-schedule-execute-1 branch from 0aafba0 to 0ff16c2 Compare September 8, 2026 11:06

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/controller.ts Outdated

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/controller.ts Outdated
Comment thread packages/trueforge/.env.example Outdated
Comment thread packages/trueforge/.env.example Outdated
Comment thread packages/trueforge/tests/unit/controller/scheduleDispatch.test.ts
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/controller.ts Outdated
Comment thread packages/trueforge/src/controller/scheduleDispatch.ts Outdated
Comment thread packages/trueforge/src/app.ts Outdated
Comment thread packages/trueforge/src/controller.ts Outdated
Comment thread packages/trueforge/src/apis/schedules.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/apis/schedules.ts
@chiragjn
chiragjn force-pushed the cj-authz-schedule-execute-1 branch from 6022de2 to 746993a Compare September 9, 2026 11:28

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/main.ts Outdated

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/controller/scheduleDispatch.ts

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

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

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 ec7edee. Configure here.

Comment thread packages/trueforge/src/apis/schedules.ts
Comment thread packages/trueforge/src/apis/schedules.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
@chiragjn
chiragjn merged commit 4b120b8 into main Sep 11, 2026
11 checks passed
@chiragjn
chiragjn deleted the cj-authz-schedule-execute-1 branch September 11, 2026 02:56
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