Detach prepared execution ownership from runners

This commit is contained in:
2026-11-05 13:52:36 +00:00
parent 7d500ee62f
commit 2f0f5fa607
5 changed files with 23 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ const (
// PreparedExecution owns one frozen, single-use runner execution.
type PreparedExecution struct {
owner *Runner
owner *runnerIdentity
mu sync.Mutex
state preparedExecutionState
details *domain.PreparedRun
@@ -63,7 +63,7 @@ func (r *Runner) PrepareExecution(ctx context.Context, req domain.RunRequest) (*
}
return &PreparedExecution{
owner: r,
owner: r.identity,
state: preparedExecutionReady,
details: details,
payload: &preparedExecutionPayload{
@@ -170,7 +170,7 @@ func (r *Runner) RunPrepared(ctx context.Context, prepared *PreparedExecution) (
}
func (p *PreparedExecution) claim(owner *Runner) (*preparedExecutionPayload, error) {
if p == nil || owner == nil || p.owner != owner {
if p == nil || owner == nil || owner.identity == nil || p.owner != owner.identity {
return nil, fmt.Errorf("%w: prepared execution does not belong to this runner", ErrInvalidRequest)
}