Feat v0.9.7 workflow starlark write ops
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 3s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m44s
CI/CD / test-sqlite (pull_request) Successful in 3m4s
CI/CD / build-and-deploy (pull_request) Successful in 1m23s

Add workflow.start(), workflow.advance(), workflow.cancel(), and
workflow.submit_signoff() to the Starlark workflow module. Extract
WorkflowEngine interface in sandbox package to break the circular
import between workflow and sandbox packages.

- WorkflowEngine interface (Start/Advance/Cancel/SubmitSignoff)
- instanceToDict/signoffToDict/dictToJSON shared helpers
- Runner.SetWorkflowEngine setter + main.go wiring
- 6 new unit tests with mock engine

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 18:20:03 +00:00
parent ac7286f83b
commit e4bec9c18c
7 changed files with 490 additions and 46 deletions

View File

@@ -82,6 +82,7 @@ type Runner struct {
workspaceRoot string // empty = workspace module unavailable
workspaceQuota int // MB, 0 = unlimited
capabilities map[string]bool // detected environment capabilities
wfEngine WorkflowEngine // nil = workflow write ops unavailable
}
// NewRunner creates a runner with the given sandbox and dependencies.
@@ -139,6 +140,12 @@ func (r *Runner) SetCapabilities(caps map[string]bool) {
r.capabilities = caps
}
// SetWorkflowEngine attaches the workflow engine for write operations
// (start/advance/cancel/submit_signoff) in the workflow Starlark module.
func (r *Runner) SetWorkflowEngine(e WorkflowEngine) {
r.wfEngine = e
}
// SetAllowPrivateIPs disables the SSRF check that blocks connections to
// private/loopback IPs. For self-hosted environments where extensions
// reach internal services. Controlled by EXT_ALLOW_PRIVATE_IPS env var.
@@ -396,7 +403,7 @@ func (r *Runner) buildModulesWithLibCtx(ctx context.Context, packageID string, m
filesLevel = 2
case models.ExtPermWorkflowAccess:
modules["workflow"] = BuildWorkflowModule(ctx, r.stores)
modules["workflow"] = BuildWorkflowModule(ctx, r.stores, r.wfEngine, rc)
case models.ExtPermConnectionsRead:
if r.connResolver != nil && rc != nil && rc.UserID != "" {