fix: pin native exports to stage execution service
This commit is contained in:
+10
-1
@@ -42,7 +42,7 @@ func (c OpenCodeClient) interrupt(ctx context.Context, id string, confirm bool)
|
||||
if c.command == nil && c.connection == nil {
|
||||
var connection *opencode.Connection
|
||||
var err error
|
||||
if c.Backend == "v1" && c.Reference != "" {
|
||||
if c.Reference != "" {
|
||||
connection, err = opencode.FromReference(c.Reference)
|
||||
} else {
|
||||
connection, err = opencode.Open(ctx, opencode.Executable(), c.Directory, c.Backend)
|
||||
@@ -50,6 +50,9 @@ func (c OpenCodeClient) interrupt(ctx context.Context, id string, confirm bool)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if c.Reference != "" && (connection.Backend != c.Backend || connection.Directory != c.Directory) {
|
||||
return fmt.Errorf("retained OpenCode execution context mismatch")
|
||||
}
|
||||
defer connection.Close()
|
||||
c.connection = connection
|
||||
c.Backend = connection.Backend
|
||||
@@ -86,6 +89,12 @@ func (c *AgentClient) Generate(ctx context.Context, config ModelConfig, prompt s
|
||||
defer connection.Close()
|
||||
c.connection = connection
|
||||
c.Backend = connection.Backend
|
||||
if c.Backend == "v2" {
|
||||
c.Reference, err = connection.Reference()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
rules := c.permissionRules()
|
||||
data, err := c.call(ctx, "post", "/api/session", map[string]any{"title": "Pipeline audited agent stage", "agent": "build", "location": map[string]string{"directory": c.Directory}, "model": map[string]string{"providerID": config.Provider, "id": config.Model}, "permissions": rules})
|
||||
|
||||
Reference in New Issue
Block a user