Repository navigation
Allow behavior-defined engines to default durable continuation on - #77058
lavaman131 wants to merge 3 commits into
Conversation
Add optional `behaviors.durable.default-retention-days` (1 to 90) so a behavior-defined engine definition can enable artifact-backed durable continuation by default without requiring each consuming workflow to set `engine.durable`. Allow `engine.durable: false` to opt out, attribute engine-default durability in the experimental-feature warning, and skip implicit durability with a warning when a workflow uses `workflow_call`, `tools.work-queue`, explicit concurrency, or a custom command, driver, or harness override.
c863dcf to
7e10d0b
Compare
| data.EngineConfig.durableDefaultSkipReason = reason | ||
| return | ||
| } | ||
| data.EngineConfig.Durable = &DurableConfig{ |
| data.EngineConfig.durableDefaultSkipReason = reason | ||
| return | ||
| } | ||
| data.EngineConfig.Durable = &DurableConfig{ |
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully!
|
There was a problem hiding this comment.
Review completed. I found one actionable documentation correctness issue: the generated frontmatter reference shows engine.durable: true, but the schema and parser accept only false or an object, so following the example causes compilation to fail. The inline comment identifies the fix. The specialist pass was unavailable due to tool-permission rejection; findings were independently adjudicated from the pre-fetched diff and targeted source reads.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| retention-days: 1 | ||
|
|
||
| # Format 2: Disable durable mode when the selected engine enables it by default. | ||
| durable: true |
There was a problem hiding this comment.
This example uses durable: true, but the new schema explicitly accepts only an object or the boolean false; true is rejected by applyEngineDurableField. As generated reference documentation, this will direct users to a workflow that fails compilation. Please change the example to durable: false (and regenerate the repeated sections).
There was a problem hiding this comment.
Updated schema-example generation so const values are honored, then regenerated the reference; the opt-out examples now use durable: false. Fixed in 573d122e.
✅ Design Decision Gate — ADR VerifiedADR reviewed: ADR-77058: Engine-Default Durable Continuation (link unavailable: invalid HTTPS URL) — implementation aligns with the stated decision. Great work! 🏗️ 📋 Verification SummaryWhy the gate applies: no Decision vs. diff:
📝 Non-blocking notes
|
There was a problem hiding this comment.
What this change does: It lets behavior-defined engines enable durable continuation by default. Workflows can opt out, and incompatible workflow shapes skip the default.
Should fix: Reuse the existing trigger detection helper, as noted inline.
Verdict: Ship.
Lean: -15 lines possible.
Generated by ✂️ Ponytail Reviewer for #77058 · codex · routed: gpt61 medium · ~8 AIC · ⌖ ~1 AIC · ⊞ 181
Comment /ponytail to run again
| return data.RawFrontmatter != nil && c.extractConcurrencySection(data.RawFrontmatter) != "" | ||
| } | ||
|
|
||
| func frontmatterHasWorkflowCallTrigger(frontmatter map[string]any) bool { |
There was a problem hiding this comment.
Should fix: This repeats frontmatterHasTrigger in workflow_builder_steps.go for the same scalar, list, and map trigger forms, so changes to trigger parsing must be maintained twice. Reuse that helper here, adding support there for the extra whitespace and []string cases if needed, and delete this copy.
There was a problem hiding this comment.
Reused frontmatterHasTrigger and added trimming plus []string support for the trigger forms handled here. Added regression coverage. Fixed in 573d122e.
There was a problem hiding this comment.
🟡 Changes recommended
The schema-docs generator ignores const, producing six durable: true opt-out examples that fail compilation because both the schema and engine parser reject that value.
1 open issue
What changed in this PR
This PR lets behavior-defined engines enable artifact-backed durable continuation by default, reusing gh-aw’s existing session persistence paths while preserving workflow-level control.
Changes:
- Add default retention settings, explicit overrides, and
engine.durable: falseopt-out. - Skip implicit durability for incompatible workflows with a warning, while keeping explicit requests strict.
- Add validation, regression tests, reference documentation, and an architectural decision record.
| File | Description |
|---|---|
pkg/workflow/threat_detection_helpers.go |
Clear durability metadata when cloning detector configuration. |
pkg/workflow/engine.go |
Track durability opt-out and skip reasons. |
pkg/workflow/engine_durable.go |
Resolve defaults, check compatibility, and emit warnings. |
pkg/workflow/engine_durable_test.go |
Cover defaults, overrides, opt-out, and incompatible workflows. |
pkg/workflow/engine_definition.go |
Add the default retention field. |
pkg/workflow/compiler_validators.go |
Integrate default-specific durability warnings. |
pkg/workflow/compiler_orchestrator_workflow.go |
Apply durability defaults during workflow setup. |
pkg/workflow/behavior_defined_engine.go |
Validate definitions and copy retention settings. |
pkg/workflow/behavior_defined_engine_durable.go |
Validate retention consistency and reject inline-driver overrides. |
pkg/parser/schemas/main_workflow_schema.json |
Define default retention and boolean opt-out schema options. |
docs/src/content/docs/reference/third-party-agent.md |
Explain engine-defined durability defaults and restrictions. |
docs/src/content/docs/reference/frontmatter-full.md |
Regenerate configuration reference examples. |
docs/src/content/docs/reference/engines.md |
Document workflow overrides and compatibility behavior. |
docs/adr/77058-engine-default-durable-retention.md |
Record the design rationale and tradeoffs. |
.changeset/minor-engine-default-durable.md |
Add a minor-release changelog entry. |
Review effort: Balanced (auto)
| }, | ||
| { | ||
| "type": "boolean", | ||
| "const": false, |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /grill-with-docs (docs and vocabulary) and /codebase-design (scope of the explicit path). Requesting changes on one user-facing doc error and one unintended side effect.
📋 Key Themes & Highlights
Key Themes
- Doc/schema mismatch:
frontmatter-full.mddocumentsengine.durable: trueas valid, but the schema andapplyEngineDurableFieldreject it. The root cause isscripts/generate-schema-docs.jsignoringconston boolean fields. The fix belongs in the generator, not in the generated file. - Explicit path scope creep:
validateEngineDurablenow also rejects work-queue and rawworkflow_callfor explicitengine.durable. That is broader than the PR describes. - Silent skip on parse error:
validateEngineDefinitionDurableConsistencyreturns nil when the engine JSON fails to unmarshal. The error-message path is only covered by a barerequire.Error. - Unrelated regen churn: the
labels: []comment removal and router text infrontmatter-full.mddo not belong to this change.
Positive Highlights
- ✅ Incompatible shapes skip with a warning for the implicit default, and explicit
engine.durablekeeps hard errors. The matrix test covers this well. - ✅ Resolving the default once in
setupWorkflowBuildContextand reusing the existingDurable != nilpaths keeps the change small. - ✅ The targeted durable tests pass (
go test ./pkg/workflow/ -run Durable).
Not Duplicated
The two existing github-advanced-security comments on engine_durable.go:110 (session-history exposure in artifacts and prompt-injection via restored state) still apply. They are not repeated here.
Open Questions (not blocking)
- The implicit path can still hard-fail through
validateEngineDurableorGetDurableExecutionPlan(for example, a protected-session-capture mismatch). Should that surface as a warning like the other incompatible shapes? pi_engine_config.go:173clearsDurablefor the Pi sub-agent but notDurableDisabledor the skip reason. Is that intentional? This line is unchanged, so I did not comment inline.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~13 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| retention-days: 1 | ||
|
|
||
| # Format 2: Disable durable mode when the selected engine enables it by default. | ||
| durable: true |
There was a problem hiding this comment.
[/diagnosing-bugs] The docs show durable: true as a valid "Format 2", but the schema (const: false) and applyEngineDurableField both reject it. Root cause is scripts/generate-schema-docs.js (~L147): every boolean sample renders as true and ignores const. The same wrong line appears in 6 places.
💡 Suggested fix
Make the generator honor const (use the const value when present), then run make generate-schema-docs. Hand-editing frontmatter-full.md will be overwritten on the next regen.
@copilot please address this.
There was a problem hiding this comment.
The schema-doc generator now uses a property's const value before its type sample and the reference has been regenerated; durable opt-outs are false. Fixed in 573d122e.
| return nil | ||
| } | ||
| var raw map[string]any | ||
| if err := jsonutil.UnmarshalString(engineJSON, &raw); err != nil { |
There was a problem hiding this comment.
[/tdd] This returns nil on a JSON unmarshal error, so the durable: false + default-retention-days check is silently skipped. Fail closed instead.
💡 Suggested change
Return the error, for example return fmt.Errorf("engine definition %q: parse engine JSON: %w", def.ID, err). The existing case in engine_durable_test.go (~L626) only calls require.Error. Assert the specific message for the durable: false case (for example with require.ErrorContains), so an unrelated failure cannot satisfy it.
@copilot please address this.
There was a problem hiding this comment.
Invalid engine JSON now returns a contextual parse error instead of being silently ignored; the regression test asserts that message. Fixed in 573d122e.
| } | ||
| if hasWorkflowCallTrigger(data.On) || data.WorkQueuePolicy != nil { | ||
| if hasWorkflowCallTrigger(data.On) || frontmatterHasWorkflowCallTrigger(data.RawFrontmatter) || | ||
| data.WorkQueuePolicy != nil || isWorkQueueEnabled(data) { |
There was a problem hiding this comment.
[/codebase-design] This also changes the explicit engine.durable path, not only the engine default. isWorkQueueEnabled(data) and the raw-frontmatter workflow_call check are now enforced for explicit config too. The new skip rules are scoped to the default, so this looks like an unintended side effect.
💡 Suggested change
If the tightening is intended, document it in the changeset and add tests that pin the explicit error for work-queue and raw workflow_call shapes. If not, keep the old checks for the explicit path and gate the new ones on the implicit flag.
@copilot please address this.
There was a problem hiding this comment.
Raw-frontmatter trigger and work-queue checks now apply only to engine-default durability. Explicit durability retains the prior checks, with regression tests for both paths. Fixed in 573d122e.
| # Accepted formats: | ||
|
|
||
| # Format 1: Array of label names | ||
| labels: [] |
There was a problem hiding this comment.
[/grill-with-docs] The regen also includes unrelated churn. It drops # Array items: string under labels: [] and adds router-model text in several places. The schema hunks here do not introduce that text, so the base docs appear stale relative to the base schema.
💡 Suggested change
Split the unrelated regen into its own commit (or drop it), so this PR shows only the durable and default-retention changes. Confirm that make generate-schema-docs produces this exact diff from a clean base.
@copilot please address this.
There was a problem hiding this comment.
Removed the unrelated router-model prose and restored the labels item hint while keeping the durable-reference updates. Fixed in 573d122e.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "7e10d0bcb8ef22746b16fa0e58dc733ccbc79733",
"kind": "requested",
"schema_version": "1",
"state": "3798c4550276e05f26e22f89142b7eef9a9b85e473ef951a03b7d6a688809b01",
"work": [
"27206f45d491d3960ddb519cd84d40dc21232e36c7658a60aeb7d045b538aea8",
"52e36a48adb8a578f29e860a6bb3b2fd22e64162cb1e76627ae3ace25d75b234",
"761e49c95bb727c4dbecbff5e616d5cff6708c08ba8555b2d8fd7c7b1b2b1272",
"8cc3e36bc9e784247a8b35a235a02847cee4e488e5d0bdf96a49645a5c332c4c",
"a7eb4770e9dd96a7e8e9a481c8ee3a57f8a69020f0a07aa996bed8091a82e441",
"bb35fa47fdf056b4f9066834b487e1e308acb3f50348cf396dad9baae7175e1c"
],
"workflow": "pr-sous-chef"
}
|
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
@lavaman131 i will roll back on this
|

cc @pelikhan
Allow a behavior-defined engine definition to make artifact-backed durable continuation its default, so workflows using engines such as Atomic persist sessions and workflow journals on every eligible run without each workflow repeating
engine.durable.ADR: ADR-77058: Engine-Default Durable Continuation
What this adds
behaviors.durable.default-retention-days(1to90) to behavior-defined engine definitions (EngineDurableDefinitionandmain_workflow_schema.json). When set and the workflow neither configuresengine.durablenor disables it,setupWorkflowBuildContextresolvesWorkflowData.EngineConfig.Durableonce so all existingDurable != nilpaths apply unchanged.engine.durable: falseon workflow engine configurations to opt out of an engine default, and clearDurableDisabled/ skip metadata when cloning detector engine configuration inthreat_detection_helpers.go.Using experimental feature: engine.durable (from engine default)).workflow_call,tools.work-queue, explicit workflow or engineconcurrency, or a customengine.command,engine.driver, orengine.harness-script, while preserving hard errors whenengine.durableis configured explicitly.make generate-schema-docs),engines.md,third-party-agent.md, a minor changeset, and an ADR.Compatibility
default-retention-days, so existing workflows are unaffected and zero.lock.ymlfiles change.engine.durableretention values overridedefault-retention-days.Validation
make fmt,make fmt-check,make fmt-check-json,make generate-schema-docs, andmake buildpassed../gh-aw compile --validate --purge --schedule-seed github/gh-aw: 365 workflows compiled, 0.lock.ymldiffs.go test ./pkg/parser/... -count=1andgo test ./pkg/workflow/... -count=1passed (withcommit.gpgsign=falsefor temp-repo fixtures; onlyTestKVMAccessExecutesAgainstFixturesfailed locally becausesetfaclis not installed on this host).make test-wasm-golden,go vet ./cmd/... ./pkg/...,make validate-cjs-syntax,make check-stale-lock-files,make check-skill-file-paths,make validate-model-alias-chains, andmake check-stale-schema-binarypassed. (golangci-lint,shellcheck, andspecs/oteltspare not installed locally.)