fix(scheduler): #1692 — mount ScheduleHandler HTTP routes #1694

Closed
hongming wants to merge 1 commits from fix/1692-mount-schedule-routes into main
Owner

Summary

  • ScheduleHandler + Temporal cron worker were fully implemented but the HTTP routes were never mounted in router.go → every call to /workspaces/:id/schedules returned 404
  • Canvas Schedule tab silently failed; agent MCP set_schedule returned 404; PM had no platform-side scheduler and was relying on the CTO orchestrator's /loop tick as its only heartbeat
  • 18-line patch: wire 7 endpoints under existing wsAuth group (WorkspaceAuth middleware enforces per-workspace bearer scope, matching the IDOR-fix shape inside the handler)

Routes exposed

GET    /workspaces/:id/schedules
POST   /workspaces/:id/schedules
PUT    /workspaces/:id/schedules/:scheduleId
DELETE /workspaces/:id/schedules/:scheduleId
POST   /workspaces/:id/schedules/:scheduleId/run
GET    /workspaces/:id/schedules/:scheduleId/history
GET    /workspaces/:id/schedules/health

Test plan

  • go build ./... in workspace-server compiles clean
  • Post-merge: POST /workspaces/<pm-id>/schedules with cron + autonomous-tick prompt → verify row in workspace_schedules + first fire within window
  • Post-merge: Canvas Schedule tab loads existing schedules

Fixes #1692.

## Summary - `ScheduleHandler` + Temporal cron worker were fully implemented but the HTTP routes were never mounted in `router.go` → every call to `/workspaces/:id/schedules` returned 404 - Canvas Schedule tab silently failed; agent MCP `set_schedule` returned 404; PM had no platform-side scheduler and was relying on the CTO orchestrator's /loop tick as its only heartbeat - 18-line patch: wire 7 endpoints under existing `wsAuth` group (WorkspaceAuth middleware enforces per-workspace bearer scope, matching the IDOR-fix shape inside the handler) ## Routes exposed ``` GET /workspaces/:id/schedules POST /workspaces/:id/schedules PUT /workspaces/:id/schedules/:scheduleId DELETE /workspaces/:id/schedules/:scheduleId POST /workspaces/:id/schedules/:scheduleId/run GET /workspaces/:id/schedules/:scheduleId/history GET /workspaces/:id/schedules/health ``` ## Test plan - [x] `go build ./...` in workspace-server compiles clean - [ ] Post-merge: `POST /workspaces/<pm-id>/schedules` with cron + autonomous-tick prompt → verify row in `workspace_schedules` + first fire within window - [ ] Post-merge: Canvas Schedule tab loads existing schedules Fixes #1692.
hongming added 1 commit 2026-05-23 00:18:07 +00:00
fix(scheduler): #1692 — mount ScheduleHandler HTTP routes
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
CI / Python Lint & Test (pull_request) Successful in 4s
CI / Detect changes (pull_request) Successful in 9s
E2E API Smoke Test / detect-changes (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 6s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 4s
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 4s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 6s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
gate-check-v3 / gate-check (pull_request) Successful in 4s
sop-checklist / review-refire (pull_request) Has been skipped
sop-checklist / na-declarations (pull_request) N/A: (none)
qa-review / approved (pull_request) Failing after 12s
security-review / approved (pull_request) Failing after 11s
sop-checklist / all-items-acked (pull_request) Successful in 10s
CI / Canvas (Next.js) (pull_request) Successful in 3s
sop-tier-check / tier-check (pull_request) Successful in 10s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
E2E Chat / E2E Chat (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
Harness Replays / Harness Replays (pull_request) Successful in 2s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m10s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Failing after 2m5s
audit-force-merge / audit (pull_request) Has been skipped
CI / Platform (Go) (pull_request) Successful in 4m45s
CI / all-required (pull_request) Successful in 5m28s
2e93df5d69
The handler + Temporal cron worker are implemented in
workspace-server/internal/handlers/schedules.go +
platform/internal/scheduler, but the HTTP routes were never mounted.
Every call to /workspaces/:id/schedules returned 404, so:

- Canvas "Schedule" tab silently failed to load/save schedules
- Agent MCP set_schedule tool returned 404 → agents had no way to
  self-schedule wake-ups (PM in particular had no platform-side
  scheduler and was relying on the CTO orchestrator's /loop tick as
  its only heartbeat)

Routes are mounted under WorkspaceAuth so the per-workspace bearer
token scopes ownership, matching the IDOR-fix shape in
handlers/schedules.go (Update/Delete/RunNow/History rebind to
workspaceID before touching the row).

Endpoints exposed:
  GET    /workspaces/:id/schedules
  POST   /workspaces/:id/schedules
  PUT    /workspaces/:id/schedules/:scheduleId
  DELETE /workspaces/:id/schedules/:scheduleId
  POST   /workspaces/:id/schedules/:scheduleId/run
  GET    /workspaces/:id/schedules/:scheduleId/history
  GET    /workspaces/:id/schedules/health

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hongming closed this pull request 2026-05-23 00:20:55 +00:00
Author
Owner

Closing — bad diagnosis on my part. Schedule routes are already mounted in router.go (lines 374-385 of origin/main: wsAuth.GET/POST/PATCH/DELETE /schedules* via schedh := handlers.NewScheduleHandler()). This PR would have duplicate-registered the same paths and Gin would panic at startup.

Root cause of PM not having a scheduler is somewhere else — likely (a) the agent runtime SDK has no set_schedule MCP tool wired to call these endpoints, or (b) the Canvas Schedule tab targets a different URL/auth path. Need to re-diagnose before opening another PR. Issue #1692 also incorrect and will be closed.

Closing — bad diagnosis on my part. Schedule routes are already mounted in `router.go` (lines 374-385 of origin/main: `wsAuth.GET/POST/PATCH/DELETE /schedules*` via `schedh := handlers.NewScheduleHandler()`). This PR would have duplicate-registered the same paths and Gin would panic at startup. Root cause of PM not having a scheduler is somewhere else — likely (a) the agent runtime SDK has no `set_schedule` MCP tool wired to call these endpoints, or (b) the Canvas Schedule tab targets a different URL/auth path. Need to re-diagnose before opening another PR. Issue #1692 also incorrect and will be closed.
Some required checks failed
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
CI / Python Lint & Test (pull_request) Successful in 4s
CI / Detect changes (pull_request) Successful in 9s
E2E API Smoke Test / detect-changes (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 6s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 4s
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 4s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 6s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
gate-check-v3 / gate-check (pull_request) Successful in 4s
sop-checklist / review-refire (pull_request) Has been skipped
sop-checklist / na-declarations (pull_request) N/A: (none)
qa-review / approved (pull_request) Failing after 12s
security-review / approved (pull_request) Failing after 11s
sop-checklist / all-items-acked (pull_request) Successful in 10s
CI / Canvas (Next.js) (pull_request) Successful in 3s
sop-tier-check / tier-check (pull_request) Successful in 10s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
E2E Chat / E2E Chat (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
Required
Details
Harness Replays / Harness Replays (pull_request) Successful in 2s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m10s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Failing after 2m5s
Required
Details
audit-force-merge / audit (pull_request) Has been skipped
CI / Platform (Go) (pull_request) Successful in 4m45s
CI / all-required (pull_request) Successful in 5m28s
Required
Details

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1694