feat(workflow): shipped workflows run as the instance root

This commit is contained in:
sam committed 2026-10-12 01:53:55 +11:00
1 parent f765e23812
commit d31a950daa
8 files changed
+12 -2

No files matched your search

+3 -2
View File
@@ -56,12 +56,13 @@ func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task)
// declaredIdentity resolves a workflow's declared identity to the ID it is
// authorized as and the name the task carries while it runs: a configured
// identity's name, or empty for the root identity of a single-identity
// install.
// install. RootRef names the instance root, whose name differs per install,
// so the shipped workflows can declare it.
func (d *Daemon) declaredIdentity(ref string) (identity.IdentityID, string, bool) {
if runner := d.identityFor(&workflow.Task{Identity: ref}); runner != nil {
return runner.ID, runner.Name, true
}
if identity.IdentityID(ref) == d.RootIdentityID || identity.StableID(ref) == d.RootIdentityID {
if ref == workflow.RootRef || identity.IdentityID(ref) == d.RootIdentityID || identity.StableID(ref) == d.RootIdentityID {
return d.RootIdentityID, "", true
}
return "", "", false
+3
View File
@@ -69,6 +69,9 @@ type SwitchStep struct {
Cases map[string][]StepRecord `yaml:"cases" json:"cases"`
}
// RootRef is the identity a workflow declares to run as the instance root.
const RootRef = "root"
const switchDefault = "default"
// RetryPolicy is how often a failed step runs again, and how long it waits
@@ -1,4 +1,5 @@
id: feasibility
identity: root
steps:
- type: repo.prepare
- id: assess
@@ -1,4 +1,5 @@
id: implement
identity: root
steps:
- type: repo.prepare
- type: gate.repository
@@ -1,4 +1,5 @@
id: pr-review
identity: root
inputs:
pr_number:
type: number
@@ -1,4 +1,5 @@
id: remediate
identity: root
steps:
- type: review.start-round
- type: repo.prepare
@@ -1,4 +1,5 @@
id: tdd
identity: root
steps:
- type: repo.prepare
- type: gate.repository
@@ -1,4 +1,5 @@
id: triage
identity: root
steps:
- type: repo.prepare
- id: classify