Repository navigation
Description
Problem
When a shared import sets report-missing-tool: false or report-missing-data: false and the importing workflow has its own safe-outputs: block, the import's value is ignored: the compiled safe-outputs config still contains report_missing_tool / report_missing_data and the agent is still offered those tools. The same flags written directly in the workflow work. Other report-* flags from the same import ARE merged, so the behaviour is inconsistent.
Reproduction (gh-aw v1.2.0, v1.2.2 and v1.2.3, identical output; main read from source)
shared/y.md:
---
safe-outputs:
report-missing-data: false
report-missing-tool: false
report-failure-as-issue: false
---imp.md (imports it and has its own block):
---
on:
workflow_dispatch:
engine: copilot
permissions:
contents: read
imports: [shared/y.md]
safe-outputs:
add-comment:
max: 1
---
hidir.md: the same workflow with the three flags written directly in its own safe-outputs: block instead of the import.
Compiled GH_AW_SAFE_OUTPUTS_CONFIG:
imp:{"add_comment":{"max":1},"create_report_incomplete_issue":{},"noop":{...},"report_incomplete":{},"report_missing_data":{},"report_missing_tool":{}}, and the prompt listsTools: add_comment, report_missing_tool, report_missing_data, noop(max:2).dir:{"add_comment":{"max":1},"create_report_incomplete_issue":{},"noop":{...},"report_incomplete":{}}(both handlers absent).
What IS merged from an import in this shape: report-failed-jobs: false, report-incomplete.create-issue: false, report-failure-as-issue: false. If the importing workflow has no safe-outputs: block of its own, report-missing-tool: false from the import is honoured (not re-tested for report-missing-data).
Cause (from source, main)
pkg/workflow/imports.go, the merge of the auto-defaulted handlers (around line 475):
if (hasImported || (*result == nil && !hasMain)) && imported != nil { *result = imported }An imported false extracts to nil, so it never replaces the handler that the main workflow's safe-outputs: block auto-defaults. #64542 (closed) fixed the reverse direction (an imported block re-enabling what the main workflow set to false) with the hasMain check; this is the remaining direction.
Impact
report-missing-tool and report-missing-data can turn agent text into GitHub issues. Teams that keep their safe-output hardening in a shared import (to apply it to many workflows) get those two silently re-enabled when a workflow adds its own safe-outputs: block, with no warning. The docs for imports say only "main overrides imports", which does not describe this.
Suggestion
Treat an imported report-*: false as an explicit disable when the main workflow does not set that key, or at least warn at compile time when an imported flag is dropped. We now set these two flags in each workflow instead of the shared file as a workaround.
Activity