molecule-core/workspace-server
Hongming Wang d084d7e61a fix(provision): consolidate org-import gate + Auto self-marks-failed
Two changes that close the silent-drop bug class:

1. Add WorkspaceHandler.HasProvisioner() and use it as the org-import
   gate. Pre-fix, org_import.go:178 read `h.provisioner != nil` (Docker-
   only) — on SaaS tenants where cpProv is wired but Docker is nil, the
   entire 220-line provisioning prep block was skipped. The Auto call
   PR #2798 added at line 395 was unreachable on SaaS.

   Repro: 2026-05-05 01:14 — hongming prod tenant, 7-workspace org
   import, every workspace sat in 'provisioning' for 10 min until the
   sweeper marked it failed with the misleading "container started but
   never called /registry/register".

2. provisionWorkspaceAuto self-marks-failed on the no-backend path.
   Defense in depth: even if a future caller bypasses HasProvisioner
   gating or ignores the bool return (TeamHandler pre-#2367 did exactly
   this), the workspace ends in a clean failed state with an actionable
   error message instead of lingering until the 10-min sweep.

   Auto becomes the single source of truth for "start a workspace" —
   routing AND the no-backend failure path. Create's redundant
   if-not-Auto-then-mark-failed block collapses (kept only the
   workspace_config UPSERT, which is a Create-specific UI concern for
   rendering runtime/model on the Config tab).

Tests:
- TestProvisionWorkspaceAuto_NoBackendMarksFailed pins the new contract
- TestHasProvisioner_TrueOnCPOnly catches the SaaS-only blind spot
- TestHasProvisioner_TrueOnDockerOnly preserves self-hosted shape
- TestHasProvisioner_FalseWhenNeitherWired pins the gate-out path
- TestOrgImportGate_UsesHasProvisionerNotBareField source-pins the gate
  (verified: FAILS against the buggy `h.provisioner != nil` shape, PASSES
  with `h.workspace.HasProvisioner()`)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 18:47:02 -07:00
..
cmd Memory v2 fixup Critical: wire plugin from main.go (was fully dormant) 2026-05-04 10:22:30 -07:00
internal fix(provision): consolidate org-import gate + Auto self-marks-failed 2026-05-04 18:47:02 -07:00
migrations feat(db): add per-peer btree indexes on activity_logs for chat_history scale (#2478) 2026-05-03 11:34:35 -07:00
pkg/provisionhook feat(#1957): wire gh-identity plugin into workspace-server 2026-04-24 15:01:41 +00:00
.ci-force chore: force Platform(Go) CI run on main — validate go vet clean 2026-04-21 15:43:19 +00:00
.gitignore
.golangci.yaml chore(workspace-server): add golangci.yaml disabling errcheck 2026-04-24 07:16:54 +00:00
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 fix(security): add USER directive before ENTRYPOINT in all tenant images (#1155) 2026-04-20 23:51:33 +00:00
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