molecule-core/workspace-server
Hongming Wang 9a772bf946 feat(handlers): provisionWorkspaceAutoSync + Site 4 migration — #2799 Phase 2 PR-B
runRestartCycle's auto-restart cycle (Site 4 from PR #2843's audit)
needs synchronous provision dispatch — the outer pending-flag loop
in RestartByID relies on returning when the new container is up so
the next restart cycle doesn't race the in-flight provision goroutine
on its Stop call.

Phase 1's provisionWorkspaceAuto wraps each per-backend body in
`go func() {...}()` — wrong shape for runRestartCycle's needs. This
PR introduces provisionWorkspaceAutoSync as a behavioral mirror that
runs in the current goroutine instead.

Two helpers, kept identical except for the wrapper:

  provisionWorkspaceAuto:     spawns goroutine, returns immediately
  provisionWorkspaceAutoSync: blocks until per-backend body returns

Same backend-selection (CP first, Docker second) + no-backend
mark-failed fallback. When one grows a new arm (third backend, retry
semantics), the other should too — pinned in the docstring.

Site 4 (runRestartCycle) was the only call site that needs sync today.
Migrating it removes the last bare if-cpProv-else dispatch in the
restart code path's provision half.

Three new tests:
  - TestProvisionWorkspaceAutoSync_RoutesToCPWhenSet
  - TestProvisionWorkspaceAutoSync_NoBackendMarksFailed
  - TestRunRestartCycle_UsesProvisionWorkspaceAutoSync (source-level pin)

Out of scope (last open #2799 site):
  Phase 3 — Site 5 (Pause loop). PAUSE doesn't reprovision; needs a
  new PauseWorkspaceAuto verb. After this PR lands, Pause is the only
  inline if-cpProv-else dispatch left in workspace_restart.go.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 23:44:54 -07:00
..
cmd feat(delegations): wire RFC #2829 sweeper + admin routes into platform server 2026-05-04 22:00:59 -07:00
internal feat(handlers): provisionWorkspaceAutoSync + Site 4 migration — #2799 Phase 2 PR-B 2026-05-04 23:44:54 -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