Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/openapi-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -29253,6 +29253,10 @@
"description": "The requests per minute value.",
"type": "integer"
},
"script_memory_mb": {
"description": "The script memory mb value.",
"type": "integer"
},
"script_timeout_ms": {
"description": "The script timeout ms value.",
"type": "integer"
Expand Down
18 changes: 16 additions & 2 deletions internal/operatorcontrols/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,19 @@ Per-run broker quotas and conversation admission remain separate controls.
Enabled condition and action scripts share the instance-wide `concurrent_scripts`
admission pool. `script_timeout_ms` caps both runtimes and action-script REST
deadlines; node settings can only narrow the ceiling. Permits are released on
success, error and cancellation. These ceilings are not heap/process isolation.
Keep untrusted scripts disabled until a separately bounded worker design is available.
success, error and cancellation. When `concurrent_scripts` is unset, action
workers fall back to a finite default of 4: each execution is a process, so an
unset limit must not mean unbounded spawning.

`execute_script` action nodes run in a separate worker process per execution
(selected by `WINDSHIFT_SCRIPT_WORKER=1` on the server binary). The worker gets
`script_memory_mb` (default 128) as a hard per-script heap budget: the worker
sets its own Go memory limit, an in-worker monitor interrupts a runaway
allocation, and on Linux the parent additionally kills the worker when its
resident set passes its baseline plus the budget and a small runtime allowance.
A killed or over-budget worker fails the node with a bounded error, and the API
process is unaffected. The timeout is one absolute instant shared by the parent
and the worker, so startup time counts against the budget, and the parent
refuses a worker frame larger than 1 MiB before decoding it.
Condition scripts still evaluate in-process; they are admin-gated and capped by
`script_timeout_ms` and the 10 KiB source limit.
2 changes: 2 additions & 0 deletions internal/operatorcontrols/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type Limits struct {
RequestsPerMinute int64 `json:"requests_per_minute,omitempty"`
ScriptTimeoutMS int `json:"script_timeout_ms,omitempty"`
ConcurrentScripts int `json:"concurrent_scripts,omitempty"`
ScriptMemoryMB int `json:"script_memory_mb,omitempty"`
AutomationStepsPerDay int64 `json:"automation_steps_per_day,omitempty"`
MailRecipientsPerDay int64 `json:"mail_recipients_per_day,omitempty"`
AITokensPerDay int64 `json:"ai_tokens_per_day,omitempty"`
Expand Down Expand Up @@ -133,6 +134,7 @@ func (p Policy) Validate() error {
"concurrent_requests": int64(limits.ConcurrentRequests), "concurrent_streams": int64(limits.ConcurrentStreams),
"requests_per_minute": limits.RequestsPerMinute, "script_timeout_ms": int64(limits.ScriptTimeoutMS),
"concurrent_scripts": int64(limits.ConcurrentScripts), "automation_steps_per_day": limits.AutomationStepsPerDay,
"script_memory_mb": int64(limits.ScriptMemoryMB),
"mail_recipients_per_day": limits.MailRecipientsPerDay, "ai_tokens_per_day": limits.AITokensPerDay,
"concurrent_ai": int64(limits.ConcurrentAI),
} {
Expand Down
Loading
Loading