Skip to content

fix(#249): schedule health endpoint accessible to CanCommunicate peers - #400

Merged
HongmingWang-Rabbit merged 1 commit into
mainfrom
fix/issue-249-schedule-health-auth-v2
Apr 16, 2026
Merged

fix(#249): schedule health endpoint accessible to CanCommunicate peers#400
HongmingWang-Rabbit merged 1 commit into
mainfrom
fix/issue-249-schedule-health-auth-v2

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /workspaces/:id/schedules/health — accessible to peer agents without holding the target workspace's bearer token
  • Auth mirrors the A2A proxy pattern: X-Workspace-ID header required, registry.CanCommunicate gate, system callers bypass both checks
  • scheduleHealthResponse intentionally omits prompt and cron_expr (prevents sensitive cron content leaking to peers)
  • Route registered on r (not wsAuth) outside the workspace-auth middleware group

Why this is a re-submission

PR #374 opened the same change but its branch diverged from a pre-bootstrap commit that predated most of the current codebase (60+ "add/add" conflicts with main). GitHub Actions never triggered CI on it because mergeable: CONFLICTING prevents pull_request webhook events from spawning workflow runs. This clean branch resolves that.

PR #374 is being closed in favour of this PR.

Test plan

  • 7 new tests in schedules_test.go: missing caller 401, self-call OK, legacy peer grandfathered, non-peer 403, system caller bypass, no prompt/cron_expr in response, DB error → 500
  • CI Platform (Go): go build ./... + go test -race ./...
  • Post-deploy: curl -H "X-Workspace-ID: <peer-id>" /workspaces/<id>/schedules/health returns schedule health without workspace bearer token

Closes #249
Supersedes #374

🤖 Generated with Claude Code

…e peers

Rebased cleanly onto current main (resolves the add/add conflicts that
blocked CI on PR #374 — the original branch diverged from a pre-repo-bootstrap
commit that predated most files).

Changes:
- schedules.go: add scheduleHealthResponse struct + Health handler
  (mirrors A2A proxy auth pattern: X-Workspace-ID + CanCommunicate gate)
- router.go: register GET /workspaces/:id/schedules/health on r (not wsAuth)
  so peer agents can query without holding the target workspace's bearer token
- schedules_test.go: 7 new tests (missing caller 401, self-call OK, legacy
  peer grandfathered, non-peer 403, system caller bypass, no prompt exposure,
  DB error 500)

isSystemCaller/validateCallerToken reused from a2a_proxy.go (same package).
registry.CanCommunicate import added to schedules.go.

Closes #249
Supersedes PR #374 (which could not get CI due to merge conflict)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit merged commit 29044c3 into main Apr 16, 2026
7 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the fix/issue-249-schedule-health-auth-v2 branch April 16, 2026 07:45
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
…e peers (#400)

Rebased cleanly onto current main (resolves the add/add conflicts that
blocked CI on PR #374 — the original branch diverged from a pre-repo-bootstrap
commit that predated most files).

Changes:
- schedules.go: add scheduleHealthResponse struct + Health handler
  (mirrors A2A proxy auth pattern: X-Workspace-ID + CanCommunicate gate)
- router.go: register GET /workspaces/:id/schedules/health on r (not wsAuth)
  so peer agents can query without holding the target workspace's bearer token
- schedules_test.go: 7 new tests (missing caller 401, self-call OK, legacy
  peer grandfathered, non-peer 403, system caller bypass, no prompt exposure,
  DB error 500)

isSystemCaller/validateCallerToken reused from a2a_proxy.go (same package).
registry.CanCommunicate import added to schedules.go.

Closes #249
Supersedes PR #374 (which could not get CI due to merge conflict)

Co-authored-by: PM (Molecule AI) <pm@molecule-ai.internal>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

platform: schedule health API requires admin auth — silent cron failures undetectable by agents

1 participant