feat(mcp-server): add scheduler_checkpoint + scheduler_restart tools

Expose two backend capabilities MCP previously omitted:
- scheduler_checkpoint: control action "checkpoint" (CRIU)
- scheduler_restart: POST /xce/v1/jobs/:id/restart (re-queues as a new
  job, resuming from the last checkpoint if one exists; returns new jobid)

schedulerclient gains CheckpointJob/RestartJob (RestartJobResult,
JobRestartRequest); Client interface updated. Both tools marked
destructive (confirm required). tools/list now reports 17 tools.

Unit tests added/updated in both modules — all pass. Backend endpoints
are existing apiserver routes; no backend changes in this commit.

Also syncs left_scheduler_work.md §八.4 (checkpoint/restart done; the
only remaining MCP tool gap is scheduler_modify, blocked on a controller
job-field-update opcode that does not exist yet).

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-08-30 10:35:50 +00:00
parent 05ac57b183
commit 6020015fa7
7 changed files with 279 additions and 10 deletions

View file

@ -51,6 +51,13 @@ type Client interface {
// ReleaseJob resumes a suspended job (action "resume", default SIGCONT).
ReleaseJob(ctx context.Context, id string) error
// CheckpointJob checkpoints a running job (action "checkpoint", CRIU).
CheckpointJob(ctx context.Context, id string) error
// RestartJob re-queues a finished job as a new job (resuming from its last
// checkpoint when one exists) and returns the new job's identity.
RestartJob(ctx context.Context, id string) (*RestartJobResult, error)
// ── Event stream (Phase 2) ──
// WatchJobs subscribes to the live job-event SSE stream and returns a