Run OpenCode stages on a Pipelines-owned stage service with their own limits
Stages now run on a detached Pipelines-owned opencode serve started with OPENCODE_CONFIG_CONTENT carrying stage tool_output (16384 bytes / 400 lines) and compaction.auto defaults, configurable through PIPELINES_OPENCODE_STAGE_*. Chats keep their existing service and configuration; a server-spawned chat serve can take PIPELINES_OPENCODE_CHAT_CONFIG. The service shares the user's OpenCode config, credentials and session database, keeps a stable private registration so retained references (recovery, interrupt, export) stay valid, revives on the same port after a crash, replaces itself when idle after a settings change, and is stopped on shutdown only when idle. PIPELINES_OPENCODE_STAGE_SERVICE=shared restores the previous behaviour.
This commit is contained in:
@@ -137,6 +137,9 @@ func main() {
|
||||
defer chats.Close()
|
||||
}
|
||||
srv := &http.Server{Addr: *addr, Handler: server.HandlerWithOptions(ctx, options, store), ReadHeaderTimeout: 5 * time.Second}
|
||||
// Deferred before WaitRuns so it runs after the runs settle: the owned stage
|
||||
// service is stopped only when no stage session is still active on it.
|
||||
defer opencode.StopIdleStageService()
|
||||
defer server.WaitRuns(srv.Handler)
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
|
||||
Reference in New Issue
Block a user