molecule-core/workspace-server
Hongming Wang 4f67fe59fb feat(handlers): RestartWorkspaceAuto dispatcher — #2799 Phase 1
Closes the third silent-drop-on-SaaS class for the restart verb. Two
of the three dispatchers were already in place (provisionWorkspaceAuto
PR #2811, StopWorkspaceAuto PR #2824); this completes the trio.

PR #2835 was an earlier attempt at this work (delivered by a peer
agent) that I had to send back for four critical bugs — stop-leg
dispatch order inverted, no-backend nil-deref, empty payload (dispatcher
unusable by callers), forcing-function tests red-from-day-1. This
re-do takes the audit + classification from that work but rebuilds
the implementation against the existing dispatcher convention.

Phase 1 scope:

  - RestartWorkspaceAuto in workspace.go — symmetric mirror of
    provisionWorkspaceAuto + StopWorkspaceAuto. CP-first dispatch
    order. cpStopWithRetry on the SaaS leg (Restart's "make it alive
    again" contract justifies the retry that StopWorkspaceAuto's
    delete-time contract does not). Three-arm shape including a
    no-backend mark-failed defense-in-depth.
  - Three new pin tests covering the routing surface:
    TestRestartWorkspaceAuto_RoutesToCPWhenSet,
    TestRestartWorkspaceAuto_RoutesToDockerWhenOnlyDocker,
    TestRestartWorkspaceAuto_NoBackendMarksFailed.

Phase 2/3 (deferred, file as follow-up issue):

  - workspace_restart.go's manual dispatch sites (Restart handler
    goroutine, Resume handler goroutine, runRestartCycle's inline
    Stop, Pause loop). Each site has async-context reasoning beyond
    a fire-and-return dispatcher and needs per-site review.
  - Pause specifically needs a different verb (PauseWorkspaceAuto)
    since Pause doesn't reprovision.

Why no callers migrated in this PR: the existing call sites in
workspace_restart.go all build their `payload` from a synchronous
DB read first; rewiring them needs care to preserve that ordering
plus the resetClaudeSession + template path resolution that lives
in the HTTP handler context. Splitting the dispatcher introduction
from the migration keeps each PR small and reviewable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 21:30:36 -07:00
..
cmd Memory v2 fixup Critical: wire plugin from main.go (was fully dormant) 2026-05-04 10:22:30 -07:00
internal feat(handlers): RestartWorkspaceAuto dispatcher — #2799 Phase 1 2026-05-04 21:30:36 -07:00
migrations feat(delegations): durable per-task ledger + audit-write helper (RFC #2829 PR-1) 2026-05-04 20:43:06 -07:00
pkg/provisionhook
.ci-force
.gitignore
.golangci.yaml
Dockerfile feat(deploy): verify each tenant /buildinfo matches published SHA after redeploy 2026-04-30 10:55:08 -07:00
Dockerfile.tenant feat(deploy): verify each tenant /buildinfo matches published SHA after redeploy 2026-04-30 10:55:08 -07:00
entrypoint-tenant.sh
go.mod chore(deps)(deps): bump github.com/creack/pty in /workspace-server 2026-05-02 19:22:48 +00:00
go.sum chore(deps)(deps): bump github.com/creack/pty in /workspace-server 2026-05-02 19:22:48 +00:00